How Do Claude Code Sub Agents Build Themselves with a Meta Agent?

103.2K views
•
July 28, 2025
by
IndyDevDan
YouTube video player
How Do Claude Code Sub Agents Build Themselves with a Meta Agent?

TL;DR

Effective Claude Code sub agents are specialized delegation tools that receive tasks from a primary agent and report their results back to it. Their definitions contain a unique name, description, tools, color, and a system prompt, not the user prompt that triggers the work. A meta agent can even generate new agents, but success depends on avoiding two major prompt-design mistakes; read on to understand the architecture and reporting flow.

Transcript

Welcome back engineers. Indie Dev Dan here. Imagine starting your day. You of course open up the terminal. You fire up Claude Code. Then you kick off a single prompt/cook that does the work it used to take you hours in minutes. You're able to accomplish this with Claude Code sub aents. You've created workflows of specialized agents that do one thin... Read More

Key Insights

  • Claude Code sub agents are delegation tools used by the primary agent. A user prompts the primary agent, which selects and instructs sub agents, receives their autonomous work, and then returns the final response to the user.
  • A sub agent reports to the primary agent rather than directly to the user. Its response format should therefore tell the primary agent how to interpret, relay, or continue using the returned information within the larger workflow.
  • A sub agent definition is a system prompt, not a user prompt. It establishes the agent's top-level role and behavior, while the specific task instruction comes later from the primary agent when delegation occurs.
  • The description field controls when a sub agent should be invoked. A clear description gives the primary agent a reliable selection signal, such as using a particular agent whenever the user provides a recognized greeting.
  • The context, model, and prompt form the three central elements of agent behavior. In multi-agent systems, engineers must also understand how those elements move between the user, primary agent, specialized sub agents, and subsequent agent calls.
  • Prompt chaining remains central to multi-agent orchestration. The primary agent can launch sub agents, collect their results, and use those results to trigger another group of agents that develops a more concrete solution.
  • A meta agent is an agent designed to build other agents. The presenter uses this pattern to create specialized agent definitions quickly and says it enabled the creation of more than 50, and possibly more than 100, agents.
  • Effective agent development starts with a genuine engineering problem rather than a technology looking for a use case. The recommended approach is to understand the tool deeply, identify valuable work, and then scale focused workflows around that need.

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: How do you build effective Claude Code sub agents?

Define each sub agent as a specialized delegation tool that does one thing well. Give it a unique name, a clear description that tells the primary agent when to invoke it, appropriate tools, and a system prompt with an explicit reporting format.

Q: How do Claude Code sub agents communicate with users?

Sub agents do not respond directly to the user in the described architecture. The user prompts the primary agent, the primary agent delegates tasks to sub agents, and those sub agents report their results back to the primary agent.

Q: What is the difference between a sub agent system prompt and a user prompt?

The text in a sub agent definition is its system prompt, which establishes its top-level functionality. A user prompt instead enters the primary agent’s context window and can lead that agent to delegate specific work to a sub agent.

Q: Why is the Claude Code sub agent description important?

The description tells the primary agent when it should call a particular sub agent. In the example, greetings such as “hi Claude,” “hi CC,” or “hi Claude Code” cause the primary agent to find and invoke the hello-world agent.

Q: What are the two major mistakes engineers make with Claude Code sub agents?

The first mistake is treating a sub agent definition as the task prompt rather than its system prompt. The second is writing its response as though it communicates directly with the user, even though it actually reports to the primary agent.

Q: How should a Claude Code sub agent report its results?

Its system prompt should include a response format written for the primary agent. The example explicitly tells the primary agent to respond to the user with a particular message, showing how the sub agent’s report can guide the final response.

Q: What information does a Claude Code sub agent definition contain?

The demonstrated definition includes a unique agent name, a description, specified tools, and a color. Below those fields is the system prompt, which can use sections such as purpose and report to define behavior and returned information.

Q: What is a meta agent in Claude Code?

A meta agent is an agent used to build new agents. The presenter describes this as having his agents build his agents, allowing specialized agent definitions to be generated instead of creating every one manually.

Summary & Key Takeaways

  • Claude Code uses a hierarchical information flow: the user prompts the primary agent, the primary agent delegates work to selected sub agents, and those sub agents report their results back to the primary agent. Understanding this architecture is necessary when designing prompts, response formats, and chained workflows involving multiple specialized agents.

  • A sub agent definition contains metadata such as a unique name, description, available tools, and color, followed by its system prompt. The description tells the primary agent when the sub agent should be used. The system prompt establishes persistent behavior, but it does not supply the specific user task that triggers execution.

  • A meta agent can accelerate workflow development by generating additional specialized agents. The presenter says this approach helped him build more than 50 and possibly more than 100 agents. The broader principle is to begin with a real engineering problem, then create focused agents and chains that address it efficiently.


Read in Other Languages (beta)

Share This Summary 📚

Explore More Summaries from IndyDevDan 📚