Kavvo Agents

Claude Code Subagents

November 29, 2026 · 4 min read · By the Kavvo Agents team

What it is

Claude Code subagents are specialised assistants that work inside Claude Code, Anthropic’s command-line coding tool. When the main Claude Code session meets a focused job — reviewing a set of changes, exploring a codebase, researching a library — it can hand that job to a subagent. The subagent works in its own separate context window, with its own instructions and its own tool permissions, and then returns only a summary to the main conversation. The main session stays clean and uncluttered, which matters on long coding tasks where context fills up fast.

A subagent is not a separate product you buy. It is a feature of Claude Code itself. You define one as a Markdown file with a small block of frontmatter at the top: a name, a description of when it should be used, an optional list of allowed tools, and an optional model choice. Claude Code ships with built-in subagents too, including Explore, a fast read-only agent for searching a codebase, Plan, a read-only research agent used in plan mode, and a general-purpose subagent for multi-step tasks.

Who made it

Claude Code subagents are made by Anthropic, the company behind Claude. The official documentation lives at code.claude.com.

What it does

A subagent takes a delegated task and runs it to completion on its own. Typical uses are code review after a change, exploring an unfamiliar part of a codebase, researching how a library works, running a test suite and reporting failures, or summarising a large set of files. Because each subagent has its own context, several can run in parallel — Anthropic’s documentation notes a default limit of 20 concurrent subagents per session — without crowding the main conversation.

A good description names the exact situation, for example “Use after code changes to review for security risks and missing tests. Do not use for implementation.”

How it works

You create a subagent in one of two places: .claude/agents/ inside a project, where the whole team can share it, or ~/.claude/agents/ in your home folder, where it follows you across projects. The file starts with frontmatter between two --- lines, then the system prompt as the body. The name and description fields are required. The tools field is optional and restricts what the subagent may do — a read-only reviewer might get only Read, Grep, Glob and LS. The model field is optional and accepts values such as sonnet, haiku, opus or inherit, which uses the main conversation’s model.

When a task matches, Claude invokes the subagent automatically, or you can mention it by name in your prompt to guarantee it is used. The subagent inherits some things from the main session and not others; the official docs have a table of exactly what carries over, so check the official docs before assuming a subagent can see your files, your conversation history, or your tools.

How to start

  1. Install Claude Code and open a project in your terminal.
  2. Create the folder .claude/agents/ in the project, or ~/.claude/agents/ for a personal subagent.
  3. Add a Markdown file, for example code-reviewer.md, starting with frontmatter: name, description, and optionally tools and model.
  4. Write the system prompt below the frontmatter: the role, the rules, and what a good result looks like.
  5. In Claude Code, ask for a code review or a research task and watch whether your subagent is picked. If it is not, sharpen the description.
  6. Start with a read-only subagent. Give it search and read tools only, and widen its permissions only after its output is consistently right.

Who it is for

Claude Code subagents are for developers who already use Claude Code and want to split coding work into reliable, repeatable pieces. They suit teams that want a shared code reviewer or researcher that behaves the same way every time, and solo developers who want long tasks broken into parallel chunks without losing the main thread.

Watch out for

Subagents are not free: each one consumes model usage in its own context, so heavy parallel use adds up. A badly written description causes misfires, with the wrong subagent picked or a good one ignored. Subagents return summaries, not full transcripts, so detail can be lost if the summary is thin. The feature changes often — spawn limits, nesting rules and built-in agents have all moved between recent versions — so check the official docs for the version you run. And a subagent is only as safe as its tool list: one with write and shell access can change files, so keep dangerous tools off by default.

Source

Official documentation: Claude Code subagents — Anthropic