VB-04: Subagents from Basics to Deep Dive – I Got It All Wrong!
I thought I understood Claude Code Subagents. Turns out I had it all wrong 😅 A deep dive into Context Management, Context Rot, and how I rebuilt my subagent team into a “Context Collector Army” to finally crack a test suite I'd been stuck on for 3 days.
Also in: Tiếng Việt · 中文 · 한국어 · 日本語
This 4th post was supposed to be about Claude Code “Commands”, but I discovered quite a few mistakes I'd been making with Subagents, so I decided to push the Commands post to part 05 😅
What's in this post?
- An overview of Claude Code Subagents
- The benefits subagents can bring
- A few pretty useful repos
- Time to Deep-Dive!
- The research I read and how I applied it
- Rebuilding my subagent team and the results
- As always: a few “dumb-but-it-works tricks” scattered throughout 😂

Claude Code Subagents overview
How to create a Subagent
Use CC's /agents command for the fastest setup, then open the MD file and customize it however you like.
text# Open the sub agents interface
/agents
# Select "Create New Agent"
# Choose project-level or user-levelUnderstanding “delegation”
By default, Claude Code itself is the Main Agent and executes everything. Once we create subagents, CC will automatically summon the relevant agent and delegate tasks when needed “intelligently” – according to Claude's docs (so intelligent that you rarely see it summon a subagent at all; the main agent just handles everything itself, like: “pfft, that's easy, I got this!” 😂)
So, to summon subagents more effectively, we have 2 options:
1/ Automatic (smarter than that default “intelligence”):
Add the following instructions to CLAUDE.md to remind CC that it has an army under its command:
text...
During the implementation process, you will delegate tasks to the following subagents based on their expertise and capabilities
- Use `planner-researcher` agent to plan for the implementation plan.
- Use `database-admin` agent to run tests and analyze the summary report.
- Use `tester` agent to run tests and analyze the summary report.
- Use `debugger` agent to collect logs in server or github actions to analyze the summary report.
- Use `code-reviewer` agent to review code.
- Use `docs-manager` agent to update docs in `./docs` directory if any.
...2/ The old-fashioned way (Manual): put it straight into your prompt or use a Command (user prompt).
Next, you should know there are 2 ways to summon subagents: “Sequential” (Chaining) and “Parallel”.
Chaining Sub-Agents
text# Complex workflow example
> First use the code-analyzer subagent to find performance issues,
> then use the optimizer subagent to fix themParallel Execution
text# Competing approaches
> Deploy 2 subagents in parallel:
> Subagent 1 - Incremental Modernizer: Design gradual migration strategy
> Subagent 2 - Complete Rewrite Advocate: Propose full stack modernizationNote that each sub-agent has:
Its own context window
Not affected by the main conversation
A custom system prompt
“Trained” for a specific role
Its own tool access
Only allowed to use the tools it needs
Deep expertise
100% focused on its domain expertise
Benefits subagents can bring
| Benefit | What it means |
|---|---|
| Context Preservation | Instead of re-explaining everything from scratch every time you switch tasks, each sub-agent keeps its own context. The main conversation stays clean and focused. |
| Specialized Expertise | A sub-agent fine-tuned for security will always beat a general AI at reviewing code for security. The success rate is significantly higher. |
| Reusability & Team Sharing | Create once, use forever. Share it with your team for a consistent workflow. |
| Parallel Processing | Instead of working sequentially: analyze → code → test → review, you can run multiple sub-agents in parallel. |
A few pretty useful repos
A list of subagents for reference (use their descriptions and workflows as inspiration to customize your own agents – don't just copy them verbatim):
wshobson/agentsgithub.comClaude Sub-Agent Spec Workflow System: this one has plenty of nice workflows too; I borrowed ideas from it to build my own subagents.
zhsama/claude-sub-agentgithub.comTime to Deep-Dive!
Has anyone else been in the same spot as me: you've got a “godlike” team of AI agents that can do everything, but when you actually use them... sometimes it works, sometimes it doesn't?
Sometimes it works so brilliantly that it burns tokens at a million miles an hour, but other times the results aren't what you expected, or it gets stuck in an endless reincarnation cycle of fixing bugs that never go away?
I was in exactly that situation the past few days. Subagents didn't feel very effective; they just burned tokens and time... and I was still stuck solving a Test Suite for almost 3 days.
So I decided to dig deeper, and here's what I learned...
Context Management is the key!
Locked section: Context Management: Using the File System as Memory (specifically Markdown files)
Locked section: Context Rot
Locked section: 1. Prioritize Semantic Proximity
Locked section: 2. Minimize Distractors
Locked section: 3. Structure Over Coherence
Locked section: 4. Length Optimization
Locked section: I got sub-agents wrong too!
Locked section: The initial problem with Sub Agents
Locked section: Slow
Locked section: Token-hungry
Locked section: No better results
Locked section: Why does Claude Code need Sub Agents?
Locked section: Common mistake: Using Sub Agents for Implementation
Locked section: Give each agent the right tools
Locked section: Best Practice: Sub Agents are an army that gathers useful information! (Context Collector Army)
Locked section: Here's how I reorganized my subagent team
Locked section: 1. Explore
Locked section: 2. Planning
Locked section: 3. Execute
Locked section: Dumb-but-it-works trick: Double Escape – a godlike technique =))
Locked section: Results
Locked section: Key takeaways
Locked section: Wrapping up!
Locked section: References
The rest is for Knowledges members
Plus 24 more sections (about 7 min) for members
You are reading roughly the first third. Knowledges, Combo and Community plans unlock paid articles in full; the Zuey AI plan reads previews only.