simple-skills 1.3.7 → 1.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -5
- package/package.json +1 -1
- package/skills/engineering/README.md +1 -2
- package/skills/engineering/officedocs/SKILL.md +306 -0
- package/skills/engineering/requirement-workflow/SKILL.md +1 -1
- package/skills/engineering/docx/SKILL.md +0 -617
- package/skills/engineering/docx/scripts/office/__pycache__/soffice.cpython-314.pyc +0 -0
- package/skills/engineering/docx/scripts/office/helpers/__pycache__/__init__.cpython-314.pyc +0 -0
- package/skills/engineering/docx/scripts/office/helpers/__pycache__/merge_runs.cpython-314.pyc +0 -0
- package/skills/engineering/docx/scripts/office/helpers/__pycache__/simplify_redlines.cpython-314.pyc +0 -0
- package/skills/engineering/pptx/SKILL.md +0 -221
- package/skills/engineering/pptx/scripts/__init__.py +0 -0
- package/skills/engineering/pptx/scripts/office/helpers/__init__.py +0 -0
- package/skills/engineering/pptx/scripts/office/helpers/merge_runs.py +0 -199
- package/skills/engineering/pptx/scripts/office/helpers/simplify_redlines.py +0 -197
- package/skills/engineering/pptx/scripts/office/pack.py +0 -159
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +0 -1499
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +0 -146
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +0 -1085
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +0 -11
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +0 -3081
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +0 -23
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +0 -185
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +0 -287
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +0 -1676
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +0 -28
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +0 -144
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +0 -174
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +0 -25
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +0 -18
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +0 -59
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +0 -56
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +0 -195
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +0 -582
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +0 -25
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +0 -4439
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +0 -570
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +0 -509
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +0 -12
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +0 -108
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +0 -96
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +0 -3646
- package/skills/engineering/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +0 -116
- package/skills/engineering/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +0 -42
- package/skills/engineering/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +0 -50
- package/skills/engineering/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +0 -49
- package/skills/engineering/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +0 -33
- package/skills/engineering/pptx/scripts/office/schemas/mce/mc.xsd +0 -75
- package/skills/engineering/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +0 -560
- package/skills/engineering/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +0 -67
- package/skills/engineering/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +0 -14
- package/skills/engineering/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +0 -20
- package/skills/engineering/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +0 -13
- package/skills/engineering/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +0 -4
- package/skills/engineering/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +0 -8
- package/skills/engineering/pptx/scripts/office/soffice.py +0 -183
- package/skills/engineering/pptx/scripts/office/unpack.py +0 -132
- package/skills/engineering/pptx/scripts/office/validate.py +0 -111
- package/skills/engineering/pptx/scripts/office/validators/__init__.py +0 -15
- package/skills/engineering/pptx/scripts/office/validators/base.py +0 -847
- package/skills/engineering/pptx/scripts/office/validators/docx.py +0 -446
- package/skills/engineering/pptx/scripts/office/validators/pptx.py +0 -275
- package/skills/engineering/pptx/scripts/office/validators/redlining.py +0 -247
- package/skills/engineering/xlsx/SKILL.md +0 -320
- package/skills/engineering/xlsx/scripts/office/helpers/__init__.py +0 -0
- package/skills/engineering/xlsx/scripts/office/helpers/merge_runs.py +0 -199
- package/skills/engineering/xlsx/scripts/office/helpers/simplify_redlines.py +0 -197
- package/skills/engineering/xlsx/scripts/office/pack.py +0 -159
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +0 -1499
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +0 -146
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +0 -1085
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +0 -11
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +0 -3081
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +0 -23
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +0 -185
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +0 -287
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +0 -1676
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +0 -28
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +0 -144
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +0 -174
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +0 -25
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +0 -18
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +0 -59
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +0 -56
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +0 -195
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +0 -582
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +0 -25
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +0 -4439
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +0 -570
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +0 -509
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +0 -12
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +0 -108
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +0 -96
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +0 -3646
- package/skills/engineering/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +0 -116
- package/skills/engineering/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +0 -42
- package/skills/engineering/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +0 -50
- package/skills/engineering/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +0 -49
- package/skills/engineering/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +0 -33
- package/skills/engineering/xlsx/scripts/office/schemas/mce/mc.xsd +0 -75
- package/skills/engineering/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +0 -560
- package/skills/engineering/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +0 -67
- package/skills/engineering/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +0 -14
- package/skills/engineering/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +0 -20
- package/skills/engineering/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +0 -13
- package/skills/engineering/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +0 -4
- package/skills/engineering/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +0 -8
- package/skills/engineering/xlsx/scripts/office/soffice.py +0 -183
- package/skills/engineering/xlsx/scripts/office/unpack.py +0 -132
- package/skills/engineering/xlsx/scripts/office/validate.py +0 -111
- package/skills/engineering/xlsx/scripts/office/validators/__init__.py +0 -15
- package/skills/engineering/xlsx/scripts/office/validators/base.py +0 -847
- package/skills/engineering/xlsx/scripts/office/validators/docx.py +0 -446
- package/skills/engineering/xlsx/scripts/office/validators/pptx.py +0 -275
- package/skills/engineering/xlsx/scripts/office/validators/redlining.py +0 -247
- /package/skills/engineering/{pptx → officedocs}/editing.md +0 -0
- /package/skills/engineering/{pptx → officedocs}/pptxgenjs.md +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/__init__.py +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/accept_changes.py +0 -0
- /package/skills/engineering/{pptx → officedocs}/scripts/add_slide.py +0 -0
- /package/skills/engineering/{pptx → officedocs}/scripts/clean.py +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/comment.py +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/helpers/__init__.py +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/helpers/merge_runs.py +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/helpers/simplify_redlines.py +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/pack.py +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/mce/mc.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/microsoft/wml-2010.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/microsoft/wml-2012.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/microsoft/wml-2018.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/microsoft/wml-cex-2018.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/microsoft/wml-cid-2016.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/schemas/microsoft/wml-symex-2015.xsd +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/soffice.py +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/unpack.py +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/validate.py +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/validators/__init__.py +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/validators/base.py +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/validators/docx.py +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/validators/pptx.py +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/office/validators/redlining.py +0 -0
- /package/skills/engineering/{xlsx → officedocs}/scripts/recalc.py +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/templates/comments.xml +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/templates/commentsExtended.xml +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/templates/commentsExtensible.xml +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/templates/commentsIds.xml +0 -0
- /package/skills/engineering/{docx → officedocs}/scripts/templates/people.xml +0 -0
- /package/skills/engineering/{pptx → officedocs}/scripts/thumbnail.py +0 -0
package/README.md
CHANGED
|
@@ -95,14 +95,13 @@ rm -rf ~/.claude/skills # 若当初装了这份
|
|
|
95
95
|
| [finishing-a-development-branch](./skills/engineering/finishing-a-development-branch/SKILL.md) | 收尾开发分支:验证测试、检测环境、展示集成选项、执行并清理 |
|
|
96
96
|
| [frontend-design](./skills/engineering/frontend-design/SKILL.md) | 创建有设计感、生产级的前端界面,视觉与代码质量并重 |
|
|
97
97
|
| [image-to-code](./skills/engineering/image-to-code/SKILL.md) | 把设计稿截图转成生产级代码,自动检测框架、复用现有组件 |
|
|
98
|
+
| [officedocs](./skills/engineering/officedocs/SKILL.md) | 处理 Microsoft Office 三件套:Word(.docx)、PowerPoint(.pptx)、Excel(.xlsx)——创建、读取、编辑、提取、转换与清理 |
|
|
98
99
|
| [pdf](./skills/engineering/pdf/SKILL.md) | 处理 PDF 的一切操作:读取/提取、合并、拆分、旋转、水印、表单、加密解密、OCR |
|
|
99
100
|
| [performance](./skills/engineering/performance/SKILL.md) | 性能分析与优化:成本估算 → 剖析定位 → 优化技术目录 → 微基准验证 |
|
|
100
101
|
| [playwright-cli](./skills/engineering/playwright-cli/SKILL.md) | 用 playwright-cli 自动化浏览器交互、测试网页并生成测试代码 |
|
|
101
|
-
| [pptx](./skills/engineering/pptx/SKILL.md) | 处理一切涉及 .pptx 的工作:创建、读取、提取、编辑、合并拆分演示文稿 |
|
|
102
102
|
| [skill-creator](./skills/engineering/skill-creator/SKILL.md) | 创建、迭代改进 skill,并用 eval 与方差分析基准衡量性能 |
|
|
103
103
|
| [skill-translator](./skills/engineering/skill-translator/SKILL.md) | 批量翻译 skills 目录或文档树到目标语言,生成结构一致的副本并执行技能精简 |
|
|
104
104
|
| [verification-before-completion](./skills/engineering/verification-before-completion/SKILL.md) | 宣称完成或修复前必须运行验证命令,始终用证据支撑断言 |
|
|
105
|
-
| [xlsx](./skills/engineering/xlsx/SKILL.md) | 处理电子表格(.xlsx/.xlsm/.csv/.tsv):读写编辑、创建、转换与清理 |
|
|
106
105
|
|
|
107
106
|
## 基本工作流
|
|
108
107
|
|
|
@@ -115,9 +114,8 @@ rm -rf ~/.claude/skills # 若当初装了这份
|
|
|
115
114
|
/brainstorming <需求>
|
|
116
115
|
# 通过提问澄清需求,产出文档:CONTEXT.md、docs/adr/*
|
|
117
116
|
/explore
|
|
118
|
-
# 注:/
|
|
119
|
-
#
|
|
120
|
-
# 会遭到抵触。更实际的做法是:只对高风险、高耦合的功能模块使用,小改动跳过或使用 /brainstorming
|
|
117
|
+
# 注:/explore 的成本比你想象的高。
|
|
118
|
+
# 更实际的做法是:只对高风险、高耦合的功能模块使用,小改动跳过或使用 /brainstorming
|
|
121
119
|
|
|
122
120
|
# 2. 编写方案、规格
|
|
123
121
|
/to-spec
|
package/package.json
CHANGED
|
@@ -36,10 +36,9 @@
|
|
|
36
36
|
- **[finishing-a-development-branch](./finishing-a-development-branch/SKILL.md)** — 收尾开发分支:验证测试、检测环境、展示集成选项、执行并清理。
|
|
37
37
|
- **[frontend-design](./frontend-design/SKILL.md)** — 创建有设计感、生产级的前端界面,视觉与代码质量并重。
|
|
38
38
|
- **[image-to-code](./image-to-code/SKILL.md)** — 把设计稿截图转成生产级代码,自动检测框架、复用现有组件。
|
|
39
|
+
- **[officedocs](./officedocs/SKILL.md)** — 处理 Microsoft Office 三件套:Word(.docx)、PowerPoint(.pptx)、Excel(.xlsx)——创建、读取、编辑、提取、转换与清理。
|
|
39
40
|
- **[pdf](./pdf/SKILL.md)** — 处理 PDF 的一切操作:读取/提取、合并、拆分、旋转、水印、表单、加密解密、OCR。
|
|
40
41
|
- **[performance](./performance/SKILL.md)** — 性能分析与优化:数量级成本估算 → 剖析(pprof/perf/微基准)→ 优化技术目录(算法/内存表示/分配/并行/API/Protobuf)→ 验证。
|
|
41
42
|
- **[playwright-cli](./playwright-cli/SKILL.md)** — 用 playwright-cli 自动化浏览器交互、测试网页并生成测试代码。
|
|
42
|
-
- **[pptx](./pptx/SKILL.md)** — 处理一切涉及 .pptx 的工作:创建、读取、提取、编辑、合并拆分演示文稿。
|
|
43
43
|
- **[skill-creator](./skill-creator/SKILL.md)** — 创建、迭代改进 skill,并用 eval 与方差分析基准衡量性能。
|
|
44
44
|
- **[verification-before-completion](./verification-before-completion/SKILL.md)** — 宣称完成或修复前必须运行验证命令,始终用证据支撑断言。
|
|
45
|
-
- **[xlsx](./xlsx/SKILL.md)** — 处理电子表格(.xlsx/.xlsm/.csv/.tsv):读写编辑、创建、转换与清理。
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: officedocs
|
|
3
|
+
description: "当用户需要创建、读取、编辑或操作 Microsoft Office 文档时使用本技能,涵盖 Word(.docx)、PowerPoint(.pptx)和 Excel(.xlsx/.xlsm/.csv/.tsv)。触发场景包括:提及 'Word doc'、'.docx'、'deck'、'slides'、'presentation'、'.pptx'、电子表格、'.xlsx'、'.csv' 等内容的任何任务;生成报告、演示文稿或带公式与格式的电子表格等交付物;从这些文件提取或重组内容、编辑修订或评论、插入或替换图片、合并拆分、转换与清理。当主要交付物必须是 docx/pptx/xlsx 文件时使用本技能。请勿用于 PDF、HTML 报告、Google Docs/Sheets API 或与 Office 文档无关的通用编码任务。"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Office 文档(docx/pptx/xlsx)创建、编辑与分析
|
|
7
|
+
|
|
8
|
+
## 概述
|
|
9
|
+
|
|
10
|
+
三种格式共用 `scripts/office/` 下的工具:解包(`unpack.py`)、重新打包(`pack.py`)、XML 验证(`validate.py`)、LibreOffice 转换(`soffice.py`)。
|
|
11
|
+
|
|
12
|
+
## 快速参考
|
|
13
|
+
|
|
14
|
+
| 任务 | 实现方式 |
|
|
15
|
+
| - | - |
|
|
16
|
+
| DOCX 读取/分析 | `pandoc` 或解包获取原始 XML |
|
|
17
|
+
| DOCX 创建 | 使用 `docx-js`,参考下方「创建新文档」 |
|
|
18
|
+
| DOCX 编辑 | 解包 → 编辑 XML → 重新打包 |
|
|
19
|
+
| PPTX 读取/分析 | `python -m markitdown presentation.pptx` |
|
|
20
|
+
| PPTX 基于模板编辑或创建 | 参考 [editing.md](editing.md) |
|
|
21
|
+
| PPTX 从零开始创建 | 参考 [pptxgenjs.md](pptxgenjs.md) |
|
|
22
|
+
| XLSX 数据分析 | pandas |
|
|
23
|
+
| XLSX 公式/格式 | openpyxl + `scripts/recalc.py` 重新计算 |
|
|
24
|
+
|
|
25
|
+
## 通用工具
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# 转换为图片(视觉检查):先 soffice 转 PDF,再 pdftoppm 转图
|
|
29
|
+
python scripts/office/soffice.py --headless --convert-to pdf file.docx # 或 .pptx / .xlsx
|
|
30
|
+
pdftoppm -jpeg -r 150 file.pdf page # 生成 page-01.jpg 等;-f N -l N 可重渲染特定页
|
|
31
|
+
|
|
32
|
+
# 解包与打包
|
|
33
|
+
python scripts/office/unpack.py file.docx unpacked/
|
|
34
|
+
python scripts/office/pack.py unpacked/ output.docx --original file.docx
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
# DOCX 创建、编辑与分析
|
|
40
|
+
|
|
41
|
+
## 读取内容
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# 提取包含修订的文本
|
|
45
|
+
pandoc --track-changes=all document.docx -o output.md
|
|
46
|
+
|
|
47
|
+
# 访问原始 XML
|
|
48
|
+
python scripts/office/unpack.py document.docx unpacked/
|
|
49
|
+
|
|
50
|
+
# 旧版 .doc 必须先转换为 .docx 才能编辑
|
|
51
|
+
python scripts/office/soffice.py --headless --convert-to docx document.doc
|
|
52
|
+
|
|
53
|
+
# 生成已接受所有修订的干净文档(需要 LibreOffice)
|
|
54
|
+
python scripts/accept_changes.py input.docx output.docx
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 创建新文档(docx-js)
|
|
58
|
+
|
|
59
|
+
用 `npm install -g docx` 安装,构建后运行 `python scripts/office/validate.py doc.docx` 验证;失败则解包、修复 XML、重新打包。
|
|
60
|
+
|
|
61
|
+
### 页面尺寸
|
|
62
|
+
|
|
63
|
+
- docx-js 默认 A4,**必须显式设置页面尺寸**。DXA 单位:1440 DXA = 1 英寸。
|
|
64
|
+
- US Letter:12240 × 15840 DXA;1 英寸边距下内容宽度 = 9360。
|
|
65
|
+
- 横向:传入纵向尺寸 + `orientation: PageOrientation.LANDSCAPE`,docx-js 会内部交换宽高。
|
|
66
|
+
|
|
67
|
+
### 样式(覆盖内置标题样式)
|
|
68
|
+
|
|
69
|
+
用精确 ID(`Heading1`、`Heading2`…)覆盖内置样式,标题必须含 `outlineLevel`(H1=0,H2=1),否则目录无效:
|
|
70
|
+
|
|
71
|
+
```javascript
|
|
72
|
+
{ id: "Heading1", name: "Heading 1", basedOn: "Normal", next: "Normal", quickFormat: true,
|
|
73
|
+
run: { size: 32, bold: true, font: "Arial" },
|
|
74
|
+
paragraph: { spacing: { before: 240, after: 240 }, outlineLevel: 0 } },
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 列表(切勿使用 Unicode 项目符号)
|
|
78
|
+
|
|
79
|
+
禁止手插 `•` 字符;用 numbering 配置 + `LevelFormat.BULLET` / `LevelFormat.DECIMAL`。相同 `reference` 编号连续,不同则重新开始。
|
|
80
|
+
|
|
81
|
+
### 表格(双重宽度设置)
|
|
82
|
+
|
|
83
|
+
同时设置表格 `columnWidths` 和每个单元格 `width`,一律 `WidthType.DXA`(百分比在 Google Docs 失效)。规则:
|
|
84
|
+
|
|
85
|
+
- 表格宽度 = columnWidths 之和 = 内容宽度
|
|
86
|
+
- 底纹用 `ShadingType.CLEAR`(SOLID 会渲染成黑色背景),单元格加 `margins: { top: 80, bottom: 80, left: 120, right: 120 }`
|
|
87
|
+
- 分隔线/规则线用 Paragraph 的 `border`,**禁止用表格**(单元格有最小高度,会渲染为空框)
|
|
88
|
+
|
|
89
|
+
### 图片
|
|
90
|
+
|
|
91
|
+
`ImageRun` 必须传 `type`(png/jpg 等),`altText` 的 title/description/name 三个属性都必需。
|
|
92
|
+
|
|
93
|
+
### 其他常用元素
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
new Paragraph({ children: [new PageBreak()] }) // 分页符,PageBreak 必须在 Paragraph 内
|
|
97
|
+
new ExternalHyperlink({ children: [new TextRun({ text: "点此", style: "Hyperlink" })], link: "https://..." })
|
|
98
|
+
new Bookmark({ id: "c1", children: [new TextRun("第一章")] }) // 内部链接:Bookmark + InternalHyperlink anchor
|
|
99
|
+
footnotes: { 1: { children: [new Paragraph("来源")] } } // 正文用 FootnoteReferenceRun(1)
|
|
100
|
+
tabStops: [{ type: TabStopType.RIGHT, position: TabStopPosition.MAX }] // 点引导符用 PositionalTab leader: DOT
|
|
101
|
+
column: { count: 2, space: 720, equalWidth: true, separate: true } // 多列;自定义宽度用 new Column({width, space})
|
|
102
|
+
new TableOfContents("目录", { hyperlink: true, headingStyleRange: "1-3" }) // 目录仅支持 HeadingLevel
|
|
103
|
+
headers: { default: new Header({ children: [/*…*/] }) } // 页脚同理,页码用 PageNumber.CURRENT
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### docx-js 重要规则
|
|
107
|
+
|
|
108
|
+
- 页面尺寸必须显式设置;横向布局传纵向尺寸
|
|
109
|
+
- 切勿使用 `\n`(用独立 Paragraph)、切勿用 Unicode 项目符号
|
|
110
|
+
- `PageBreak` 必须放在 Paragraph 内
|
|
111
|
+
- 表格宽度用 DXA 且等于 columnWidths 之和;`ShadingType.CLEAR`;单元格加边距
|
|
112
|
+
- 目录仅支持 HeadingLevel 标题,不能自定义样式
|
|
113
|
+
- 覆盖内置样式用精确 ID 并包含 `outlineLevel`
|
|
114
|
+
|
|
115
|
+
## 编辑现有文档
|
|
116
|
+
|
|
117
|
+
按顺序执行全部 3 步:
|
|
118
|
+
|
|
119
|
+
1. **解包**:`python scripts/office/unpack.py document.docx unpacked/`(合并相邻文本块、智能引号转 XML 实体;`--merge-runs false` 跳过合并)
|
|
120
|
+
2. **编辑 XML**:编辑 `unpacked/word/` 中的文件,用 Edit 工具直接字符串替换,不写 Python 脚本。
|
|
121
|
+
- 修订和评论默认作者 "Opencode",除非用户另有要求
|
|
122
|
+
- 新内容用智能引号实体:`‘` `’` `“` `”`
|
|
123
|
+
- 添加评论:`python scripts/comment.py unpacked/ 0 "文本"`(`--parent 0` 回复,`--author` 自定义作者),然后在 document.xml 加标记(见「XML 参考」)
|
|
124
|
+
3. **打包**:`python scripts/office/pack.py unpacked/ output.docx --original document.docx`(自动修复 durableId 与 `xml:space="preserve"`;`--validate false` 跳过)
|
|
125
|
+
|
|
126
|
+
### 常见陷阱
|
|
127
|
+
|
|
128
|
+
- 添加修订时替换整个 `<w:r>` 块为同级的 `<w:del>/<w:ins>`,不在文本块内部注入修订标签
|
|
129
|
+
- 保留 `<w:rPr>` 格式:把原始文本块的 `<w:rPr>` 复制到修订文本块,保持粗体、字号等
|
|
130
|
+
|
|
131
|
+
## XML 参考
|
|
132
|
+
|
|
133
|
+
### 修订
|
|
134
|
+
|
|
135
|
+
**插入:**
|
|
136
|
+
|
|
137
|
+
```xml
|
|
138
|
+
<w:ins w:id="1" w:author="Opencode" w:date="2025-01-01T00:00:00Z">
|
|
139
|
+
<w:r><w:t>插入的文本</w:t></w:r>
|
|
140
|
+
</w:ins>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**删除:**
|
|
144
|
+
|
|
145
|
+
```xml
|
|
146
|
+
<w:del w:id="2" w:author="Opencode" w:date="2025-01-01T00:00:00Z">
|
|
147
|
+
<w:r><w:delText>删除的文本</w:delText></w:r>
|
|
148
|
+
</w:del>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`<w:del>` 内用 `<w:delText>` 替代 `<w:t>`。**最小化编辑**——仅标记变更部分,如 "30天"→"60天" 拆为 `<w:r>期限为 </w:r> <w:del>30</w:del> <w:ins>60</w:ins> <w:r> 天。</w:r>`。
|
|
152
|
+
|
|
153
|
+
**删除整个段落/列表项**:移除内容时同时把段落标记标为已删除(`<w:pPr><w:rPr>` 中加 `<w:del/>`),否则接受修订后留下空段落。
|
|
154
|
+
|
|
155
|
+
**拒绝他人插入**:把 `<w:del>` 嵌套在他们的 `<w:ins>` 内。**恢复他人删除**:在后面添加 `<w:ins>`,不修改他们的 `<w:del>`。
|
|
156
|
+
|
|
157
|
+
### 评论
|
|
158
|
+
|
|
159
|
+
`<w:commentRangeStart>` / `<w:commentRangeEnd>` 是 `<w:r>` 的同级元素,**绝不能放进 `<w:r>` 内部**。回复用 `--parent` 并把标记嵌套在父标记内。
|
|
160
|
+
|
|
161
|
+
### 图片生成
|
|
162
|
+
|
|
163
|
+
1. 图片放入 `word/media/`,在 `word/_rels/document.xml.rels` 添加关联(`rId5` → `media/image1.png`)
|
|
164
|
+
2. `[Content_Types].xml` 添加 `<Default Extension="png" ContentType="image/png"/>`
|
|
165
|
+
3. document.xml 中引用:`<wp:extent cx="914400" cy="914400"/>`(EMU:914400 = 1 英寸),`<a:blip r:embed="rId5"/>`
|
|
166
|
+
|
|
167
|
+
## 依赖
|
|
168
|
+
|
|
169
|
+
- pandoc(文本提取)、docx(`npm install -g docx`)、LibreOffice(PDF 转换)、Poppler `pdftoppm`(图片转换)
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
# PPTX 创建与编辑
|
|
174
|
+
|
|
175
|
+
## 读取内容
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
python -m markitdown presentation.pptx # 文本提取
|
|
179
|
+
python scripts/thumbnail.py presentation.pptx # 视觉概览
|
|
180
|
+
python scripts/office/unpack.py presentation.pptx unpacked/ # 原始 XML
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## 编辑工作流(基于模板)
|
|
184
|
+
|
|
185
|
+
**完整说明见 [editing.md](editing.md)。**
|
|
186
|
+
|
|
187
|
+
1. 用 `thumbnail.py` 分析模板
|
|
188
|
+
2. 解包 → 操作幻灯片 → 编辑内容 → 清理 → 打包
|
|
189
|
+
|
|
190
|
+
## 设计建议
|
|
191
|
+
|
|
192
|
+
**禁止做纯文字幻灯片**——每张都需要视觉元素(图片、图表、图标、形状)。布局选项:双栏、图标+文字行、2x2/2x3 网格、半出血图片;数据用大数字标注、对比列、时间线。
|
|
193
|
+
|
|
194
|
+
### 配色
|
|
195
|
+
|
|
196
|
+
选择与主题匹配的配色,禁止默认蓝色。主色占 60-70% 视觉权重,配 1-2 种辅助色 + 1 种强调色:
|
|
197
|
+
|
|
198
|
+
| 主题 | 主色 | 辅助色 | 强调色 |
|
|
199
|
+
|-------|---------|-----------|--------|
|
|
200
|
+
| **午夜商务** | `1E2761`(海军蓝) | `CADCFC`(冰蓝) | `FFFFFF`(白色) |
|
|
201
|
+
| **森林与苔藓** | `2C5F2D`(森林绿) | `97BC62`(苔藓绿) | `F5F5F5`(奶油色) |
|
|
202
|
+
| **珊瑚活力** | `F96167`(珊瑚色) | `F9E795`(金色) | `2F3C7E`(海军蓝) |
|
|
203
|
+
| **暖陶土** | `B85042`(陶土色) | `E7E8D1`(沙色) | `A7BEAE`(鼠尾草绿) |
|
|
204
|
+
| **海洋渐变** | `065A82`(深蓝) | `1C7293`(青色) | `21295C`(午夜蓝) |
|
|
205
|
+
| **炭灰极简** | `36454F`(炭灰) | `F2F2F2`(米白) | `212121`(黑色) |
|
|
206
|
+
| **青色信赖** | `028090`(青色) | `00A896`(海沫绿) | `02C39A`(薄荷绿) |
|
|
207
|
+
| **浆果与奶油** | `6D2E46`(浆果色) | `A26769`(灰玫瑰色) | `ECE2D0`(奶油色) |
|
|
208
|
+
| **鼠尾草宁静** | `84B59F`(鼠尾草绿) | `69A297`(桉树叶绿) | `50808E`(石板蓝) |
|
|
209
|
+
| **樱桃大胆** | `990011`(樱桃红) | `FCF6F5`(米白) | `2F3C7E`(海军蓝) |
|
|
210
|
+
|
|
211
|
+
### 排版与间距
|
|
212
|
+
|
|
213
|
+
- 标题 36-44pt 粗体;章节标题 20-24pt 粗体;正文 14-16pt;图注 10-12pt
|
|
214
|
+
- 最小边距 0.5 英寸;内容块间距 0.3-0.5 英寸,选择一种并保持一致
|
|
215
|
+
|
|
216
|
+
### 避免
|
|
217
|
+
|
|
218
|
+
- 重复相同布局、居中对齐正文、纯文字幻灯片、默认蓝色、随意混合间距
|
|
219
|
+
- 低对比度元素(文字/图标与背景对比不足)
|
|
220
|
+
- **标题下方绝对禁止用强调线**(AI 生成幻灯片的典型标志);用空白或背景色代替
|
|
221
|
+
|
|
222
|
+
## 质量保证(必须执行)
|
|
223
|
+
|
|
224
|
+
**假设有问题存在——你的任务是找到它们。** 首次渲染几乎不可能正确;如果检查没发现问题,说明看得不够仔细。
|
|
225
|
+
|
|
226
|
+
1. **内容检查**:`python -m markitdown output.pptx` 查缺失内容、拼写、顺序。用模板时 grep 残留占位符:
|
|
227
|
+
```bash
|
|
228
|
+
python -m markitdown output.pptx | grep -iE "xxxx|lorem|ipsum|this.*(page|slide).*layout"
|
|
229
|
+
```
|
|
230
|
+
有结果必须先修复再宣布成功。
|
|
231
|
+
2. **视觉检查**:**使用子代理**(即使 2-3 张幻灯片,子代理有全新视角)。转图后逐张找:重叠元素、文字溢出/截断、标题换行、间距过近(<0.3 英寸)、边距不足(<0.5 英寸)、对齐不一致、低对比度、过度换行、残留占位符。
|
|
232
|
+
3. **验证循环**:生成 → 转图 → 列出问题 → 修复 → **重新验证受影响的幻灯片**(一个修复常引发新问题),直到一轮检查无新问题。**至少完成一次修复-验证循环前,禁止宣布成功。**
|
|
233
|
+
|
|
234
|
+
## 依赖项
|
|
235
|
+
|
|
236
|
+
- `pip install "markitdown[pptx]"`(文本提取)、`pip install Pillow`(缩略图)、`npm install -g pptxgenjs`(从零创建)、LibreOffice(PDF 转换)、Poppler(PDF 转图片)
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
# XLSX 创建、编辑和分析
|
|
241
|
+
|
|
242
|
+
## 输出要求
|
|
243
|
+
|
|
244
|
+
### 所有 Excel 文件
|
|
245
|
+
|
|
246
|
+
- 统一专业字体(Arial/Times New Roman),除非用户另有指示
|
|
247
|
+
- 交付模型必须零公式错误(#REF!、#DIV/0!、#VALUE!、#N/A、#NAME?)
|
|
248
|
+
- 修改现有模板时严格匹配其格式与规范,模板规范优先于本指南
|
|
249
|
+
|
|
250
|
+
### 财务模型(除非用户或模板另有说明)
|
|
251
|
+
|
|
252
|
+
**颜色编码**:蓝=硬编码输入值,黑=公式和计算结果,绿=本工作簿内跨表链接,红=指向其他文件的外部链接,黄底=需关注的关键假设
|
|
253
|
+
|
|
254
|
+
**数字格式**:年份格式化为文本("2024"而非"2,024");货币 `$#,##0` 且表头注明单位;零值显示为 "-";百分比 0.0%;估值倍数 0.0x;负数用括号 (123)
|
|
255
|
+
|
|
256
|
+
**公式构建**:假设值放独立单元格,公式用单元格引用(`=B5*(1+$B$6)` 而非 `=B5*1.05`);验证引用正确、检查差一错误、预测期公式一致、测边界情况(零/负)、无循环引用。硬编码值必须注明来源:"来源: [系统/文档], [日期], [具体引用], [URL]"
|
|
257
|
+
|
|
258
|
+
## 关键要求:使用公式,不要硬编码值
|
|
259
|
+
|
|
260
|
+
**始终用 Excel 公式,禁止在 Python 中计算后硬编码**(`sheet['B10'] = '=SUM(B2:B9)'` 而非把 sum 结果写死)。电子表格必须在源数据变化时可重新计算——这适用于总计、百分比、比率、差值等所有计算。
|
|
261
|
+
|
|
262
|
+
## 读取与分析
|
|
263
|
+
|
|
264
|
+
- 数据分析用 pandas:`pd.read_excel('file.xlsx')`,`sheet_name=None` 取全部工作表;`dtype` 指定类型、`usecols` 只读指定列、`parse_dates` 解析日期
|
|
265
|
+
- 公式/格式用 openpyxl:单元格 1 索引(row=1,column=1=A1);`data_only=True` 读计算值,但**禁止用 data_only 打开后保存**(公式会被替换为值并永久丢失)
|
|
266
|
+
|
|
267
|
+
## 通用工作流
|
|
268
|
+
|
|
269
|
+
1. 选工具:数据分析 pandas,公式/格式 openpyxl
|
|
270
|
+
2. 创建或加载 → 修改(数据/公式/格式)→ 保存
|
|
271
|
+
3. **用公式时必须重新计算**:`python scripts/recalc.py output.xlsx [timeout_seconds]`
|
|
272
|
+
4. 验证:脚本返回 JSON,`status` 为 `errors_found` 时按 `error_summary` 的定位修复后重算。常见错误:`#REF!` 无效引用、`#DIV/0!` 除零、`#VALUE!` 类型错误、`#NAME?` 公式名
|
|
273
|
+
|
|
274
|
+
```python
|
|
275
|
+
from openpyxl import Workbook, load_workbook
|
|
276
|
+
from openpyxl.styles import Font
|
|
277
|
+
|
|
278
|
+
wb = Workbook(); ws = wb.active # 创建
|
|
279
|
+
ws['B2'] = '=SUM(A1:A10)'
|
|
280
|
+
ws['A1'].font = Font(bold=True, color='FF0000')
|
|
281
|
+
ws.column_dimensions['A'].width = 20
|
|
282
|
+
wb.save('output.xlsx') # 之后必须 recalc.py
|
|
283
|
+
|
|
284
|
+
wb = load_workbook('existing.xlsx') # 编辑,保留公式和格式
|
|
285
|
+
ws.insert_rows(2); ws.delete_cols(3)
|
|
286
|
+
wb.create_sheet('NewSheet'); wb.save('modified.xlsx')
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## 公式验证检查清单
|
|
290
|
+
|
|
291
|
+
- [ ] **测试 2-3 个示例引用**:构建完整模型前验证取值正确
|
|
292
|
+
- [ ] **列映射**:第 64 列是 BL,不是 BK;**行偏移**:DataFrame 第 5 行 = Excel 第 6 行(1 索引)
|
|
293
|
+
- [ ] NaN 用 `pd.notna()` 检查;搜索所有匹配项而非第一个;财年数据常在第 50 列之后
|
|
294
|
+
- [ ] 除法前检查分母(#DIV/0!);所有引用指向目标单元格(#REF!);跨表引用格式 `Sheet1!A1`
|
|
295
|
+
- [ ] 先在小范围(2-3 单元格)测公式再广泛应用;验证引用的单元格存在;测边界情况(零、负数、极大值)
|
|
296
|
+
|
|
297
|
+
## 最佳实践
|
|
298
|
+
|
|
299
|
+
- pandas 适合数据分析、批量操作和简单导出;openpyxl 适合复杂格式、公式和 Excel 特有功能
|
|
300
|
+
- 大文件:读取用 `read_only=True`,写入用 `write_only=True`
|
|
301
|
+
- openpyxl 保留公式但不计算,必须用 recalc.py 更新值
|
|
302
|
+
|
|
303
|
+
## 代码风格指南
|
|
304
|
+
|
|
305
|
+
- 简洁 Python,不要无关注释与 print;避免冗长变量名和冗余操作
|
|
306
|
+
- 复杂公式或重要假设的单元格加注释;记录硬编码值的数据来源;为关键计算和模型部分添加说明
|
|
@@ -19,7 +19,7 @@ description: 用户提出一个需求并要求方案设计或开发时必须使
|
|
|
19
19
|
|
|
20
20
|
- **`/brainstorming`** — 给出多个可行方案,供用户挑选,适用于需求描述较明确或粒度较小的任务。
|
|
21
21
|
- **`/explore`** — 通过提问澄清需求,产出文档:`CONTEXT.md`、`docs/adr/*`(`docs/adr` 目录若不存在则使用 `setup-simple-skills` 对项目进行设置)
|
|
22
|
-
- **注**:`/explore`
|
|
22
|
+
- **注**:`/explore` 成本较高,只有在当需求描述模糊时,通过提问和探索澄清需求,小改动跳过。
|
|
23
23
|
|
|
24
24
|
## 2. 编写方案、规格
|
|
25
25
|
|