From b394b0ccf9635261b17b3af88d0d249b63a96bd1 Mon Sep 17 00:00:00 2001 From: Jiayuan Zhang Date: Sun, 15 Feb 2026 19:53:18 +0800 Subject: [PATCH] fix(skills): use python3 and inject skill directory path into prompt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SKILL.md: python → python3 (macOS has no `python` binary) - skills/index.ts: inject skill directory path so agent can resolve relative paths like scripts/recalc.py to absolute paths Co-Authored-By: Claude Opus 4.6 --- packages/core/src/agent/skills/index.ts | 6 ++++++ skills/xlsx/SKILL.md | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) 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: