sub-agent-patterns

Installation
Summary

Delegate specialized tasks to isolated AI assistants with custom tools, models, and system prompts.

  • Sub-agents preserve main context by isolating verbose tool outputs and intermediate reasoning, enabling longer sessions and cleaner conversations
  • Three built-in agents available: Explore (Haiku, read-only codebase search), Plan (Sonnet, plan-mode research), and General-Purpose (Sonnet, full read/write access)
  • Create custom agents in .claude/agents/ with YAML frontmatter and markdown prompts; omit the tools field entirely to inherit all tools including MCP integrations
  • Orchestrate multi-phase workflows by adding the Task tool to an agent's configuration, enabling parallel execution and synthesis across specialists
  • Avoid Bash approval spam by removing Bash from tools lists unless the agent genuinely needs CLI execution; default to Write/Edit tools for file operations
SKILL.md
Contains Hooks

This skill uses Claude hooks which can execute code automatically in response to events. Review carefully before installing.

Sub-Agents in Claude Code

Status: Production Ready ✅ Last Updated: 2026-02-02 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)
Related skills
Installs
401
GitHub Stars
776
First Seen
Jan 20, 2026