Tools
Tools: Subagents: How Claude Delegates Like Santa
2026-01-29
0 views
admin
Introduction ## The Problem ## The Solution ## How to Use It ## Pro Tips ## Real-World Use Case ## Conclusion Santa doesn't wrap every gift. He has elves. Claude has subagents. It's December at the North Pole. Millions of gifts need wrapping, each requiring different paper, different ribbons, different techniques. Does Santa wrap each one personally? Of course not. He delegates. Specialized elves handle specialized tasks. They work in parallel. The results come back coordinated and ready. Now imagine your coding session. You need to refactor an authentication module, update all the tests, revise the documentation, and check for security vulnerabilities. Each task requires different context. Each demands focused attention. Traditional AI approaches tackle these sequentially, carrying the weight of every previous interaction. Subagents are Claude's elves. Independent AI workers, each with their own fresh 200K context window, handling specialized tasks in parallel and merging results back to the main agent. This is divide and conquer for the AI age. Claude Code's context window is massive—but it's not infinite. And even with 200K tokens, complex tasks create challenges: Context Pollution: A deep dive into your authentication code fills the context. Now when you switch to documentation, Claude is still "thinking about" auth patterns, making its suggestions less focused. Sequential Bottlenecks: Tasks that could happen simultaneously wait in line. Analyzing three independent modules? You're doing them one by one, even though they don't depend on each other. Cognitive Overload: Keeping track of multiple concerns degrades output quality. The agent that's been discussing security vulnerabilities for an hour brings that lens to every subsequent task, even when it's not relevant. Wasted Expertise: Some tasks need a generalist. Others need deep specialization. One context window can't optimize for both. Subagents split work into independent execution streams. Each subagent gets a fresh 200K context window, focused tooling, and a specific mission. They run in parallel, and their outputs merge back to coordinate the final result. Automatic Subagent Spawning For complex tasks, Claude automatically spawns subagents: Explicit Subagent Delegation Request specific subagent behavior: Subagent Specialization Each subagent can have specialized configurations: Right-Size Your Delegation: Not everything needs subagents. Simple tasks run faster in the main context. Use subagents for: truly independent tasks, work requiring deep specialization, or parallel-friendly workflows. Provide Clear Boundaries: When spawning subagents explicitly, define their scope clearly. "Analyze the auth module" is better than "look at security stuff." Clear missions produce focused results. Let Subagents Share Findings: Subagents can be configured to share discoveries: Monitor Subagent Progress: For long-running subagent tasks, check status: Review Before Merge: By default, subagent outputs are shown before being applied: Scenario: You're leading a major refactoring effort. The monolith is being split into microservices. Each service needs its own analysis: dependency mapping, API surface identification, data model extraction, and deployment configuration. The Traditional Approach: Analyze each service sequentially. By service number five, you've lost context from service one. The analysis takes days. Inconsistencies creep in. The Subagent Approach: The Result: Four services analyzed simultaneously. Each subagent has full context on its specific domain. No pollution between services. Consistent methodology applied across all. Results merged into a comprehensive migration plan. What would have taken a day takes minutes. Subagents transform Claude Code from a single-threaded assistant into a parallel workforce. Complex tasks that once required sequential attention now run simultaneously. Specialized analysis that once competed for context space now gets dedicated resources. The bottleneck of "one context window" dissolves into "as many as you need." Santa figured out delegation centuries ago. Your AI workflow just caught up. Tomorrow, we continue our journey through Claude Code's capabilities. Day 26 reveals another feature that will transform how you work with AI-assisted development. The series continues—only six days left! Follow along with the series to discover a new Claude Code feature every day. What tasks would you delegate to subagents? Share your parallel processing dreams in the comments! Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse COMMAND_BLOCK:
> Analyze this codebase for security vulnerabilities, performance bottlenecks, and code quality issues Claude: I'll spawn three subagents to analyze these in parallel:
- Security Subagent: scanning for vulnerabilities
- Performance Subagent: profiling bottlenecks
- Quality Subagent: checking code standards [Running in parallel...] Consolidated Report:
- Security: 3 critical, 7 moderate findings
- Performance: 2 bottlenecks identified
- Quality: 89/100 score, 12 suggestions Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
> Analyze this codebase for security vulnerabilities, performance bottlenecks, and code quality issues Claude: I'll spawn three subagents to analyze these in parallel:
- Security Subagent: scanning for vulnerabilities
- Performance Subagent: profiling bottlenecks
- Quality Subagent: checking code standards [Running in parallel...] Consolidated Report:
- Security: 3 critical, 7 moderate findings
- Performance: 2 bottlenecks identified
- Quality: 89/100 score, 12 suggestions COMMAND_BLOCK:
> Analyze this codebase for security vulnerabilities, performance bottlenecks, and code quality issues Claude: I'll spawn three subagents to analyze these in parallel:
- Security Subagent: scanning for vulnerabilities
- Performance Subagent: profiling bottlenecks
- Quality Subagent: checking code standards [Running in parallel...] Consolidated Report:
- Security: 3 critical, 7 moderate findings
- Performance: 2 bottlenecks identified
- Quality: 89/100 score, 12 suggestions COMMAND_BLOCK:
> Using subagents, refactor the auth module, update its tests, and revise the API documentation Claude: Spawning specialized subagents: [Auth Refactor Subagent]
- Fresh context loaded with auth/ directory
- Implementing OAuth2 alongside JWT
- Progress: ████████░░ 80% [Test Update Subagent]
- Fresh context loaded with tests/auth/
- Updating test cases for new auth flows
- Progress: ██████░░░░ 60% [Docs Subagent]
- Fresh context loaded with docs/api/
- Revising authentication documentation
- Progress: ████░░░░░░ 40% Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
> Using subagents, refactor the auth module, update its tests, and revise the API documentation Claude: Spawning specialized subagents: [Auth Refactor Subagent]
- Fresh context loaded with auth/ directory
- Implementing OAuth2 alongside JWT
- Progress: ████████░░ 80% [Test Update Subagent]
- Fresh context loaded with tests/auth/
- Updating test cases for new auth flows
- Progress: ██████░░░░ 60% [Docs Subagent]
- Fresh context loaded with docs/api/
- Revising authentication documentation
- Progress: ████░░░░░░ 40% COMMAND_BLOCK:
> Using subagents, refactor the auth module, update its tests, and revise the API documentation Claude: Spawning specialized subagents: [Auth Refactor Subagent]
- Fresh context loaded with auth/ directory
- Implementing OAuth2 alongside JWT
- Progress: ████████░░ 80% [Test Update Subagent]
- Fresh context loaded with tests/auth/
- Updating test cases for new auth flows
- Progress: ██████░░░░ 60% [Docs Subagent]
- Fresh context loaded with docs/api/
- Revising authentication documentation
- Progress: ████░░░░░░ 40% COMMAND_BLOCK:
> Create a subagent specialized in database optimization for analyzing our query patterns Claude: Spawning Database Optimization Subagent with:
- Focus: SQL/PostgreSQL patterns
- Tools: Query analyzer, explain plan parser
- Context: Loaded with models/ and queries/
- Objective: Identify N+1 queries and suggest indexes Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
> Create a subagent specialized in database optimization for analyzing our query patterns Claude: Spawning Database Optimization Subagent with:
- Focus: SQL/PostgreSQL patterns
- Tools: Query analyzer, explain plan parser
- Context: Loaded with models/ and queries/
- Objective: Identify N+1 queries and suggest indexes COMMAND_BLOCK:
> Create a subagent specialized in database optimization for analyzing our query patterns Claude: Spawning Database Optimization Subagent with:
- Focus: SQL/PostgreSQL patterns
- Tools: Query analyzer, explain plan parser
- Context: Loaded with models/ and queries/
- Objective: Identify N+1 queries and suggest indexes COMMAND_BLOCK:
> Spawn subagents for frontend and backend analysis, with shared findings for API contract issues Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
> Spawn subagents for frontend and backend analysis, with shared findings for API contract issues COMMAND_BLOCK:
> Spawn subagents for frontend and backend analysis, with shared findings for API contract issues CODE_BLOCK:
/subagents status Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
/subagents status CODE_BLOCK:
/subagents status CODE_BLOCK:
Subagent results ready for review:
- Auth Subagent: 4 files modified
- Test Subagent: 8 files modified
- Docs Subagent: 3 files modified Apply all? Review individually? [a/r] Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
Subagent results ready for review:
- Auth Subagent: 4 files modified
- Test Subagent: 8 files modified
- Docs Subagent: 3 files modified Apply all? Review individually? [a/r] CODE_BLOCK:
Subagent results ready for review:
- Auth Subagent: 4 files modified
- Test Subagent: 8 files modified
- Docs Subagent: 3 files modified Apply all? Review individually? [a/r] COMMAND_BLOCK:
> Spawn subagents to analyze and plan microservice extraction for: user-service, order-service, payment-service, notification-service Claude: Spawning 4 specialized subagents: [user-service Subagent]
- Mapping dependencies: auth, profile, preferences
- Identifying API surface: 23 endpoints
- Extracting data models: 8 entities
- Generating deployment config: Kubernetes + Helm [order-service Subagent]
- Mapping dependencies: cart, inventory, pricing
- Identifying API surface: 31 endpoints
- Extracting data models: 12 entities
- Generating deployment config: Kubernetes + Helm [payment-service Subagent]
... [notification-service Subagent]
... All subagents running in parallel. Estimated completion: 4 minutes. Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
> Spawn subagents to analyze and plan microservice extraction for: user-service, order-service, payment-service, notification-service Claude: Spawning 4 specialized subagents: [user-service Subagent]
- Mapping dependencies: auth, profile, preferences
- Identifying API surface: 23 endpoints
- Extracting data models: 8 entities
- Generating deployment config: Kubernetes + Helm [order-service Subagent]
- Mapping dependencies: cart, inventory, pricing
- Identifying API surface: 31 endpoints
- Extracting data models: 12 entities
- Generating deployment config: Kubernetes + Helm [payment-service Subagent]
... [notification-service Subagent]
... All subagents running in parallel. Estimated completion: 4 minutes. COMMAND_BLOCK:
> Spawn subagents to analyze and plan microservice extraction for: user-service, order-service, payment-service, notification-service Claude: Spawning 4 specialized subagents: [user-service Subagent]
- Mapping dependencies: auth, profile, preferences
- Identifying API surface: 23 endpoints
- Extracting data models: 8 entities
- Generating deployment config: Kubernetes + Helm [order-service Subagent]
- Mapping dependencies: cart, inventory, pricing
- Identifying API surface: 31 endpoints
- Extracting data models: 12 entities
- Generating deployment config: Kubernetes + Helm [payment-service Subagent]
... [notification-service Subagent]
... All subagents running in parallel. Estimated completion: 4 minutes.
how-totutorialguidedev.toaiswitchpostgresqldatabasekubernetes