Claude Code

Claude Code subagents: create one, limit its tools, and call it

How do I create a subagent in Claude Code?

Create a Markdown file in .claude/agents/ (project) or ~/.claude/agents/ (all projects) with YAML frontmatter: name and description are required; tools, model and permissionMode are optional. Claude delegates to it when the description matches, or you can ask for it by name or @-mention it.

A minimal subagent

.claude/agents/code-reviewer.md

---
name: code-reviewer
description: Reviews code for quality and best practices. Use after writing or modifying code.
tools: Read, Glob, Grep
model: sonnet
---

You are a code reviewer. Analyze the changed code and give specific,
actionable feedback on correctness, security and readability.

Useful frontmatter fields

  • tools / disallowedTools: allow or remove tools; omit tools to inherit everything.
  • model: sonnet, opus, haiku, a full model ID, or inherit.
  • permissionMode: default, acceptEdits, auto, dontAsk, bypassPermissions or plan.
  • isolation: worktree to run in its own git worktree.
  • skills and mcpServers: preload skills or give it specific MCP servers.

Calling it

  • In plain language: "Use the code-reviewer subagent on the auth changes."
  • Guaranteed: @-mention it, for example @"code-reviewer (agent)".
  • For a whole session: claude --agent code-reviewer.
  • Project subagents in .claude/agents/ can be committed so the team shares them.

Sources

More on Claude Code

Other guides

Get the weekly agent stack update

New official MCP servers, spec changes and harness releases, checked against the source. One email a week, no fluff.

Reviewed Oct 6, 2026. Settings change often; the linked vendor docs are the source of truth.