diff --git a/packages/core/src/agent/skills/index.ts b/packages/core/src/agent/skills/index.ts index e7343eb2..0a84f076 100644 --- a/packages/core/src/agent/skills/index.ts +++ b/packages/core/src/agent/skills/index.ts @@ -5,6 +5,7 @@ * Compatible with OpenClaw/AgentSkills specification */ +import { dirname } from "path"; import type { Skill, SkillManagerOptions, SkillsConfig, SkillCommandSpec, SkillInvocationResult } from "./types.js"; import { loadAllSkills, getProfileSkillsDir, initializeManagedSkills, getManagedSkillsDir } from "./loader.js"; import { @@ -332,6 +333,11 @@ export class SkillManager { parts.push(`## ${emoji} ${name} (${id})`); parts.push(`${desc}\n`); + // Include skill directory path so the agent can resolve relative paths + // (e.g., scripts/recalc.py → /absolute/path/to/skill/scripts/recalc.py) + const skillDir = dirname(skill.filePath); + parts.push(`**Skill directory**: \`${skillDir}\`\n`); + // Include full instructions if (skill.instructions) { parts.push(skill.instructions); diff --git a/skills/xlsx/SKILL.md b/skills/xlsx/SKILL.md index 8a617e58..dfdb1f6a 100644 --- a/skills/xlsx/SKILL.md +++ b/skills/xlsx/SKILL.md @@ -151,7 +151,7 @@ This applies to ALL calculations - totals, percentages, ratios, differences, etc 4. **Save**: Write to file 5. **Recalculate formulas (MANDATORY IF USING FORMULAS)**: Use the scripts/recalc.py script ```bash - python scripts/recalc.py output.xlsx + python3 scripts/recalc.py output.xlsx ``` 6. **Verify and fix any errors**: - The script returns JSON with error details @@ -224,12 +224,12 @@ wb.save('modified.xlsx') Excel files created or modified by openpyxl contain formulas as strings but not calculated values. Use the provided `scripts/recalc.py` script to recalculate formulas: ```bash -python scripts/recalc.py [timeout_seconds] +python3 scripts/recalc.py [timeout_seconds] ``` Example: ```bash -python scripts/recalc.py output.xlsx 30 +python3 scripts/recalc.py output.xlsx 30 ``` The script: