write-subagent
Skill0 starsChanged 14 days agoMITView on GitHub
Draft a Claude Code subagent file in .claude/agents/ for one repeatable job, with a trigger-ready description, minimal tools and a fitting model. Use to create, fix or tune a subagent.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- woossi/agent-project-templatetheir own version, first seen Jun 28, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- woossi/agent-project-template★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository12 other files it gives its agents.
- agents-md-auditSkill
- brag-doc-from-gitSkill
- dependency-upgradeSkill
- explain-codebaseSkill
- pr-descriptionSkill
- prove-it-ranSkill
- repro-first-debuggingSkill
- review-my-diffSkill
- safe-refactorSkill
- security-quick-reviewSkill
- session-handoffSkill
- write-agents-mdSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
When should Claude hand off to it?
- Very specific: line 21
Check .claude/agents/ and ~/.claude/agents/ first (both are scanned recursively).
- Distinctive: line 44
Keep it under about 40 lines:
- Very specific: line 56
If claude plugin validate is available, run it on the agents folder to catch parse errors.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Write a Claude Code subagent
Goal: one Markdown file with YAML frontmatter that Claude Code loads, delegates to at the right moments, and that can only touch what its job needs.
1. Pin down the job (ask if unclear)
- One job per subagent: "run tests and report failures", not "help with code".
- When should Claude hand off to it? Name the trigger in plain words.
- Does it only read, or must it edit, run commands or browse?
- Scope: this project (
.claude/agents/, commit it for the team) or every project for this user (~/.claude/agents/)? Project wins on a name clash.
Check .claude/agents/ and ~/.claude/agents/ first (both are scanned recursively). If a subagent with the same name exists, edit it instead of adding a second.
2. Write the frontmatter
---
name: test-runner
description: Runs the test suite and reports only failing tests with the relevant error lines. Use proactively whenever tests need to be run. Do not use for writing or fixing tests, or for lint and type checks.
tools: Bash, Read, Grep
model: haiku
---Rules:
name: lowercase with hyphens, unique. Identity comes from this field, not the filename. Never start it with-or put:in it.description(required): say what it does and when to use it. Add "Use proactively" only if Claude should delegate without being asked. End with a short "Do not use for ..." line naming the nearby jobs it should leave alone (often the work of a neighbouring subagent); it is the cheapest fix for a subagent that keeps grabbing the wrong tasks.- Tools, smallest set:
toolsis an allowlist. Read-only jobs getRead, Grep, Glob. AddBashonly for commands,Edit/Writeonly for jobs that change files,WebSearch, WebFetchonly for lookups. To keep everything except a few tools, usedisallowedToolsinstead. Omitting both means it inherits all tools, so do that only on purpose. model:haikufor fast, mechanical work (search, test runs, summaries),sonnetfor review and debugging,opusfor deep audits, orinheritto match the main session. Leave it out to use the default.- Field names are camelCase (
disallowedTools,maxTurns). A misspelled field is ignored silently, so copy names exactly.
3. Write the body (the subagent's system prompt)
Keep it under about 40 lines:
- One sentence on its role.
- Numbered steps it follows every time.
- What to return: a short, structured report (for example "failing test, file:line, one-line cause"), not a transcript. The main session only sees this report.
- Limits: what it must not do (edit files, push, delete, install packages) and when to stop and report instead of guessing.
The subagent does not see your conversation. Put any context it always needs in the body or in CLAUDE.md.
4. Check it loads
- Confirm the opening
---is the very first line and the YAML parses. - If
claude plugin validateis available, run it on the agents folder to catch parse errors; otherwise runclaude --debugand look for the subagent in the log. - In a new session, ask "which subagents are available?" and confirm it is listed. (On current Claude Code versions
/agentsonly prints a reminder to edit the files; it no longer lists them.) - Test it with an explicit ask ("use the test-runner subagent to ...") and then with a natural request that should trigger it. If it is never picked, make the
descriptionmore specific about when. If it is picked for the wrong jobs, add or sharpen the "Do not use for ..." line.
Show the user the file and the test result. Do not commit unless asked.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

