Why Claude Code Is Not Using Your Subagent (Fixes)
Claude Code ignores a subagent for one of three reasons: the file never loaded, a different subagent with the same name took priority, or the description does not tell Claude when to delegate. Check them in that order. The checklist below takes about five minutes.
This guide is part of our Claude Code subagents guide. If you have not written a subagent yet, start with how to create a custom subagent.
How Claude Code decides to use a subagent
Claude Code delegates on its own, based on three inputs. The official docs say it uses "the task description in your request, the description field in subagent configurations, and current context."
That means two things:
- A subagent that did not load cannot be chosen at all.
- A subagent that loaded is only chosen when its
descriptionmatches the task in front of Claude.
Most "not using my subagent" problems are one of these two. The checklist separates them.
The troubleshooting checklist
Work through the steps in order. Stop when your subagent starts running.
- Confirm the file is in the right folder
- Check the frontmatter
- Look for a name conflict
- Check for restart cases
- Test with an explicit call
- Rewrite the description
- Check tools and permissions
- Confirm that it ran
1. Confirm the file is in the right folder
Subagents are Markdown files with YAML frontmatter. Claude Code reads them from these places:
| Priority | Location | Scope |
|---|---|---|
| 1 (highest) | Managed settings | Organization-wide |
| 2 | --agents CLI flag (JSON) | Current session |
| 3 | .claude/agents/ | Current project |
| 4 | ~/.claude/agents/ | All your projects |
| 5 (lowest) | Plugin agents/ directory | Where the plugin is enabled |
Check these points:
- The file ends in
.md. - It sits directly in
.claude/agents/or~/.claude/agents/. Both folders are scanned recursively, so subfolders also work. - You opened Claude Code in the project that holds the
.claude/agents/folder. A project agent is not visible from an unrelated project. - On Windows,
~is your user folder, for exampleC:\Users\<you>\.claude\agents\.
2. Check the frontmatter
Only name and description are required. Claude Code skips a file in an agents directory when:
- There is no
name. It treats the file as documentation kept beside your agents. - The opening
---is not the first line of the file. It reads the file as having no frontmatter. - The
namestarts with-, contains:, or is longer than 256 characters. - There is a
namebut nodescription. - The YAML does not parse. Claude Code reads no fields from the file.
A working minimal file looks like this:
---
name: code-reviewer
description: Reviews code for quality and best practices. Use proactively after code changes.
tools: Read, Glob, Grep
model: sonnet
---
You are a code reviewer. When invoked, analyze the code and provide
specific, actionable feedback on quality, security, and best practices.
To see why a file was skipped, start Claude Code with claude --debug. The reason is written to the debug log. To find files whose YAML does not parse, run claude plugin validate .claude/agents (or ~/.claude/agents). Note that this check does not flag a file that parses but has no name.
Also watch for misspelled optional fields. Claude Code "ignores a field it doesn't recognize without reporting an error." Field names such as maxTurns and disallowedTools are camelCase and must match exactly. In the debug log at ~/.claude/debug/<session-id>.txt, search for does not recognize or apply. This check needs Claude Code v2.1.296 or later.
3. Look for a name conflict
When several subagents share a name, "Claude Code uses the one from the higher-priority location." A leftover copy in .claude/agents/ hides the newer one in ~/.claude/agents/.
If two files in the same directory declare the same name, Claude Code loads only one of them. The /doctor checkup reports files in one directory that share a name and suggests renaming or removing all but one.
Keep name values unique across all subfolders. The filename does not need to match the name, but matching them makes conflicts easy to spot.
4. Check for restart cases
Claude Code watches ~/.claude/agents/ and .claude/agents/. A new or edited file is detected within a few seconds, with no restart.
You still need to restart in two cases:
- The agents sit in
.claude/agents/inside a directory added with--add-diror/add-dir. - The session was started with
--disable-slash-commands.
The official quickstart also says: "If Claude can't find the new subagent, restart Claude Code and try again." When in doubt, restart once and retest.
5. Test with an explicit call
Rule out the description by calling the subagent directly. Any of these works:
- Natural language:
Use the code-reviewer subagent to check my last commit - @-mention:
@agent-code-reviewer look at the auth changes - Whole session:
claude --agent code-reviewer, or set"agent": "code-reviewer"in.claude/settings.json. The CLI flag wins if both are set.
If the explicit call works, the file is fine and the problem is the description (step 6). If it does not work, go back to steps 1 to 4.
With --agent, the subagent's system prompt replaces the default Claude Code system prompt entirely. Use it to test, not as a fix for delegation.
6. Rewrite the description
The description is the routing rule. Claude reads it to decide when to hand work over. Compare:
| Weak | Strong |
|---|---|
Helps with code | Expert code review specialist. Proactively reviews code for quality, security, and maintainability. Use immediately after writing or modifying code. |
Testing agent | Runs the test suite and fixes failing tests. Use when tests fail or after changing code that has tests. |
Rules that work:
- Say what the agent does and when to use it.
- Include a phrase like "use proactively". The docs recommend it to encourage proactive delegation.
- Make each description single out one subagent. If two agents claim the same task, Claude has no reason to prefer yours.
- Keep descriptions short. Claude Code shows a startup warning when the combined descriptions of your non-built-in subagents pass 15,000 tokens, and it still loads every subagent. Move detail into the system prompt, which loads only when the subagent runs.
For more wording patterns, read best practices for subagent descriptions and system prompts.
7. Check tools and permissions
A subagent can load, run, and still look broken because it lacks a tool.
- If you set
tools, it is an allowlist. Anything not listed is unavailable. If you omit it, the subagent inherits the tools available to subagents. - If you set both
toolsanddisallowedTools,disallowedToolsis applied first. A tool listed in both is removed. - Some tools are removed from every subagent even when listed in
tools:Agent,AskUserQuestion,EnterPlanMode,ExitPlanMode,ScheduleWakeup,Workflowand a few others. - Subagents started from the main conversation run in the background by default (except
web-fetch). Background subagents get a smaller built-in tool set, and Claude Code removes most other built-in tools without an error.
Your own settings can also block delegation. If permissions.deny contains Agent(your-agent-name), or the bare Agent tool, Claude cannot start it. Look for those entries in .claude/settings.json and ~/.claude/settings.json.
See subagent tool permissions and model selection for the full rules.
8. Confirm that it ran
In the transcript, a delegation shows as a tool-call row with the subagent name and a short task description, such as code-improver(Suggest code improvements). You can also run /tasks to see running subagents. On v2.1.242 or later, the row names the model.
If you want a live view across sessions, Agent Office shows each handoff on a map: who called which agent, on which project, and how long it took. It reads tool names, task titles, status and token counts from your local session transcripts, not message text. The setup guide covers the install. This is optional, and the transcript alone is enough to confirm a run.
Quick diagnosis table
| Symptom | Likely cause | Fix |
|---|---|---|
| Explicit call fails: agent not found | File skipped or in the wrong folder | Steps 1, 2 and 4 |
| Another agent's behaviour appears | Same name, higher priority location | Step 3 |
| Explicit call works, automatic never fires | Vague or overlapping description | Step 6 |
| Agent runs but cannot edit or run commands | tools allowlist too narrow, or background tool limits | Step 7 |
| Agent runs on an unexpected model | Model resolution order | See the model article linked in step 7 |
| Claude never delegates anything | Agent denied in settings | Step 7 |
Prevent the problem next time
- Write the description first, then the system prompt.
- Name agents by role (
security-reviewer, notagent2). - Commit
.claude/agents/to git so the team shares one tested set. - After creating an agent, test it once by name and once with a natural request that should trigger it.
Sources
Claude and Claude Code are trademarks of Anthropic. Claud Agency is an independent tool by ECOMHUTSY and is not affiliated with Anthropic.
FAQ
Why is Claude Code ignoring my subagent?
Usually one of three things: the file was skipped at load time (no name, no description or broken YAML), another subagent with the same name wins, or the description is too vague for Claude to choose it. Run the checklist in this article from top to bottom.
Do I need to restart Claude Code after adding a subagent?
Usually not. Claude Code watches ~/.claude/agents/ and .claude/agents/ and picks up changes within a few seconds. You do need a restart for .claude/agents/ inside a directory added with --add-dir, and for sessions started with --disable-slash-commands.
How do I force Claude Code to use a specific subagent?
Ask for it by name ("Use the code-reviewer subagent on this diff"), @-mention it as @agent-code-reviewer, or run the whole session as that agent with claude --agent code-reviewer.
Does the file name have to match the agent name?
No. The name field in the frontmatter is what counts, and the filename does not need to match it. Keep names unique, because two files with the same name collide.
Does a project subagent override a user subagent?
Yes. When two subagents share a name, Claude Code uses the one from the higher-priority location. A project agent in .claude/agents/ beats a user agent in ~/.claude/agents/. The --agents flag and managed settings rank above both.
How can I tell whether a subagent actually ran?
In the Claude Code transcript, a delegation appears as a tool-call row with the subagent name and a short task description. You can also run /tasks to see running subagents and their model. Agent Office shows the same handoffs on a live map.
Can a misspelled field stop a subagent from working?
A misspelled optional field is silently ignored, so tools or model may not apply. Field names are camelCase and must match exactly. Run claude --debug and search the debug log for "does not recognize or apply" to find them.
Frequently asked questions
Why is Claude Code ignoring my subagent?
Usually one of three things: the file was skipped at load time (no name, no description or broken YAML), another subagent with the same name wins, or the description is too vague for Claude to choose it. Run the checklist in this article from top to bottom.
Do I need to restart Claude Code after adding a subagent?
Usually not. Claude Code watches ~/.claude/agents/ and .claude/agents/ and picks up changes within a few seconds. You do need a restart for .claude/agents/ inside a directory added with --add-dir, and for sessions started with --disable-slash-commands.
How do I force Claude Code to use a specific subagent?
Ask for it by name ("Use the code-reviewer subagent on this diff"), @-mention it as @agent-code-reviewer, or run the whole session as that agent with claude --agent code-reviewer.
Does the file name have to match the agent name?
No. The name field in the frontmatter is what counts, and the filename does not need to match it. Keep names unique, because two files with the same name collide.
Does a project subagent override a user subagent?
Yes. When two subagents share a name, Claude Code uses the one from the higher-priority location. A project agent in .claude/agents/ beats a user agent in ~/.claude/agents/. The --agents flag and managed settings rank above both.
How can I tell whether a subagent actually ran?
In the Claude Code transcript, a delegation appears as a tool-call row with the subagent name and a short task description. You can also run /tasks to see running subagents and their model. Agent Office shows the same handoffs on a live map.
Can a misspelled field stop a subagent from working?
A misspelled optional field is silently ignored, so tools or model may not apply. Field names are camelCase and must match exactly. Run claude --debug and search the debug log for "does not recognize or apply" to find them.