Install any skill in seconds. Free to start, no credit card required.
Get Started Free →doccker/cc-streaming-export-safety
当实现用户驱动的大文件导出或批量序列化(Excel/CSV/JSON/JSONL/PDF,数据量未知或超过 1 万行/10 MB)时触发;普通小文件下载、静态资源下载、非导出 Writer/Report 类不触发。防止 OOM、临时文件残留、同步导出阻塞 HTTP 线程和表格公式注入。
Passed 21 of 22 test cases with the skill, and 17 of 22 without it.
and 4 more in the full report
4 fixed17 passed either way1 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 4 test cases the skill fixed. Same model, same prompt, with and without the skill.
我们系统里的订单导出功能最近频繁报 OOM 错误。后台代码是用 Java 的 XSSFWorkbook 一次性加载几万条数据库记录并构建 Excel 文件的,前端直接通过 HTTP 请求等待下载。请帮我审查代码逻辑并提供改写方案,要求调整为内存安全的导出方式,处理好临时资源回收,并按照后台异步任务机制重新设计接口交互。
| Checked | Without skill | With skill |
|---|---|---|
| Recommends replacing XSSFWorkbook with SXSSF for streaming Excel generation. | Missed | Passed |
| Requires explicitly invoking dispose() on the SXSSF workbook inside a finally block. | Missed | Passed |
| Mentions escaping text fields starting with formula characters such as '='. | Missed | Passed |
The instructions your model reads when the skill loads.
当一次性 in-memory 构建数据超过 1 万行 / 10 MB,或数据量由用户筛选决定且无法预估上限时,必须切换为流式 / 分页 API。 否则常见后果:OOM、Full GC 风暴、临时文件残留、HTTP 超时。
适用:
SXSSFWorkbook、XSSFWorkbook、EasyExcel、openpyxl、excelize、ExcelJS、PDFKit、ReportLab、JsonGenerator 等导出库不适用:
Writer / Report / Download 命名但不涉及大数据导出| 数据量级 | 推荐模式 | 备注 |
|---|---|---|
| ≤ 1 万行 / ≤ 5 MB | 内存构建 OK | XSSFWorkbook / pandas / 普通 JSON 序列化 |
| 1 万 ~ 10 万行 | 强烈建议流式 | 单机够用,但有 OOM 风险 |
| > 10 万行 / > 50 MB | 必须流式 + 异步 | 内存模型会爆 |
| 数据量未知(用户驱动) | 必须流式 + 上限保护 | 永远按最坏情况设计 |
核心判断:能不能预估上限?预估超过 1 万行就上流式。
test cases passed, vs 17 / 22 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.