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

@@ -40,7 +40,7 @@ metadata:
description: >-
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. Use when 用户提到 Excel、 电子表格、xlsx、表格处理、公式计算、数据清洗、图表、CSV导入导出。
body: ./SKILL.zh-CN.md
source_hash: sha256:de1660781d23798b
source_hash: sha256:17c76a78ed03d451
translated_by: human
en-US:
name: Spreadsheet Processing
@@ -48,8 +48,8 @@ metadata:
description: >-
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. Use when the user mentions Excel, spreadsheets, xlsx, table processing, formula computation, data cleaning, charts, or CSV import/export.
body: ./SKILL.md
source_hash: sha256:de1660781d23798b
translated_by: ai:claude-opus-4-7
source_hash: sha256:17c76a78ed03d451
translated_by: human
translated_at: '2026-05-03'
market:
icon: >-
@@ -93,6 +93,20 @@ xlsx is a **Procedural Skill** that provides full processing capabilities for Ex
## 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" spreadsheet.xlsx unpacked/
python "<skill-dir>/scripts/office/pack.py" unpacked/ output.xlsx
python "<skill-dir>/scripts/recalc.py" output.xlsx
```
**NEVER** run `python scripts/office/unpack.py` directly — that relative path does not exist in the user's working directory.
## Prerequisites
### Python 3 (required)