[VC-01] First Steps Using Sub-agents in Claude Code
My first article from the "Vibe Coding with Claude Code" series
Author: Goon ⢠Published: August 03, 2025 (in Vietnamese)
I plan to document and share all the experience gained from using Claude Code in the āvibe codingā process for the DevPocket.app application! (called āvibe codingā because I only focus on giving commands, not reviewing code much anymore - donāt know if this will produce results š)

DevPocket.app - Time to ditch the laptop & code on your pocket!
This series is expected to have around 8 articles:
[VC-01] First Steps Using Sub-agents in Claude Code
[VC-02] Everything About Claude Codeās Tool Set
[VC-03] How to Write Prompts When āVibe Codingā
[VC-04] Subagents from Basic to Deep Dive: I was wrong!
[VC-05] āTrickingā Subagents: Optimizing System Prompts!
[VC-06] Commands & Hooks - Increase Claude Code Efficiency
[VC-07] Vibe coding the UI beautifully?
[VC-08] Claude Code for Sales & Marketing
Today weāll go through the first steps when using Sub-agents in Claude Code - your own team of agents with each agent specializing in a different task.
This is a very powerful feature of Claude, but as I mentioned in the previous article, exploiting it effectively is really not simple.
In this article, weāll dissect how to build effective sub-agents and avoid the most common mistakes based on my personal experience.
(*) Special note: I have important side notes at the end of the article! š
Thanks for reading! Subscribe for free to receive new posts and support my work.
1. How Do Sub-agents Work? Understanding the Information Flow Correctly
This is the most important part that many people often skip or donāt know (including me hehe)

Always start from the Main Agent (Agent Leader) and delegate tasks to other agents in the project
The workflow of sub-agents doesnāt go directly from them to you, but is a chain of delegation:
You give a command (prompt) to the Main Agent.
The Main Agent, based on your command, decides and commands the appropriate Sub-agents.
Sub-agents operate independently to execute tasks.
After completion, Sub-agents report results back to the Main Agent.
Finally, the Main Agent consolidates information and reports back to you.
š Core point: Sub-agents donāt communicate with you, they communicate with the Main Agent. Misunderstanding this leads to writing wrong prompts, wrong workflows, and not achieving desired results.

For example, when I first tried it, I created 2-3 agents right away, but when prompting I didnāt see any agents being summoned at all. Turns out you need to create a main agent first (like a leader), then write a system prompt to be able to summon it to assign work, after which it will delegate down to the agents in the team to work.
Note:
Agents DO NOT share memory with each other, they work in separate sessions, and only report back when tasks are completed.
This leads to the phenomenon that using āsub agentsā in Claude Code consumes quite a lot of tokens (much more than using Claude agent as before).

Note: take time to read Anthropicās āuser guideā carefully, donāt just feed it to AI for summarization or feed it directly to Claude Code for it to use. We need to understand the āessence of the problemā to apply it effectively.
2. Two Mistakes I Made Working with Sub-agents
From misunderstanding the information flow above, we often make these 2 big mistakes:
Mistake 1: Not understanding that the content of files in /.agent is the āSystem Promptā
What you write in a sub-agentās configuration file (e.g., .agents/hello-world) is not a āuser promptā. It is the System Prompt - defining the role, purpose, core behavior, and when it should be activated.
Mistake 2: Instructing Sub-agent to respond to the wrong audience
Because sub-agents report to the main agent, you must instruct it how to communicate with its āsuperiorā.
For example, in the sub-agentās prompt, instead of writing āPlease respond to the user...ā, you should write: āHey Claude (Main Agent), please respond to the user with the following content...ā. This helps the Main Agent understand the message and relay it back to you accurately.
3. Advantages and Disadvantages of Sub-agents
š Advantages:
Context preservation: As mentioned above, agents donāt share MEMORY, each sub-agent runs in its own ācontext windowā, which consumes more tokens but this also has benefits - it doesnāt āpolluteā your main conversation. And itās extremely useful when handling large and complex codebases.
Specialization: You can create extremely specialized agents for each specific task (e.g., agent specialized in refactoring code, agent specialized in writing tests, etc.)
Reusability: Once created, you can reuse these agents in many different projects.
Permission control: You can limit the tools that a sub-agent is allowed to use, enhancing security.
High focus: Because they only do one thing, sub-agents are less likely to āhallucinateā or make errors.
š Disadvantages:
Context isolation: This is the flip side of the above advantage. Because thereās no conversation history, the Main Agent must provide all necessary information in a single command.
Difficult to debug: The internal workflow of sub-agents is abstracted into notification messages. When they finish, all activities disappear, making finding and fixing errors more difficult (you canāt just sit and stare at the screen watching what they do all the time).
Choice overload: When you have too many sub-agents, the Main Agent can be āconfusedā about which agent to call. Writing clear and accurate descriptions is extremely important.
Dependency Coupling: If you create a chain of agents dependent on each otherās results, changing one agent can break the entire chain.
VERY SLOW task processing time: just like how organizations work, a cumbersome system means long processing times due to having to go through many approval layers - some tasks can take up to an hour...

Conclusion
Sub-agents are an extremely powerful feature, opening up a new era of automation in programming. It allows us to build complex multi-agent systems but in an organized way. Later, other AI systems (not programming) will also have similar operational methods.
The key to mastering this technology is understanding the information flow and thinking in terms of delegation.
Donāt just assign tasks, show your agents how to work and report back.
Personal Opinion
(Special Notes I mentioned at the beginning hehe)
Conspiracy theory (reminder: this is MY PERSONAL OPINION - just for fun - donāt take it seriously):
āI feel like Subagents were created... just to consume more $ tokens from us hahaā
NOT every task needs to use subagents! Why? Read the ādisadvantagesā section above again. For small tasks, prompt CC directly for faster processing and save tokens. Only use agents for difficult tasks with complex processing flows. Donāt use a butcherās knife to kill a chicken.
Finally, the first article in this āVibe Codingā series should have started from the most basic things, but because everyone was so interested in the āSubagentsā topic, I wrote it first. In future articles Iāll write more about ADVANCED techniques when using āSubagentsā and ātricksā (*) for effective use.
But remember:
NOT every task needs to use sub-agents!
NOT every task needs to use sub-agents!
NOT every task needs to use sub-agents!
(Important things are repeated 3 times š)
(*) Friends on Facebook tease me that I often share ātricksā š