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
- How to allow Claude Code to run all commands: permission modes, allow rules and skip permissions
- Claude Code permissions: allow, ask and deny rules, rule syntax and allowed tools
- Claude Code telemetry and data retention: what is sent and how to turn it off
- CLAUDE.md: where it goes, how it loads, and how it works with AGENTS.md
- Claude Code hooks: all events, exit codes, PreToolUse and PermissionRequest JSON, examples
- Add MCP servers to Claude Code (claude mcp add, .mcp.json, scopes)
- Claude Code custom slash commands and skills (SKILL.md)
- Claude Code settings.json: file locations, precedence, and key settings
- Claude Code plugins and marketplaces: install, create, and share
- Claude Code headless mode: claude -p, --output-format json, --bare and CI flags
- Claude Code statusline: custom status bar in settings.json with context %, cost and git branch
- Claude Code /model: switch models, aliases (opus, sonnet, haiku, opusplan), ANTHROPIC_MODEL and effort
- Claude Code /cost and /usage: check token spend, usage limits and reduce costs
- Claude Code VS Code extension: install, shortcuts, settings and /ide (works in Cursor too)
- MCP 2026-07-28 Migration Guide: Stateless Protocol, No Sessions, server/discover, MRTR, and SDK v2 Upgrade
- Subagents and Custom Agents Compared: Claude Code vs Codex vs Cursor vs Gemini CLI vs GitHub Copilot (2026)
- Allow all commands in any AI coding agent: Cursor, Claude Code, Codex, Gemini CLI, Copilot CLI and 7 more (2026)
- How to deploy a remote MCP server (Streamable HTTP): Cloudflare Workers, Vercel, Railway and more (2026)
- Claude Code sandbox: /sandbox, sandbox.enabled, allowedDomains, excludedCommands and strict mode
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 →