Working with subagents in the Claude Code SDK
research-assistant
subagent can explore dozens of files and documentation pages without cluttering the main conversation with all the intermediate search results - only returning the relevant findings.
style-checker
, security-scanner
, and test-coverage
subagents simultaneously, reducing review time from minutes to seconds.
database-migration
subagent can have detailed knowledge about SQL best practices, rollback strategies, and data integrity checks that would be unnecessary noise in the main agent’s instructions.
doc-reviewer
subagent might only have access to Read and Grep tools, ensuring it can analyze but never accidentally modify your documentation files.
.claude/agents/*.md
- Available only in the current project~/.claude/agents/*.md
- Available across all projectsField | Required | Description |
---|---|---|
name | Yes | Unique identifier using lowercase letters and hyphens |
description | Yes | Natural language description of when to use this subagent |
tools | No | Comma-separated list of allowed tools. If omitted, inherits all tools |
.claude/agents/
directoriesdescription
field clearly indicates when it should be used:
tools
field: