Claude Code Subagents — 113 Specialist Configs | AI Code Toolkit
113 tested subagents · 9 categories · Isolated context windows

Claude Code Subagents

Specialized Claude configurations for every stack. Security reviewers, framework experts, DBAs, DevOps engineers, and 100+ more — each with its own system prompt, restricted tools, and separate context window.

113
Subagents
9
Categories
Own
Context Window
48h
Update SLA

What are Claude Code subagents?

Subagents are specialized Claude configurations that live as Markdown files in your project. Each one has its own system prompt, its own restricted tool set, and — crucially — its own separate context window. When Claude Code needs to do specialized work (security review, database migration, framework-specific refactor), it can either be told to use a specific subagent or it can automatically route work to one whose description matches the task.

Think of subagents as spawning a purpose-built specialist. Your main Claude Code conversation delegates a chunk of work to a subagent, the subagent does the work in isolation, and only the result comes back — not the intermediate context. This keeps your main context window clean and lets each specialist have exactly the system prompt it needs.

The one-line version: A subagent is a Markdown file at .claude/agents/<name>.md (project) or ~/.claude/agents/<name>.md (user) that defines a specialized Claude with its own system prompt, tool restrictions, and context window.

Anatomy of a subagent

Every subagent is a single Markdown file with YAML frontmatter and a system-prompt body:

markdown .claude/agents/security-reviewer.md
--- name: security-reviewer description: Reviews code for security vulnerabilities. Use PROACTIVELY after any code change touching auth, input handling, or database queries. tools: Read, Grep, Glob, Bash(git diff:*), Bash(git log:*) model: opus --- You are a senior application security engineer specializing in web application vulnerabilities and secure coding practices. ## Your review checklist When reviewing code, systematically check for: - Authentication & session — bypass, weak comparisons, session fixation - Injection — SQL, NoSQL, command, LDAP, XPath - XSS — reflected, stored, DOM-based, escape context - CSRF — missing tokens, weak SameSite cookies - Access control — IDOR, missing authz checks, path traversal - Secrets — hardcoded credentials, insecure random, weak crypto - Dependencies — known CVEs, unmaintained packages ## Output format For each issue, return a Markdown table with columns: | Severity | File:Line | Issue | Exploitability | Fix | Then a summary section with a "Ship / Don't Ship" verdict and rationale.

Three things worth calling out:

  1. The description is critical. When you type > use the security-reviewer agent… Claude Code looks for a subagent whose description matches. Include trigger keywords like "Use PROACTIVELY" to encourage automatic routing.
  2. tools is a hard boundary. This subagent literally cannot write files, run git push, or do anything outside its allowed list. That's the security guarantee — a reviewer role that can't accidentally modify code.
  3. The body is the system prompt. Everything after the frontmatter becomes the subagent's system prompt. Be specific about role, checklist, and output format.

Frontmatter fields you'll actually use

  • name — unique identifier used when explicitly invoking the agent. Kebab-case.
  • description — when the agent should be used. Write this from Claude's perspective: "Use when X". Add PROACTIVELY to encourage auto-invocation.
  • tools — comma-separated list of allowed tool patterns. Narrow is safer.
  • modelhaiku, sonnet, or opus. Match model to task complexity to control cost.

