# I was using sub-agents wrong... Here is my way after 20+ hrs test

Source: https://www.youtube.com/watch?v=LCYBVpSB0Wo
Recap page: https://rapidrecap.app/video/LCYBVpSB0Wo
Generated: 2025-08-14T13:02:39.399+00:00

---
## Quick Overview

Claude Code's sub-agent feature allows for specialized AI agents, but users often misuse them by including excessive context, leading to poor performance and high token consumption; the optimal approach is to provide specific documentation and tasks to dedicated agents, keeping their scope focused and their output concise.

**Key Points:**
- Sub-agents are powerful but often misused by providing excessive context, leading to inefficient token usage and poor performance.
- The optimal approach involves creating specialized agents with defined scopes and providing them with specific, task-oriented documentation and prompts.
- The speaker demonstrates creating a 'shadcn-ui-builder' agent for UI design and a 'vercel-ai-sdk-expert' agent for SDK integration, showing how to consult documentation and define goals.
- Effective context management is crucial; agents need access to relevant files and information through correct paths and system prompts.
- Properly defined sub-agent roles and clear output formats are essential for successful AI agent workflows.
- The video showcases the creation and testing of a ChatGPT replica UI using shadcn components and Vercel AI SDK, demonstrating the practical application of these principles.

![Screenshot at 00:21: The 'shadcn-ui-expert' agent being tasked with designing a ChatGPT replica UI, illustrating the concept of assigning specific roles and tasks to sub-agents.](https://ss.rapidrecap.app/screens/LCYBVpSB0Wo/00-00-21.png)

**Context:** The video explores the practical application and optimization of sub-agents within the Claude Code AI framework. The speaker, drawing from personal testing and observations, addresses common user errors in utilizing these specialized AI agents, particularly concerning context management and token efficiency. The discussion highlights how to properly configure and interact with sub-agents for tasks like UI development and SDK integration, emphasizing the importance of clear prompts and focused agent roles.

## Detailed Analysis

The video discusses the proper usage of Claude Code's sub-agent feature, highlighting common pitfalls where users overload agents with too much context, leading to inefficient token usage and subpar results. The speaker demonstrates how to create specialized agents, like a 'shadcn-ui-builder' or 'vercel-ai-sdk-expert', by providing them with specific documentation and task-oriented prompts. The key takeaway is that agents perform best when their scope is clearly defined and they are given focused tasks, rather than being expected to manage broad contexts or multiple functionalities. The speaker walks through creating a 'shadcn-ui-builder' agent to design a ChatGPT replica UI, emphasizing the importance of reading component documentation and defining clear goals. They also show how to create a 'vercel-ai-sdk-expert' agent for Vercel AI SDK integration, highlighting the need to consult official documentation for specific tasks. The video also touches upon managing context files and ensuring agents have access to the necessary information through proper file paths and system prompts. The speaker concludes by stressing that effective sub-agent usage requires careful context engineering and task delegation to maximize efficiency and performance.

### Sub-agent Misuse

- Overloading agents with context leads to inefficiency
- Poor performance
- High token consumption

### Optimal Sub-agent Usage

- Provide specific documentation
- Assign focused tasks
- Define clear scopes

### Creating Specialized Agents

- Demonstrates 'shadcn-ui-builder' and 'vercel-ai-sdk-expert' creation
- Emphasizes consulting documentation and defining goals

### Context Management

- Proper file paths
- System prompts for agent access
- Maintaining context files

### Key Takeaways

- Effective sub-agent usage requires context engineering
- Task delegation maximizes efficiency
- Focus on specialized agents for better performance

![Screenshot at 00:04: The Claude Code interface showing the '/agents' command prompt, indicating the start of agent creation.](https://ss.rapidrecap.app/screens/LCYBVpSB0Wo/00-00-04.png)
![Screenshot at 00:08: An example of using sub-agents like 'frontend-developer' and 'backend-architect' with their respective tasks and token usage.](https://ss.rapidrecap.app/screens/LCYBVpSB0Wo/00-00-08.png)
![Screenshot at 00:09: A Reddit post discussing issues with sub-agents consuming too many tokens and not showing changes, highlighting a common user problem.](https://ss.rapidrecap.app/screens/LCYBVpSB0Wo/00-00-09.png)
![Screenshot at 00:13: Another Reddit post showing a 'jira-operator' sub-agent successfully creating a task, demonstrating a functional use case.](https://ss.rapidrecap.app/screens/LCYBVpSB0Wo/00-00-13.png)
![Screenshot at 00:21: The 'shadcn-ui-expert' agent tasked with designing a ChatGPT replica UI using shadcn components and Next.js.](https://ss.rapidrecap.app/screens/LCYBVpSB0Wo/00-00-21.png)
![Screenshot at 00:31: A diagram illustrating the need to research which file contains payments, showing command-line operations like 'LS' and 'glob'.](https://ss.rapidrecap.app/screens/LCYBVpSB0Wo/00-00-31.png)
![Screenshot at 00:38: A visual breakdown of Claude Code agent tools, categorizing them into 'Base Tools' and 'More advanced tools'.](https://ss.rapidrecap.app/screens/LCYBVpSB0Wo/00-00-38.png)
![Screenshot at 01:01: An explanation of how reading file content increases token usage, with a visual representation of '80% context used'.](https://ss.rapidrecap.app/screens/LCYBVpSB0Wo/00-01-01.png)
![Screenshot at 01:14: The challenge of sub-agents losing context about previous actions, leading to potential errors.](https://ss.rapidrecap.app/screens/LCYBVpSB0Wo/00-01-14.png)
![Screenshot at 01:21: A demonstration of creating a new agent by assigning it a task, specifically for a 'shadcn-ui-builder'.](https://ss.rapidrecap.app/screens/LCYBVpSB0Wo/00-01-21.png)
