sub-agent-patterns
Comprehensive guide to sub-agents in Claude Code: built-in agents (Explore, Plan, general-purpose), custom agent creation, configuration, and delegation patterns. Use when: creating custom sub-agents, delegating bulk operations, parallel research, understanding built-in agents, or configuring agent tools/models.
npx skills add majiayu000/claude-skill-registry --skill sub-agent-patterns-dennislee928-smart-zone-2 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Provides a comprehensive guide to sub-agents in Claude Code, detailing built-in sub-agents (Explore, Plan, General-Purpose), how to create custom sub-agents, configuration fields, tool usage, and orchestration patterns for multi-agent workflows.
How it works
Describes three built-in sub-agents with their models, modes, and tools:
- Explore Agent: Haiku, read-only, tools include Glob, Grep, Read, Bash (read-only subset)
- Plan Agent: Sonnet, read-only research, tools Read, Glob, Grep, Bash
- General-Purpose Agent: Sonnet, read and write, tools All tools It explains custom sub-agent creation via Markdown with YAML frontmatter, including required fields (name, description) and optional fields (tools, model, permissionMode, hooks, skills). It outlines file locations for project, user, and CLI, and notes a session restart requirement when adding new agents mid-session. It lists available tools and recommended patterns by agent type, plus guidance on avoiding Bash approval spam. It also covers agent orchestration using the Task tool to spawn and coordinate multiple sub-agents, with examples of release orchestration and multi-specialist workflows. Finally, it presents advanced patterns like Background Agents (Async Delegation).
When to use it
Use when designing or selecting sub-agents for workflows, delegation, or parallel research, and when configuring or understanding built-in vs custom agents; triggers include creating custom sub-agents, delegating bulk operations, parallel research, understanding built-in agents, or configuring agent tools/models.
What it can touch
Lists tools that sub-agents can access, such as Read, Write, Edit, Glob, Grep, LS, Bash, Task, WebFetch, WebSearch, and others; details include which agent types should have which tools for different tasks (Read-only reviewers, Script runners, Orchestrators, etc.).
Caveats
Notes that session restart is required to discover newly created agents; Bash usage can cause approval spam if included in an agent’s tools list; guidance to drop Bash if not needed. It emphasizes careful tool access, especially for orchestrators and multi-agent coordination, to avoid unwanted prompts and complex context management.
# Sub-Agents in Claude Code **Status**: Production Ready ✅ **Last Updated**: 2026-01-14 **Source**: https://code.claude.com/docs/en/sub-agents Sub-agents are specialized AI assistants that Claude Code can delegate tasks to. Each sub-agent has its own context window, configurable tools, and custom system prompt. --- ## Why Use Sub-Agents: Context Hygiene The primary value of sub-agents isn't specialization—it's **keeping your main context clean**. **Without agent** (context bloat): ``` Main context accumulates: ├─ git status output (50 lines) ├─ npm run build output (200 lines) ├─ tsc --noEmit output (100 lines) ├─ wrangler deploy output (100 lines) ├─ curl health check responses ├─ All reasoning about what to do next └─ Context: 📈 500+ lines consumed ``` **With agent** (context hygiene): ``` Main context: ├─ "Deploy to cloudflare" ├─ [agent summary - 30 lines] └─ Context: 📊 ~50 lines consumed Agent context (isolated): ├─ All verbose tool outputs ├─ All intermediate reasoning └─ Discarded after returning summary ``` **The math**: A deploy workflow runs ~10 tool calls. That's 500+ lines in main context vs 30-line summary with an agent. Over a session, this compounds dramatically. *
- Why Use Sub-Agents: Context Hygiene
- Built-in Sub-Agents
- Explore Agent
- Plan Agent
- General-Purpose Agent
- Creating Custom Sub-Agents
- File Locations
- File Format
- Configuration Fields
- Available Tools Reference
- Avoiding Bash Approval Spam (CRITICAL)
- Using /agents Command (Recommended)
- CLI Configuration
- Using Sub-Agents
claude --agents '{
claude --disallowedTools "Task(Explore)"
git add [files] && git commit -m "$(cat <<'EOF'What does the sub-agent-patterns skill do?
Comprehensive guide to sub-agents in Claude Code: built-in agents (Explore, Plan, general-purpose), custom agent creation, configuration, and delegation patterns. Use when: creating custom sub-agents, delegating bulk operations, parallel research, understanding built-in agents, or configuring agent tools/models.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill sub-agent-patterns-dennislee928-smart-zone-2 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