Why subagents change how you use Claude Code

  • Context isolation. A subagent's work — reading 40 files, running 20 tool calls, iterating on a diff — happens in its own window. Only the final result returns to your main conversation. Your main context stays lean.
  • Specialized system prompts. Every subagent is essentially a mini-Claude with a domain expert's brief. A next-js-15 agent knows App Router patterns cold. A postgres-dba agent thinks in indexes and query plans.
  • Tool-level guardrails. Give your test-writer agent write access only to tests/**. Give your code-reviewer read-only access. Enforce these boundaries at the config layer, not in the prompt.
  • Cost matching. Route cheap tasks (formatting, renaming) to Haiku subagents. Reserve Opus for architecture, security, and complex refactors. Each subagent picks its own model.
  • Automatic delegation. If descriptions are well-written, Claude routes to the right subagent without being told. This is where PROACTIVELY and specific trigger phrasing pay off.
  • Team standardization. Commit .claude/agents/ to git. Every dev gets your team's security reviewer, your team's test writer, your team's DBA — with the same standards baked in.

Subagents vs slash commands vs hooks — the decision framework

All three shape Claude Code behavior. Here's how to pick:

  • Subagent when you need a specialized role with its own context: security reviewer, framework expert, DB migration specialist. Runs on demand or via auto-routing.
  • Slash command when you need a repeatable prompt template: /commit, /review, /deploy. Runs in the main conversation, expands to a prompt.
  • Hook when you need automatic enforcement at lifecycle events: block git push --force, auto-format on save, log every tool call. Runs without being invoked. See our hooks hub.

Real projects use all three. A /security-review slash command delegates to a security-reviewer subagent, whose file writes are further gated by a PreToolUse hook.

Browse by Category

9 categories, every serious specialty covered

From code reviewers to framework experts, from DBAs to prompt engineers. Each sub-category page has the complete listing with real YAML configs and usage notes.

🔍 Code Review Specialists 12

Purpose-built reviewers for security, performance, accessibility, and language-specific concerns.

  • security-reviewer
  • performance-reviewer
  • typescript-reviewer
  • python-reviewer
  • a11y-reviewer
Browse all 12 →
🧪 Testing Agents 9

Framework-aware test writers: Jest, Vitest, Playwright, Cypress, Pytest, RSpec, and more.

  • unit-test-writer
  • e2e-test-writer
  • playwright-agent
  • pytest-agent
  • test-coverage-analyst
Browse all 9 →
⚛️ Framework Specialists 14

Deep experts in specific frameworks: Next.js, Remix, Django, FastAPI, Rails, Spring, NestJS.

  • nextjs-15-expert
  • remix-expert
  • django-expert
  • fastapi-expert
  • rails-expert
Browse all 14 →
☁️ DevOps Agents 12

Docker, Kubernetes, Terraform, cloud provider specialists (AWS, GCP, Azure), CI/CD experts.

  • docker-agent
  • k8s-agent
  • terraform-agent
  • aws-agent
  • github-actions-agent
Browse all 12 →
🗄️ Database Agents 13

Postgres, MySQL, MongoDB, Redis specialists. Schema, migrations, query tuning, indexing.

  • postgres-dba
  • mysql-dba
  • mongodb-agent
  • redis-agent
  • prisma-agent
Browse all 13 →
🤖 AI / ML Agents 10

RAG builders, prompt engineers, embedding specialists, evaluation harness designers.

  • rag-architect
  • prompt-engineer
  • embedding-specialist
  • llm-evaluator
  • fine-tuning-agent
Browse all 10 →
🎨 Frontend Specialists 8

Tailwind, shadcn/ui, Radix, Framer Motion, Three.js, D3.js, charting library experts.

  • tailwind-designer
  • shadcn-composer
  • framer-motion-agent
  • threejs-agent
  • d3-agent
Browse all 8 →
⚙️ Backend, Ops & Business 30

Auth, payments, email, webhooks, queues, search, analytics, feature flags, A/B testing, and more.

  • auth-agent
  • stripe-agent
  • webhook-designer
  • queue-architect
  • search-agent
Browse all 30 →
📚 Documentation Agents 5

API reference writers, tutorial authors, ADR authors, changelog and migration-guide specialists.

  • api-doc-writer
  • tutorial-author
  • adr-author
  • changelog-writer
  • migration-guide-writer
Browse all 5 →
How to Use

How to build your own subagent in 5 steps

From an idea to a working, auto-routing, team-shared subagent.

1

Choose the file location

Subagents live in one of two places:

  • .claude/agents/<name>.mdproject-scoped. Commit to git so your team gets it.
  • ~/.claude/agents/<name>.mduser-scoped. Personal, across all projects.

Team standards belong in project scope. Personal preferences belong in user scope.

2

Write a routing-friendly description

The description field is how Claude routes work to the subagent. Write it from Claude's perspective: "Reviews code for security vulnerabilities. Use PROACTIVELY after auth changes." The word PROACTIVELY encourages automatic invocation. Include the trigger keywords a real user would type.

3

Restrict the tools

Set tools to the minimum needed. A reviewer needs Read, Grep, Glob — not Write. A test writer needs Write, but only for the tests directory. Narrow tools = safer subagents.

4

Write the system prompt

The body of the file becomes the subagent's system prompt. Be specific about role, checklist, and output format. Use headers, bullets, and examples. The clearer the prompt, the more consistent the subagent's output.

5

Invoke and iterate

Invoke explicitly with > use the security-reviewer agent to check the auth changes, or let Claude route automatically when the description matches. Iterate on the system prompt as you find edge cases — subagents are just Markdown files.

🐛 Hit an error while using subagents?

Our sister site AI Error Hub covers Claude Code errors, MCP connection failures, and stack traces — cross-referenced with everything on this site.

Visit AI Error Hub →
FAQ

Frequently asked questions

The questions developers ask most about subagents.

A Claude Code subagent is a Markdown file (with YAML frontmatter) at .claude/agents/<name>.md that defines a specialized Claude with its own system prompt, restricted tool set, and separate context window. Invoke it explicitly (> use the security-reviewer agent) or let Claude route work to it automatically when its description matches the task.

Every subagent gets a fresh, isolated context window. When you delegate work, the subagent does its reading, tool calls, and reasoning in its own window, then returns only the final result to your main conversation.

This keeps your main context lean and means a long specialized workflow (reading 40 files, running 20 tool calls) doesn't burn through your main window's tokens. It's the closest thing Claude Code has to spawning a specialist process.

Write a clear, trigger-word-rich description. Include the phrase Use PROACTIVELY and specific keywords describing when the agent should be used.

Example: "Reviews code for security vulnerabilities. Use PROACTIVELY after any change touching auth, input handling, or database queries."

Claude Code reads all subagent descriptions on session start and matches them to your prompts. Vague descriptions = no auto-routing.

Yes. A subagent can invoke another subagent the same way your main conversation can. This lets you compose specialized workflows — for example, an architect agent that delegates to a security-reviewer for the security portion of a design review.

Be mindful of cost: each nested agent uses its own tokens. Nesting more than 2-3 levels rarely pays off.

The minimum required. Examples:

  • Code reviewerRead, Grep, Glob. Not Write.
  • Test writerWrite, but scoped: Write(tests/**).
  • Migration agentBash(pnpm prisma migrate:*), not full Bash.

Narrow tools are the primary security guarantee that team-shared subagents behave safely.

Rule of thumb:

  • Slash command for a repeatable prompt template that runs in your main conversation. Quick to write, easy to compose.
  • Subagent for a specialized role that needs its own context window, system prompt, and tool restrictions.

Simple test: if you'd write more than 50 lines of system prompt, want context isolation, or need strict tool boundaries — use a subagent. Otherwise, a slash command is enough.

Yes. Add model: haiku, model: sonnet, or model: opus to the frontmatter.

This is huge for cost control:

  • Route formatting and renaming agents to Haiku.
  • Use Sonnet as the default.
  • Reserve Opus for security reviewers, architects, and complex refactor agents.

Cost per project can drop 30-50% with disciplined per-agent model routing. See our cost guides for real numbers.

Hooks fire on tool-use events regardless of who invoked the tool. When a subagent calls a tool, the same PreToolUse and PostToolUse hooks fire as if your main conversation had called it.

Result: security gates, cost trackers, and auto-formatters apply uniformly across subagents and the main conversation. See our hooks hub for the full lifecycle.

Commit .claude/agents/ to git. That's it.

When teammates pull, they get every subagent immediately — no install step, no plugin, no config file to update. This is exactly the same workflow as slash commands and is the standard for team-wide Claude Code standardization.

For most projects, five agents cover 80% of the value:

  1. A code reviewer (general or security-focused).
  2. A test writer matched to your test framework.
  3. A framework specialist for your main stack (Next.js, Django, etc.).
  4. A DB agent for your database (Postgres, MongoDB).
  5. A docs writer for API references.

Add specialists as you find yourself repeating the same specialized prompts. Browse the 40 most-used agents on this page for ideas.

Share with