fix(skills): 添加脚本路径强制规则,修复 docx/pptx/xlsx 脚本找不到的问题

Agent 执行技能内置脚本时 cwd 不在技能目录,导致 python scripts/... 相对路径失败。
在 L2 规范中增加 Script Path Rule,要求使用 <skill-dir> 拼接完整路径。
This commit is contained in:
2026-05-13 20:01:56 +08:00
parent 3c48bdd96b
commit 9eb03e2f24
6 changed files with 89 additions and 9 deletions

View File

@@ -38,7 +38,7 @@ metadata:
description: >-
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of "Word doc", "word document", ".docx", or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a "report", "memo", "letter", "template", or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. Use when 用户提到 Word文档、docx、创建文档、编辑文档、报告、 备忘录、公文、合同、信函模板。
body: ./SKILL.zh-CN.md
source_hash: sha256:b9f7129ef5e82c4b
source_hash: sha256:58d1aae3a57a1851
translated_by: human
en-US:
name: Word Document Processing
@@ -46,8 +46,8 @@ metadata:
description: >-
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of "Word doc", "word document", ".docx", or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a "report", "memo", "letter", "template", or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. Use when the user mentions Word documents, docx, creating documents, editing documents, reports, memos, official documents, contracts, or letter templates.
body: ./SKILL.md
source_hash: sha256:b9f7129ef5e82c4b
translated_by: ai:claude-opus-4-7
source_hash: sha256:58d1aae3a57a1851
translated_by: human
translated_at: '2026-05-03'
market:
icon: >-
@@ -90,6 +90,19 @@ docx is a **Procedural Skill** that provides full processing capabilities for Wo
## L2: Detailed Specification
### Script Path Rule (mandatory)
The Python scripts bundled with this skill live inside the skill installation directory. You **MUST use full paths** when invoking them — never use bare relative paths.
The skill directory is provided by the `<skill-dir>` tag in the context. Prefix all `scripts/` commands accordingly:
```bash
python "<skill-dir>/scripts/office/unpack.py" document.docx unpacked/
python "<skill-dir>/scripts/office/pack.py" unpacked/ output.docx
```
**NEVER** run `python scripts/office/unpack.py` directly — that relative path does not exist in the user's working directory.
## Prerequisites
### Python 3 (required)