Edit Tool — Unified Skill/Agent/Script Editor
Triage first — because the type decides everything downstream
Pick the tool type before writing anything. The wrong type is expensive to unwind later (a skill that should have been a 0-token bash script pollutes every session; an agent that should have been a skill loses main-context access). Triaging first is what makes this skill worth more than "just write the file".
- Analyze request against the decision tree
- Explain the call to the user so they can catch a bad fit early:
✅ [TYPE] because: pollution cost (~X tokens × Yfreq), context mode (main|fork), key factor
- Branch to the matching guide or give direct guidance
graph TD
A[Tool Request] --> AA{Plugin<br/>version/release?}
AA -->|Yes| PLUGIN[✅ edit-plugin]
AA -->|No| B{Deterministic<br/>shell only?}
B -->|Yes| C{AI needed to<br/>decide when/how?}
C -->|No| BASH[✅ Bash Script<br/>0 tokens]
C -->|Yes| D{Token<br/>budget?}
D -->|<500| WRAP[✅ Skill + scripts/]
D -->|>500| SKILL_REF[✅ Skill + reference.md]
B -->|No| E{Pollution<br/>cost?}
E -->|High >2000 tokens<br/>OR deep exploration| W{Multi-agent<br/>control flow?}
W -->|Single reasoning pass| AGENT[✅ Sub-Agent]
W -->|Loops/fan-out/<br/>verify-stages| WORKFLOW[✅ Workflow script<br/>+ optional skill wrapper]
E -->|Medium 500-2000| F{Context<br/>mode?}
F -->|Needs parent ctx + fan-out| FORK[✅ Skill context:fork<br/>NEW v2.1.117+]
F -->|Needs isolation no bias| SUBAGENT[✅ Skill context:subagent]
F -->|Needs main context| SKILL_BIG[✅ Skill + reference.md]
E -->|Low <500| G{Frequency?}
G -->|1+ per session| SKILL[✅ Skill]
G -->|Rare <1/10| DIRECT[❌ No tool needed]
style PLUGIN fill:#B2DFDB,stroke:#00897B,stroke-width:2px,color:#000
style BASH fill:#90EE90,stroke:#000,stroke-width:2px,color:#000
style SKILL fill:#FFD700,stroke:#000,stroke-width:2px,color:#000
style WRAP fill:#FFA500,stroke:#000,stroke-width:2px,color:#000
style SKILL_REF fill:#FFA500,stroke:#000,stroke-width:2px,color:#000
style SKILL_BIG fill:#87CEEB,stroke:#000,stroke-width:2px,color:#000
style FORK fill:#DDA0DD,stroke:#000,stroke-width:2px,color:#000
style SUBAGENT fill:#CE93D8,stroke:#000,stroke-width:2px,color:#000
style AGENT fill:#DDA0DD,stroke:#000,stroke-width:2px,color:#000
style WORKFLOW fill:#9FA8DA,stroke:#000,stroke-width:2px,color:#000
style DIRECT fill:#FFB6C1,stroke:#000,stroke-width:2px,color:#000
Workflow leaf: when the task needs deterministic multi-agent orchestration — pipeline/parallel/fan-out with loops, judge panels, verify-stages, loop-until-dry — author a Workflow script (optionally a thin skill wrapper that invokes it), not a single sub-agent. A sub-agent is one spawn; a Workflow choreographs many under control flow.
Default: All skills are dual-invocable (both /name and model auto-invoke). disable-model-invocation: true is opt-out for rare edge cases.
When the verdict is "skill" and correctness matters more than speed → this skill gets you a well-architected draft. To know whether that draft actually beats baseline, hand off to Anthropic's official skill-creator skill, which owns the empirical loop edit-tool deliberately does not: draft → test on real prompts → eval with/without the skill → improve → repeat, plus a script that auto-optimizes the description for triggering. Reach for it when the skill is non-trivial, will run many times, or you can't eyeball whether it works. edit-tool decides what to build and how to structure it; skill-creator proves that it works.
Modifying Existing Tools
- Locate and read existing file (SKILL.md or agent .md)
- Enumerate functional outputs — every behavior/capability = preservation contract
- Make surgical edits using Edit tool (not Write/overwrite)
- Regression check: verify each output from step 2 is retained
- Update description if changing triggers
- Validate: YAML valid, triggers clear, instructions actionable
Creating New Tools
💡 Before creating: consider running /search-skill to discover existing solutions.
- Ask for details if missing: purpose, triggers, tools needed
- Determine type via triage decision tree above
- Use
pick-model skill for model and effort selection
- Branch to appropriate guide:
| Type |
Guide |
Location |
| Skill |
references/skill-guide.md |
skills/name/SKILL.md |
| Agent |
references/agent-guide.md |
.claude/agents/name.md or plugin agents/ |
| Plugin |
edit-plugin skill |
plugin.json + marketplace.json |
| Bash |
Direct guidance (scripts/, chmod +x) |
Project scripts dir |
Frontmatter: Skill core = name (lowercase-hyphens) + description (triggers, max 1024) + context (main|fork|subagent) + model. Agent core = name + description + tools/model. Full field tables in the type guides above.
Sanity check before creating
These aren't gates to satisfy — they're the failure modes that make a new tool a net negative. Each one, and what goes wrong if you ignore it:
| Check |
Why it matters — the failure it prevents |
| Pollution acceptable? (skill: ~tokens × freq) |
A skill's body loads on every trigger. Heavy + frequent = it crowds out the actual work every session, forever. |
| SKILL.md fits ~500 tokens? (overflow → reference.md) |
Past that, the always-loaded cost outweighs the value; progressive disclosure keeps the hot path lean. |
| One capability, not a workflow bundle? (skill & agent) |
Bundles violate single-responsibility — they under-trigger (description can't cover everything) and are impossible to eval. |
| Needs multi-step reasoning with isolation? (→ agent) |
If yes, a skill in main context will either pollute or bias the reasoning; that's the signal to make it an agent. |
If a skill trips the first three, it usually wants a different shape — context:fork/subagent, an agent, or just a direct request. Say which, and why, rather than forcing the skill.
Key Principles
- Preserve function: an edit that silently drops a capability is a regression, not an improvement — enumerate outputs first, keep them unless the user asked to remove one
- ~500 tokens ideal for SKILL.md; past that the always-loaded cost starts to outweigh the value — push detail into a reference file
- Single responsibility: one focused purpose per tool, so its description can actually describe it and it can be evaluated
- Token-efficient: tables, bullets, Mermaid over prose — the context window is a shared budget
- Context-aware: main when the tool needs conversation state, fork for parallel fan-out on a shared base, subagent/agent when isolation avoids pollution or bias
Fork vs Subagent & Proactive Audit
- Choosing
fork vs subagent, fork invocation rules, "keep subagent when ANY" criteria → references/frameworks.md § Fork vs Subagent.
- On every create/edit, run the Proactive Audit (frontmatter compliance + fit check, incl. legacy
context: fork rename) → references/frameworks.md § Proactive Audit.
Parallelization
| Operation |
Guidance |
| ✅ Read-only |
Parallelize freely — no conflict possible |
| ⚠️ Writes (independent files) |
Sequential, or Plan Mode first — concurrent writes race |
| ❌ Destructive / >3 files |
Plan Mode first — the cost of a wrong parallel destructive op is unrecoverable |
See references/frameworks.md for edge cases, conversion guide, and extended examples.
1---2name: edit-tool3description: Creates, modifies, and orchestrates Claude Code tools (skills, agents, scripts). Use when user requests creating, updating, improving, or editing any Claude Code extension — skills, sub-agents, slash commands, script wrappers. Triggers include "create/make/new skill/command/agent/script", "tool for X", "slash command", "sub-agent", file paths with /skills/, /agents/. For plugin version bumps and release metadata, route directly to edit-plugin.4---56# Edit Tool — Unified Skill/Agent/Script Editor78## Triage first — because the type decides everything downstream910Pick the tool type *before* writing anything. The wrong type is expensive to unwind later (a skill that should have been a 0-token bash script pollutes every session; an agent that should have been a skill loses main-context access). Triaging first is what makes this skill worth more than "just write the file".11121. **Analyze request** against the decision tree132. **Explain the call** to the user so they can catch a bad fit early: `✅ [TYPE] because: pollution cost (~X tokens × Yfreq), context mode (main|fork), key factor`143. **Branch to the matching guide** or give direct guidance1516```mermaid17graph TD18 A[Tool Request] --> AA{Plugin<br/>version/release?}19 AA -->|Yes| PLUGIN[✅ edit-plugin]20 AA -->|No| B{Deterministic<br/>shell only?}21 B -->|Yes| C{AI needed to<br/>decide when/how?}22 C -->|No| BASH[✅ Bash Script<br/>0 tokens]23 C -->|Yes| D{Token<br/>budget?}24 D -->|<500| WRAP[✅ Skill + scripts/]25 D -->|>500| SKILL_REF[✅ Skill + reference.md]2627 B -->|No| E{Pollution<br/>cost?}28 E -->|High >2000 tokens<br/>OR deep exploration| W{Multi-agent<br/>control flow?}29 W -->|Single reasoning pass| AGENT[✅ Sub-Agent]30 W -->|Loops/fan-out/<br/>verify-stages| WORKFLOW[✅ Workflow script<br/>+ optional skill wrapper]31 E -->|Medium 500-2000| F{Context<br/>mode?}32 F -->|Needs parent ctx + fan-out| FORK[✅ Skill context:fork<br/>NEW v2.1.117+]33 F -->|Needs isolation no bias| SUBAGENT[✅ Skill context:subagent]34 F -->|Needs main context| SKILL_BIG[✅ Skill + reference.md]3536 E -->|Low <500| G{Frequency?}37 G -->|1+ per session| SKILL[✅ Skill]38 G -->|Rare <1/10| DIRECT[❌ No tool needed]3940 style PLUGIN fill:#B2DFDB,stroke:#00897B,stroke-width:2px,color:#00041 style BASH fill:#90EE90,stroke:#000,stroke-width:2px,color:#00042 style SKILL fill:#FFD700,stroke:#000,stroke-width:2px,color:#00043 style WRAP fill:#FFA500,stroke:#000,stroke-width:2px,color:#00044 style SKILL_REF fill:#FFA500,stroke:#000,stroke-width:2px,color:#00045 style SKILL_BIG fill:#87CEEB,stroke:#000,stroke-width:2px,color:#00046 style FORK fill:#DDA0DD,stroke:#000,stroke-width:2px,color:#00047 style SUBAGENT fill:#CE93D8,stroke:#000,stroke-width:2px,color:#00048 style AGENT fill:#DDA0DD,stroke:#000,stroke-width:2px,color:#00049 style WORKFLOW fill:#9FA8DA,stroke:#000,stroke-width:2px,color:#00050 style DIRECT fill:#FFB6C1,stroke:#000,stroke-width:2px,color:#00051```5253**Workflow leaf**: when the task needs deterministic multi-agent orchestration — pipeline/parallel/fan-out with loops, judge panels, verify-stages, loop-until-dry — author a `Workflow` script (optionally a thin skill wrapper that invokes it), not a single sub-agent. A sub-agent is *one* spawn; a Workflow choreographs many under control flow.5455**Default**: All skills are dual-invocable (both `/name` and model auto-invoke). `disable-model-invocation: true` is opt-out for rare edge cases.5657**When the verdict is "skill" and correctness matters more than speed** → this skill gets you a well-architected *draft*. To know whether that draft actually beats baseline, hand off to Anthropic's official **`skill-creator`** skill, which owns the empirical loop `edit-tool` deliberately does not: draft → test on real prompts → eval with/without the skill → improve → repeat, plus a script that auto-optimizes the description for triggering. Reach for it when the skill is non-trivial, will run many times, or you can't eyeball whether it works. `edit-tool` decides *what to build and how to structure it*; `skill-creator` proves *that it works*.5859## Modifying Existing Tools60611. Locate and read existing file (SKILL.md or agent .md)622. **Enumerate functional outputs** — every behavior/capability = **preservation contract**633. Make **surgical edits** using Edit tool (not Write/overwrite)644. **Regression check**: verify each output from step 2 is retained655. Update description if changing triggers666. Validate: YAML valid, triggers clear, instructions actionable6768## Creating New Tools6970💡 **Before creating:** consider running `/search-skill` to discover existing solutions.71721. Ask for details if missing: purpose, triggers, tools needed732. Determine type via triage decision tree above743. Use `pick-model` skill for model **and effort** selection754. Branch to appropriate guide:7677| Type | Guide | Location |78|------|-------|----------|79| **Skill** | `references/skill-guide.md` | `skills/name/SKILL.md` |80| **Agent** | `references/agent-guide.md` | `.claude/agents/name.md` or plugin `agents/` |81| **Plugin** | `edit-plugin` skill | `plugin.json` + `marketplace.json` |82| **Bash** | Direct guidance (scripts/, chmod +x) | Project scripts dir |8384**Frontmatter:** Skill core = `name` (lowercase-hyphens) + `description` (triggers, max 1024) + `context` (`main`|`fork`|`subagent`) + `model`. Agent core = `name` + `description` + `tools`/`model`. Full field tables in the type guides above.8586## Sanity check before creating8788These aren't gates to satisfy — they're the failure modes that make a new tool a net negative. Each one, and what goes wrong if you ignore it:8990| Check | Why it matters — the failure it prevents |91|-------|------------------------------------------|92| **Pollution acceptable?** (skill: ~tokens × freq) | A skill's body loads on every trigger. Heavy + frequent = it crowds out the actual work every session, forever. |93| **SKILL.md fits ~500 tokens?** (overflow → reference.md) | Past that, the always-loaded cost outweighs the value; progressive disclosure keeps the hot path lean. |94| **One capability, not a workflow bundle?** (skill & agent) | Bundles violate single-responsibility — they under-trigger (description can't cover everything) and are impossible to eval. |95| **Needs multi-step reasoning with isolation?** (→ agent) | If yes, a skill in main context will either pollute or bias the reasoning; that's the signal to make it an agent. |9697If a skill trips the first three, it usually wants a different shape — `context:fork`/`subagent`, an agent, or just a direct request. Say which, and why, rather than forcing the skill.9899## Key Principles100101- **Preserve function**: an edit that silently drops a capability is a regression, not an improvement — enumerate outputs first, keep them unless the user asked to remove one102- **~500 tokens** ideal for SKILL.md; past that the always-loaded cost starts to outweigh the value — push detail into a reference file103- **Single responsibility**: one focused purpose per tool, so its description can actually describe it and it can be evaluated104- **Token-efficient**: tables, bullets, Mermaid over prose — the context window is a shared budget105- **Context-aware**: main when the tool needs conversation state, fork for parallel fan-out on a shared base, subagent/agent when isolation avoids pollution or bias106107## Fork vs Subagent & Proactive Audit108109- **Choosing `fork` vs `subagent`**, fork invocation rules, "keep subagent when ANY" criteria → `references/frameworks.md § Fork vs Subagent`.110- **On every create/edit, run the Proactive Audit** (frontmatter compliance + fit check, incl. legacy `context: fork` rename) → `references/frameworks.md § Proactive Audit`.111112## Parallelization113114| Operation | Guidance |115|-----------|----------|116| ✅ Read-only | Parallelize freely — no conflict possible |117| ⚠️ Writes (independent files) | Sequential, or Plan Mode first — concurrent writes race |118| ❌ Destructive / >3 files | Plan Mode first — the cost of a wrong parallel destructive op is unrecoverable |119120See `references/frameworks.md` for edge cases, conversion guide, and extended examples.