📝 docs(prompt): add skill execution workflow with read_file pattern

- Add 3-step workflow: read_file → extract command → bash execute
- Include complete example showing read_file + bash execution pattern
- Clarify that SKILL.md must be read with read_file tool before execution
- Add key rules with checkmarks (always read_file, always absolute paths)

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:50:58 +08:00
parent d3f60e129b
commit f29fd1fb54

View File

@ -20,7 +20,7 @@ When executing scripts from SKILL.md files, you MUST convert relative paths to a
**Understanding Skill Structure:**
```
{agent_dir_path}/skills/
└── {skill-name}/ # Skill directory (e.g., "query-shipping-rates")
└── [skill-name]/ # Skill directory (e.g., "query-shipping-rates")
├── SKILL.md # Skill instructions
├── skill.yaml # Metadata
├── scriptA.py # Actual script A file
@ -32,16 +32,16 @@ When executing scripts from SKILL.md files, you MUST convert relative paths to a
| 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` |
| `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. 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/[skill-name]/scriptA.py` or `python {agent_dir_path}/skills/[skill-name]/scripts/scriptB.py`
**3. Workspace Directory Structure**
@ -71,6 +71,46 @@ When using the write_todos tool:
The todo list is a planning tool - use it judiciously to avoid overwhelming the user with excessive task tracking.
### Skill Execution Workflow
**CRITICAL**: When you need to use a skill, follow this exact workflow:
**Step 1: Read the SKILL.md file**
```
Use read_file tool to read: {agent_dir_path}/skills/[skill-name]/SKILL.md
```
Example:
```
read_file({agent_dir_path}/skills/query-shipping-rates/SKILL.md)
```
**Step 2: Extract the script command from SKILL.md**
- The SKILL.md will show example commands like `python scriptA.py`
- Note the script name and any parameters
**Step 3: Convert to absolute path and execute**
- Construct the full absolute path
- Use bash tool to execute with absolute path
Example execution flow:
```
1. read_file("{agent_dir_path}/skills/query-shipping-rates/SKILL.md")
→ SKILL.md shows: python query_shipping_rates.py --origin "CN" --destination "US"
2. Convert path:
query_shipping_rates.py → {agent_dir_path}/skills/query-shipping-rates/query_shipping_rates.py
3. Execute with bash:
bash python {agent_dir_path}/skills/query-shipping-rates/query_shipping_rates.py --origin "CN" --destination "US"
```
**Key Rules:**
- ✅ ALWAYS use `read_file` to load SKILL.md before executing
- ✅ ALWAYS use absolute paths in bash commands
- ❌ NEVER execute scripts without reading the SKILL.md first
- ❌ NEVER use relative paths in bash commands
### Progressive Skill Loading Strategy
**IMPORTANT**: You have access to a large number of Skill files in your working directory. To ensure efficient and accurate execution, you MUST follow these progressive loading rules: