← 提示词库 Meta/muse-agent/skills/artifacts/spreadsheet/SKILL.md 原文 md
🌐 中英双语对照

name: artifact_spreadsheet
metadata: { "includeInPrompt": false }
description: Create, read, edit, fix, or clean spreadsheet files (.xlsx, .xlsm, .csv, .tsv). Use whenever a build task's artifact kind is spreadsheet, or the task names a spreadsheet file and wants something done to it or produced from it, including restructuring messy tabular data into a proper workbook. Covers openpyxl generation, formulas and recalculation, editing existing workbooks, and the validation gates. Not for tasks whose deliverable is a document, report, or web page that merely contains a table.

Spreadsheet artifacts / 电子表格工件

An xlsx is generated with the preinstalled openpyxl library from a
generator script. Keep the generator under .src/: it is the editable
source for future revisions, and the binary is always regenerated from it.

xlsx 由预装的 openpyxl 库通过一个生成脚本产生。把生成脚本保存在 .src/ 下:它是日后修订时可编辑的源文件,二进制文件始终由它重新生成。

Task Path
Create, or edit with formulas and formatting openpyxl
Quick look at an existing sheet muse.read (converted to markdown, paged); it carries no cell coordinates, so never plan edits from it
Read a workbook's model (formulas AND their values) two load_workbook passes; see /opt/hatch/skills/artifacts/spreadsheet/references/formulas.md
Bulk or messy tabular data in or out Python csv from the standard library; pip install --break-system-packages pandas when a task genuinely needs it
Design, structure, number formats, model conventions /opt/hatch/skills/artifacts/spreadsheet/references/visual.md
Formulas, recalculation, editing existing workbooks /opt/hatch/skills/artifacts/spreadsheet/references/formulas.md
任务 路径
创建工作簿,或带公式和格式进行编辑 openpyxl
快速查看既有工作表 muse.read(转换为 markdown,分页);它不含单元格坐标,绝不要据此规划编辑
读取工作簿的模型(公式及其值) 两次 load_workbook 加载;参见 /opt/hatch/skills/artifacts/spreadsheet/references/formulas.md
批量或杂乱的表格数据导入/导出 标准库的 Python csv;任务确实需要时再 pip install --break-system-packages pandas
设计、结构、数字格式、模型约定 /opt/hatch/skills/artifacts/spreadsheet/references/visual.md
公式、重新计算、编辑既有工作簿 /opt/hatch/skills/artifacts/spreadsheet/references/formulas.md

Requirements on every delivered workbook:

对每个交付工作簿的要求:

Scripts / 脚本

Script What it does
/opt/hatch/skills/artifacts/scripts/recalc_xlsx.py Recalculates the workbook in place through headless LibreOffice and reports every formula-error cell as JSON; mandatory whenever the file contains formulas. errors_found exits 0: read the JSON, not the exit code
/opt/hatch/skills/artifacts/scripts/validate_xlsx.py Opens the workbook read-back: zip integrity, sheet parts, populated-cell counts; do not deliver a link while it fails. A csv output gets no reader check
脚本 作用
/opt/hatch/skills/artifacts/scripts/recalc_xlsx.py 通过无头 LibreOffice 就地重新计算工作簿,并以 JSON 报告每个公式出错单元格;文件含公式时为必跑步骤。errors_found 的退出码是 0:请读 JSON,不要看退出码
/opt/hatch/skills/artifacts/scripts/validate_xlsx.py 回读打开工作簿:zip 完整性、工作表部件、非空单元格计数;校验失败期间不要交付链接。csv 输出不做读取检查

Verification / 验证

Run recalc_xlsx.py (when formulas exist), then validate_xlsx.py, then
follow /opt/hatch/skills/artifacts/testing/SKILL.md. A clean recalculation proves
the formulas evaluate, not that they are right: spot-check two or three
formulas pull the values you expect before building out a grid.

先运行 recalc_xlsx.py(存在公式时),再运行 validate_xlsx.py,然后遵循 /opt/hatch/skills/artifacts/testing/SKILL.md。重新计算通过只能证明公式可以求值,不能证明公式是对的:在铺开整个网格之前,先抽检两三个公式是否取到你期望的值。