How to set up Claude Code subagents (with 4 copy-paste examples)

Published Oct 15, 2026 · 5 min read

Subagents are the most underused feature in Claude Code. A subagent is a specialist with its own system prompt, its own tool permissions and its own context window. Your main conversation stays clean while the specialist digs through files.

1. Where subagent files live

You can also create one interactively with the /agents command.

2. The file format

---
name: code-reviewer
description: Use proactively after code changes. Reviews the git diff for bugs and missing tests.
tools: Read, Grep, Glob, Bash
model: inherit
---
You are a strict but practical code reviewer. ...

3. Four subagents worth having

  1. planner (Read, Grep, Glob): produces a numbered plan, writes no code.
  2. code-reviewer (read-only plus Bash for git diff): ends with APPROVE or CHANGES REQUESTED.
  3. test-writer: writes tests, runs them, and never weakens an assertion to make one pass.
  4. debugger: reproduce, hypothesize, verify, then fix the root cause.

4. Make Claude actually use them

Put the workflow in CLAUDE.md ("for multi-file changes, use the planner subagent first"), or chain them in a skill such as /ship-feature. You can also ask explicitly: "use the code-reviewer subagent on my diff."

5. Common mistakes

Want all four pre-built, plus skills, safety hooks and CLAUDE.md templates? Get the Claude Code Agent Starter Kit.

Source: the official subagents documentation at code.claude.com/docs/en/sub-agents.

FAQ

Where do Claude Code subagent files go?

Project subagents live in .claude/agents/<name>.md and are shared through git. Personal subagents live in ~/.claude/agents/ and are available in every project. You can also create and edit them interactively with the /agents command.

What frontmatter does a subagent need?

At minimum a name and a description. The description tells Claude when to delegate to the agent. Optional fields include tools (an allowlist such as Read, Grep, Glob) and model.

How do I make a subagent read-only?

Set tools to read-only tools only, for example tools: Read, Grep, Glob. Without Edit, Write or Bash the agent can inspect code and report problems but cannot change files.

What is the difference between a subagent and a skill?

A subagent is a separate role with its own context window and tool list. A skill is a reusable set of instructions that loads into the current conversation when needed. Skills can delegate work to subagents.

The VibeKit Dispatch

One tested Claude Code / Cursor workflow every week. No hype, unsubscribe anytime.