Skip to content
AgentAtlas

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 Claude Code guides

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

Built an MCP server? Get it listed everywhere →

Shipping an Android app? Google Play needs 12 testers for 14 days first. Get them with Tester Exchange →