fix(skills): use python3 and inject skill directory path into prompt

- 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 <noreply@anthropic.com>
This commit is contained in:
Jiayuan Zhang 2026-02-15 19:53:18 +08:00
parent 691e33e71e
commit b394b0ccf9
2 changed files with 9 additions and 3 deletions

View file

@ -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);

View file

@ -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 <excel_file> [timeout_seconds]
python3 scripts/recalc.py <excel_file> [timeout_seconds]
```
Example:
```bash
python scripts/recalc.py output.xlsx 30
python3 scripts/recalc.py output.xlsx 30
```
The script: