Knowledges 5 min

VB-01 First Steps with Sub-agents in Claude Code

Sub-agents in Claude Code are powerful, but get them wrong and they burn tokens and crawl. How the information flow really works, 2 mistakes I made, and when you DON'T need sub-agents.

Also in: Tiếng Việt · 中文 · 한국어 · 日本語

I plan to document and share everything I learn using Claude Code while “vibe coding” the DevPocket.app app! (I call it “vibe coding” because I just focus on giving orders and barely review the code anymore. No idea if anything will actually come out of it 😂)

VB-01 First Steps with Sub-agents in Claude Code

Today we'll walk through the first steps of using Claude Code's Sub-agents: your very own army of agents, each one specialized in a different task.

It's a really powerful Claude feature, but as I said in my previous post, actually getting the most out of it is far from simple. In this post, we'll dissect how to build effective sub-agents and avoid the most common mistakes, based on my own experience.

*() Bonus: there are important side notes at the end of the post! 😜**


1. How do Sub-agents work? Understanding the information flow

This is the most important part, and one a lot of people skip or simply don't know about (me included hehe).

VB-01 First Steps with Sub-agents in Claude Code

Sub-agents don't talk straight to you. It's a chain of delegation:

  1. You give an order (prompt) to the Main Agent.
  2. Based on your order, the Main Agent decides which Sub-agents fit and gives them orders.
  3. The Sub-agents work independently to carry out the task.
  4. When done, the Sub-agents report the results back to the Main Agent.
  5. Finally, the Main Agent pulls everything together and reports back to you.
mermaidflowchart LR
  U["You"] -->|"prompt"| M["Main Agent"]
  M -->|"assigns task"| S1["Sub-agent A"]
  M -->|"assigns task"| S2["Sub-agent B"]
  S1 -->|"reports back"| M
  S2 -->|"reports back"| M
  M -->|"summarizes results"| U
The delegation chain: sub-agents only talk to the Main Agent
VB-01 First Steps with Sub-agents in Claude Code

When I first tried it, I happily created 2-3 agents, but no matter how I prompted, not a single one got summoned. Turns out you need to create a main agent first (like a team leader), then write a system prompt so you can summon it and hand it work, and it then delegates down to the agents on the team.

Locked section: 2. Two mistakes I made working with Sub-agents

Locked section: 3. Pros and cons of Sub-agents

Locked section: Context preservation

Locked section: Specialization

Locked section: Reusability

Locked section: Permission control

Locked section: Laser focus

Locked section: Context isolation

Locked section: Hard to debug

Locked section: Choice overload

Locked section: Dependency coupling

Locked section: VERY SLOW task processing

Locked section: Wrapping up

Locked section: My personal take (the side notes I mentioned at the top hehe)

The rest is for Knowledges members

Plus 14 more sections (about 4 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.