OmniscioGuidesSubagent examples
Claude Code subagent examples
The most common reason a subagent does not fire is not a syntax mistake. It is a description that reads like a job title instead of a moment, so Claude never recognises the moment it should delegate.
The five files on this site are written to be copied: each one is a complete agent, and each page says which field routes the work, which fields limit it, and what it costs when it runs. Change the commands to the ones your repository uses before you rely on any of them.
- What a subagent example is, and what it is not.
- The five files, and the job each one covers.
- Every field in the frontmatter, one at a time.
- Project file or user file, and which one wins.
- How to confirm Claude actually picked it up.
- The failures worth knowing before you write one.
Checked against Anthropic's Claude Code documentation on November 25, 2026. By the Omniscio team. Updated .
What a subagent example is
A subagent is a specialised assistant Claude delegates a side task to inside one session. It runs in its own context window with its own system prompt, its own tool access and its own permissions, and it returns a summary to the conversation that started it. The file that defines one is small: YAML frontmatter between two lines of three dashes, then the system prompt as Markdown.
The subagent receives that system prompt plus basic environment details such as the working directory, not the Claude Code system prompt. That is why an example can be short: everything the agent needs to know about its job has to be inside the file.
When a subagent is the right tool
Anthropic's own framing is a side task that would flood your main conversation with search results, logs or file contents you will not reference again. The subagent does that work in its own context and returns only the summary, so the flood never enters your conversation.
It is the wrong tool for a task that needs back-and-forth, and it is not a skill. A skill is a reusable procedure that runs in the main conversation, which is what you want when the instructions are the point rather than the isolation. For work that has to run in parallel or outlast one context window, Anthropic points at separate sessions rather than subagents.
Each subagent sends its own requests, and those count toward the same usage limits as your main conversation. An example file is therefore a decision about cost as well as structure: a smaller model and a narrow tool list are the two dials that keep it cheap.
The smallest file that works
Two fields, one sentence of instruction, and you have an agent. Save this as .claude/agents/explain.md in the project, or ~/.claude/agents/explain.md for every project, and it is yours for the rest of the session without a restart.
---
name: explain
description: Explains how a piece of code works, with no changes. Use when the question is how something works rather than how to change it.
tools: Read, Grep, Glob
---
Read the code you are asked about and explain it. Quote the lines you rely on.
Do not propose a change unless you are asked for one.There is no screen to create one on. You either write the file yourself, as above, or ask Claude to write it — and /agents is worth understanding before you go looking: it prints a reminder to ask Claude or edit the folders directly, and the wizard that older write-ups describe was Claude Code v2.1.197 and earlier.
The five files
The five jobs below are picked by one rule rather than by popularity: each is work whose output is long and whose answer is short, or work that needs a narrower tool set than the main conversation has.
- The code reviewer reads a diff and reports what is wrong, in priority order, without editing anything.
- The test runner runs the suite and returns only the failing tests and their error messages, so the full output stays out of your conversation.
- The debugger takes a failure whose cause is not yet known and works it back to a root cause before changing code.
- The security reviewer looks at changes to auth, input handling, paths and secrets with a tool set that cannot write.
- The docs writer updates the README and guide text when a command, flag or behaviour changes, in the repository's own voice.
Why these five, and not a longer list
Each one isolates a job that otherwise dumps a lot of text into the main conversation, or enforces a rule that matters more than speed. That is the test for adding a sixth: if the work returns a short answer and would have been fine inline, a subagent adds a model call and a context window and saves nothing.
There is also a hard budget behind the short list. Every subagent's name and description is loaded into context at the start of a session whether or not it is ever used, and past 15,000 tokens of descriptions, the built-in agents excepted, Claude Code warns you at startup. Five focused agents cost far less than twenty drifted ones.
Every field in these files
Only two fields are required. Every file on this site sets four — name, description, tools and model — and the security reviewer adds two more that are explained where they appear. Field names with more than one word are camelCase and must match Anthropic's table exactly, because Claude Code ignores a field it does not recognise without reporting an error.
name
The unique identifier, at most 256 characters, such as code-reviewer. The filename does not have to match, and the name cannot contain a colon, which is reserved for plugin-scoped names. Hooks receive this value as agent_type, which is why it should stay stable once it is in use.
description
When Claude should delegate to this subagent. Claude matches three things — the task in your request, this description and the current context — and the description is the only one of the three you write once and keep, so a description that names the moment works and one that names a personality does not. Anthropic suggests including a phrase such as "use proactively" when you want Claude to reach for it without being asked. The difference is easiest to see side by side:
# A role. Claude has no moment to match it against.
description: An expert in software quality and best practices.
# A moment. Claude can match this against what you just asked.
description: Reviews a diff for correctness and security. Use proactively after
code changes, before a commit or a pull request.tools
A comma-separated list or a YAML list of the tools the subagent may use. Omit it and the subagent inherits every tool available to subagents; set it and you have an allowlist. If no entry in the list resolves to a tool, Claude Code refuses to launch the subagent with an error naming the entries.
A short list is a real fence, with one trap: a reviewer denied Edit and Write can still change files through Bash. If the point is that an agent cannot write, drop Bash too.
model
One of the aliases sonnet, opus, haiku or fable — short aliases for the model families your account can use — a full model ID such as claude-opus-5-5, or inherit. Leave it out and Claude Code decides: first any model Claude passes for that one run, then CLAUDE_CODE_SUBAGENT_MODEL if it is set, and otherwise the model the main conversation is using.
The rest of the frontmatter
Anthropic's table also covers disallowedTools, permissionMode, maxTurns, skills, mcpServers, hooks, memory, effort, isolation and a few more. The five files here use disallowedTools and permissionMode where they earn their keep, and leave the rest alone: a field you cannot explain is a field you cannot debug.
Project file or user file
The location decides who can use the agent. A file in the project's .claude/agents/ is scoped to that repository and is usually committed, so the whole team gets it. A file in ~/.claude/agents/ is yours, in every project on the machine.
- Managed settings — organisation-wide, highest priority, deployed by an administrator.
--agentsflag — the current session only, passed as JSON when Claude Code starts..claude/agents/— the current project.~/.claude/agents/— all of your projects.- A plugin's
agents/directory — wherever that plugin is enabled, lowest priority.
Project agents are found by walking up from the working directory, so every .claude/agents/ between there and the repository root is scanned and the definition closest to the working directory wins. Both directories are scanned recursively, so subfolders such as agents/review/ work, but the folder does not change the agent's identity: two files in the same directory that declare the same name means only one of them loads, and /doctor reports the pair.
Confirm Claude picked it up
Claude Code watches ~/.claude/agents/ and .claude/agents/. A new or edited file is detected within a few seconds and the next delegation uses the new definition, with no restart. Two cases still need one: a directory added with --add-dir is not watched, and a session started with --disable-slash-commands watches neither directory.
/agentsprints a reminder to ask Claude to manage subagents, or to edit the two folders directly. On Claude Code v2.1.197 and earlier it opened a wizard with a Running tab that listed live subagents and a Library tab for creating, editing and deleting them, so older write-ups still describe it that way./taskslists the background work in the session, subagents included, and names the model each one runs on (Claude Code v2.1.242 or later).- The transcript shows a delegation as a tool call row with the subagent's name and a short task description, such as
code-reviewer(Review the auth changes). claude --debugwrites a log to~/.claude/debug/<session-id>.txtthat names up to five top-level fields in an agent file that Claude Code does not recognise (Claude Code v2.1.296 or later).
The fastest functional test needs no command at all: ask for the work by name. "Use the code-reviewer agent on my last commit" tells you in one turn whether the file loaded and whether the description routes.
The failures worth knowing
- The description budget. Every description loads at startup. Past 15,000 tokens combined, excluding built-ins, Claude Code shows a startup warning with the total and still loads everything. The fix is shorter descriptions with the detail moved into each system prompt.
- Zero tools. A
toolslist where nothing resolves — a typo such asGrpe, a tool subagents cannot use, or an MCP server that is not connected — is refused at launch rather than run blind. - The file is skipped. A
namethat starts with a hyphen, contains a colon or passes 256 characters, anamewith no description, or YAML that does not parse is skipped and the reason is written to the debug log. Two other cases are quieter still: with noname, or with an opening---that is not the file's first line, Claude Code treats the file as documentation kept beside your agents and never says so.claude plugin validate .claude/agentsreports the ones whose frontmatter does not parse. - Unknown fields are ignored. A misspelled
maxTurnsdoes nothing and says nothing, which is why the debug log is the place to look. - Plugin agents drop three fields.
hooks,mcpServersandpermissionModeare ignored when the agent comes from a plugin.
None of this is exotic. Anthropic's error reference has a page for the description limit and one for the zero-tools refusal, which is a fair signal of how often each one happens.
Writing your own from these
- Start from the example closest to the job, not from an empty file. Changing a working agent is cheaper than remembering the frontmatter.
- Rewrite the description as the sentence you would say out loud when you want the delegation. Then add "use proactively" if you want it without asking.
- Cut the tool list to what the job needs. If the agent reads and reports, there is no reason for it to write.
- Leave
modelout unless you have a reason.inheritis a reason; a guess is not. - Put it in the project if the team should get it, and in your user folder if it is how you personally work.
For the mechanics behind all of this — what a subagent inherits, what it costs, the nesting limit and the resume rules — the subagents guide is the page to read next. If what you actually want is a reusable procedure rather than an isolated worker, the skills guide covers the other mechanism.
How this page was written
Everything here about how subagents are defined, routed, loaded and limited was read from Anthropic's Claude Code subagent documentation and its error reference on November 25, 2026, and every factual sentence here was checked against the wording in the Sources below.
The five example files were written for this site. They follow Anthropic's documented frontmatter and tool rules, but they were not run against a live repository here, and this page does not claim they improve any particular repository's output. Change the commands before you use one.
Sources
- Anthropic's Create custom subagents, for the definition, the file format, the scope and priority table, the frontmatter reference, the model order, the file-watching rules and the example agents, read November 25, 2026.
- Anthropic's error reference, for the 15,000-token description warning and the zero-tools refusal, read November 25, 2026.
- Anthropic's commands reference, for what
/agentsand/tasksdo today, read November 25, 2026. - Google's autocomplete suggestions for "claude code subagent" and "claude code custom agent", read November 25, 2026, for the queries this page answers.
Common questions
Where do Claude Code subagent files go?
A file in .claude/agents/ belongs to the current project and is usually checked in, so your team gets it. A file in ~/.claude/agents/ works in all of your projects. When two definitions share a name, the higher-priority location wins: managed settings, then the --agents flag, then the project, then your user folder, then a plugin.
What is the minimum a subagent file needs?
A name and a description. Everything else is optional: with no tools field the subagent inherits every tool available to subagents, and with no model field it follows the model order. The Markdown body below the frontmatter is the system prompt.
Why is Claude not delegating to my subagent?
Almost always the description. Claude matches the task against it, so it has to name the moment in the words you would use, and "use proactively" is Anthropic's own suggestion for encouraging delegation. Asking for the agent by name is the quickest way to tell a routing problem from a loading problem.
What is the 15,000-token limit on subagent descriptions?
Claude Code loads every subagent's name and description at startup so Claude knows what it can delegate to. Past 15,000 tokens combined, excluding the built-in agents, it shows a warning with the total and loads everything anyway. Shorten the descriptions and move the detail into each system prompt, which is only paid for when that subagent runs.
Can a subagent edit my files?
Only if it has a tool that can. A tools list where nothing resolves makes Claude Code refuse to launch it. Watch the other direction too: a subagent denied Edit and Write can still change files through Bash.
Subagents inside a session. Sessions inside one window.
A subagent lives inside one Claude Code session. Omniscio is the level above: a desktop app for running Claude Code and other coding agents side by side, with one list of sessions and one inbox, so an agent only interrupts you when a decision needs you.
The features page lists what is in it today, pricing covers the plans, and you can download it for Windows, macOS or Linux.