Benefits
→
Context isolation: each subagent has its own context, preventing overload
→
Parallel execution: run multiple analyses simultaneously
→
Specialized prompts: each agent has tailored expertise
→
Tool restrictions: limit each agent to specific tools
Claude Code includes a built-in Explore agent optimized for understanding codebases. It automatically reads files, traces imports, and builds a mental model of your project.
> "Analyze this codebase and explain the architecture"
Claude spawns Explore agent → reads structure → reports back
Main Agent Orchestrates Subagents
┌─────────────────────┐
│ Main Agent │
│ (orchestrator) │
└──────────┬──────────┘
│
┌───────────┼───────────┐
▼ ▼ ▼
┌───────┐ ┌───────┐ ┌───────┐
│Explore│ │ Code │ │ Test │
│ Agent │ │Review │ │Runner │
└───────┘ └───────┘ └───────┘