Subagent file structure

A subagent is a single Markdown file with a YAML header at the top, setting its name, description, tools and model before any code runs. This guide works through every field in that header, where the file needs to sit, and what else the configuration should carry.

Browse all guides

The two fields every subagent file needs

A subagent file needs only two fields before it works: a name and a description. Nothing else in the frontmatter is required for Claude Code to read the file and treat it as a subagent.

  • name: the identifier the orchestrator uses when it hands a task to this subagent.
  • description: the sentence that says what the subagent is for, so the orchestrator and anyone reading the file later know when to call it.

You can write these two fields yourself, or ask Claude to draft the file for you from a plain description of the role you want it to play. Either way, the frontmatter can hold more than name and description, but adding more is a choice, not a requirement.

Project subagents compared with user subagents

The difference between a project subagent and a user subagent comes down to where the file sits, not what it can do.

Subagent type Available in File location
Project subagentSuits subagents for one codebase That one project only .claude/agents/ inside the project folder
User subagentPersonal subagents for every project Every project on that machine ~/.claude/agents/ in your home folder

Source: the Claude Code documentation on subagents, code.claude.com/docs/en/sub-agents, read on 2 November 2026.

Disclosing AI to people outside your team

A subagent that only ever receives work from another agent does not need to announce what it is. The moment a person outside your team ends up reading its output or talking to it directly, that changes.

Anthropic's Usage Policy requires that anyone talking with an agent is told they are talking with AI. For a subagent you are building for Claude or Claude Code, that disclosure has to be part of the configuration you export.

Where the line belongs

The disclosure sits in the instructions you write into the subagent's file, alongside its description and its tool list, so it travels with the role. If a subagent can end up facing someone outside your team at any point in the handoff order, that instruction needs to be there before export.

Who decides the wording

The requirement is that the disclosure happens. You choose the wording that fits the role and the channel the subagent is answering through, and that choice stays yours at every handoff in the chain.