Chapter 4. How to Use — Sub Agents
4.1 What Is a Sub Agent? A Sub Agent is a specialized AI assistant dedicated to handling specific tasks within a Claude Code session. If the main Claude Code is the "general manager," Sub Agents ar...

Source: DEV Community
4.1 What Is a Sub Agent? A Sub Agent is a specialized AI assistant dedicated to handling specific tasks within a Claude Code session. If the main Claude Code is the "general manager," Sub Agents are "team members," each with their own area of expertise. Each Sub Agent operates with its own independent context window, dedicated system prompt, and restricted tool access. ┌──────────────────────────────────────────────┐ │ Main Claude Code Session (General Manager) │ │ │ │ "Review this code" │ │ ↓ delegate │ │ ┌──────────────────────────────────┐ │ │ │ Sub Agent: code-reviewer │ │ │ │ • Independent context window │ │ │ │ • Read-only tools allowed │ │ │ │ • Code review system prompt │ │ │ └──────────────┬───────────────────┘ │ │ ↓ return result │ │ "Review complete: 3 improvements found" │ └──────────────────────────────────────────────┘ 4.2 Purpose and Role Why Use Sub Agents? Purpose Description Context preservation Exploration and analysis results do not pollute the main conversation. Su