📝 docs(prompt): enhance skill script path handling instructions

- Add CRITICAL path handling section with skill-specific conversion rules
- Include path conversion table showing SKILL.md relative paths to absolute paths
- Add 4-step execution guide for skill script path resolution
- Clarify skill directory structure (scripts/ can be at root or in scripts/ subfolder)

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
朱潮 2026-01-21 17:21:53 +08:00
parent 0922ad084a
commit d3f60e129b

View File

@ -6,24 +6,52 @@ The filesystem backend is currently operating in: `{agent_dir_path}`
### File System and Paths
**IMPORTANT - Path Handling:**
**CRITICAL - Path Handling:**
**1. Absolute Path Requirement**
- All file paths must be absolute paths (e.g., `{agent_dir_path}/file.txt`)
- Never use relative paths in bash commands - always construct full absolute paths
- Use the working directory from <env> to construct absolute paths
- Example: To create a file in your working directory, use `{agent_dir_path}/dataset/file.md`
- Never use relative paths - always construct full absolute paths
**2. Skill Script Path Conversion**
### Workspace Directory Structure
When executing scripts from SKILL.md files, you MUST convert relative paths to absolute paths:
Your working directory follows this structure:
- **`{agent_dir_path}/skills/`** - Store skills here
Skills may contain scripts or supporting files. When executing skill scripts with bash, use the real filesystem path:
Example: `bash python {agent_dir_path}/skills/rag-retrieve/script/rag-retrieve.py`
- **`{agent_dir_path}/dataset/`** - Store file datasets and document data here
- **`{agent_dir_path}/scripts/`** - Place generated executable scripts here
- **`{agent_dir_path}/download/`** - Store downloaded files and content here
**Understanding Skill Structure:**
```
{agent_dir_path}/skills/
└── {skill-name}/ # Skill directory (e.g., "query-shipping-rates")
├── SKILL.md # Skill instructions
├── skill.yaml # Metadata
├── scriptA.py # Actual script A file
└── scripts/ # Executable scripts (optional)
└── scriptB.py # Actual script B file
```
**Path Conversion Rules:**
| SKILL.md shows | Actual execution path |
|----------------|----------------------|
| `python scriptA.py` | `python {agent_dir_path}/skills/{skill-name}/scriptA.py` |
| `python scripts/scriptB.py` | `python {agent_dir_path}/skills/{skill-name}/scripts/scriptB.py` |
| `bash ./script.sh` | `bash {agent_dir_path}/skills/{skill-name}/script.sh` |
| `python query_shipping_rates.py` | `python {agent_dir_path}/skills/{skill-name}/query_shipping_rates.py` |
**IMPORTANT Execution Steps:**
1. Identify which skill you are currently executing (e.g., "query-shipping-rates")
2. Note the script path shown in SKILL.md (e.g., `python scriptA.py` or `python scripts/scriptB.py`)
3. Construct the absolute path: `{agent_dir_path}/skills/{skill-name}/[scripts/]scriptA.py` or `{agent_dir_path}/skills/{skill-name}/scripts/scriptB.py`
4. Execute with the absolute path: `python {agent_dir_path}/skills/query-shipping-rates/scriptA.py` or `python {agent_dir_path}/skills/query-shipping-rates/scripts/scriptB.py`
**3. Workspace Directory Structure**
- **`{agent_dir_path}/skills/`** - Skill packages with embedded scripts
- **`{agent_dir_path}/dataset/`** - Store file datasets and document data
- **`{agent_dir_path}/scripts/`** - Place generated executable scripts here (not skill scripts)
- **`{agent_dir_path}/download/`** - Store downloaded files and content
**Path Examples:**
- Skill script: `{agent_dir_path}/skills/rag-retrieve/scripts/rag_retrieve.py`
- Dataset file: `{agent_dir_path}/dataset/document.txt`
- Generated script: `{agent_dir_path}/scripts/process_data.py`
- Downloaded file: `{agent_dir_path}/download/report.pdf`