
In today’s fast-paced software development landscape, leveraging AI to optimize workflows is no longer a futuristic concept—it’s a present-day necessity. Anthropic’s latest release, the sub agents feature for Claude Code, empowers developers to create their own team of specialized AI agents tailored for distinct aspects of their projects. This breakthrough allows each AI agent to operate independently, equipped with unique context, expertise, and specific toolsets, transforming how developers delegate tasks like code reviews, debugging, testing, and research.
This comprehensive guide will walk you through setting up these sub agents, configuring their tools and system prompts, and illustrate practical applications such as building a SaaS landing page powered by real-time web research. Whether you’re a developer eager to streamline your workflow or a team lead aiming to build an AI-powered mini workforce, this article will equip you with everything you need to harness the full potential of Claude Code’s sub agents.
What Are Sub Agents in Claude Code?
Sub agents represent a modular approach to AI-assisted development. Instead of relying on a single generalist AI model to handle all tasks, sub agents allow you to create multiple specialized assistants, each focused on a specific domain or function within your project. These agents can be tailored with:
- Individual context and expertise: Each agent’s knowledge base and operational focus can be customized to suit front-end development, backend engineering, web research, and more.
- Access to dedicated tools: You can assign specific MCP (Model-Connected Plugin) tools or core Cloud Code functions to each agent, such as file editing, database querying, or web scraping.
- Custom system prompts: Define unique behavior, preferences, and stylistic biases for each agent to align with your coding standards or personal preferences.
This setup enables you to delegate complex workflows to AI specialists, keeping your conversations and project management focused on the broader goals rather than micromanaging every task.
Getting Started: Setting Up Your First Sub Agent
Creating a sub agent within Claude Code is straightforward and flexible. Here is a step-by-step overview of the process:
- Open Cloud Code and access the agents interface: Within Cloud Code, simply type
/agents
to open the sub agent management panel. - Create a new agent: Choose whether the agent will be project-specific or globally accessible across all your projects on your machine.
- Configure or generate the agent: You can manually configure your agent or use Claude’s generative capabilities to create one based on your specifications.
For example, if you want to create a front-end engineer specialized in Next.js, Tailwind CSS, and ShadCN UI, you can instruct Claude to generate a markdown configuration file that outlines the agent’s expertise and tools.
This markdown file is your agent’s blueprint. You can iterate on it, adjusting tools, permissions, and even the agent’s personality or coding style biases.
Configuring Tools and Permissions
One of the powerful aspects of sub agents is the ability to customize what capabilities each agent has. Cloud Code provides core functions such as:
- Listing files within directories
- Reading and editing files
- Running commands and scripts
Additionally, if you have any MCP servers connected, these can be integrated and selectively enabled for each agent. For instance, you might want a backend agent to have database read/write access and the ability to run SQL queries, while your front-end agent might focus on UI components and styling tools.
In the example setup, the front-end engineer agent is granted access to all available tools, maximizing its ability to assist with a wide range of tasks.
Specifying Agent Context and System Prompts
The markdown structure for each agent includes several key fields:
- Name: The agent’s identifier.
- Location: Where the agent’s configuration file resides relative to the project directory.
- Tools: A comma-separated list of enabled tools, or “all tools” if you want full access.
- Description: Instructions on when and how Cloud Code should invoke this agent.
- System Prompts: These are the heart of the agent’s personality and operational behavior. Here, you can specify coding styles, preferences, and biases.
The system prompt section is particularly valuable—you can fine-tune your agent’s responses to avoid unwanted quirks like overuse of emojis, certain font styles, or specific design elements such as linear gradients.
All these configuration files live in a hidden .cloud
directory under an agents
subfolder, making them easy to manage and version control within your project repository.
Creating a Research Agent for Web-Based Tasks
Besides development-focused agents, you can create sub agents specializing in tasks like web research. For example, you might want an expert web researcher agent who can:
- Search the web effectively using search engines
- Scrape and extract relevant information from web pages
- Map URLs and organize findings
When creating this agent, you specify the tools it can access, such as web scraping and search query capabilities, and provide a description emphasizing its research expertise.
One of the standout features is the seamless integration with Claude’s chat interface, allowing you to update your agent’s configuration dynamically without leaving your development environment. For example, you can instruct Claude directly to update the agent’s markdown file during a chat session, streamlining agent management.
Building a SaaS Landing Page Powered by Sub Agents
Let’s put these agents to work by building a practical example: a SaaS landing page. The requirements include:
- A pricing table
- An FAQ section
- A main content area featuring the top five AI news stories from July 2025
Instead of manually researching the latest AI news, you can delegate this task to your web researcher agent. The agent will:
- Break down the high-level task into a to-do list
- Conduct targeted web searches to find relevant AI news stories
- Gather and organize the findings for integration into the landing page
After the research is complete, the front-end engineer agent takes over to build out the Next.js application, incorporating the pricing table, FAQ, and dynamically displaying the curated AI news stories.
This example highlights how multiple specialized agents can collaborate to automate complex workflows, dramatically reducing development time while maintaining high quality and relevance.
Advanced Use Cases and the Future Potential of Sub Agents
The flexibility of sub agents opens up many innovative possibilities beyond coding assistance:
- Project-Specific vs. Global Agents: You can create agents tailored to a single project’s needs or global agents that assist across multiple projects.
- Mini Workforce Creation: Spawn dozens of agents, each focused on a different task or domain, effectively creating a specialized AI team to tackle your project’s challenges.
- Integration with Diverse MCP Servers: Connect agents to MCP servers for non-coding related tasks such as managing Gmail, Linear, or Canva workflows, expanding AI utility across your entire productivity stack.
- Precise Instruction Engineering: Instead of a monolithic system prompt trying to cover every aspect of your application, split instructions into focused prompts for each agent, making them more efficient and contextually relevant.
The portability of agents as markdown files means you can easily version control them, share with teammates, or even publish your custom agents for broader use in the developer community. This modularity also encourages experimentation and continuous improvement.
Potential Use Case Scenarios
- Backend Agents: With database access and log reading capabilities, backend agents can monitor infrastructure health, optimize queries, or automate deployment scripts.
- Front-end Agents: Specialized in UI frameworks and styling, these agents can rapidly prototype components or refactor legacy codebases.
- Documentation Retrieval Agents: For new or niche technologies not well covered in the LLM training data, agents can fetch up-to-date documentation and tutorials via MCP tools.
- Cross-Functional Agents: Integrate agents that handle project management tasks, notifications, or customer support using external APIs and MCP servers.
Getting Started with Your Own Sub Agents
To start building your own sub agents today, follow these practical tips:
- Identify key workflows: Pinpoint repetitive or time-consuming tasks in your development process that could benefit from automation or specialized assistance.
- Define agent roles: Create clear roles for your agents, such as code reviewer, tester, UI designer, or researcher.
- Configure tools carefully: Grant only the necessary permissions and tools to each agent to maintain security and relevance.
- Iterate system prompts: Customize your agents’ behavior by refining system prompts to match your coding style and project requirements.
- Leverage MCP integrations: Connect your agents to external services to expand their capabilities beyond code manipulation.
Remember, the key to success with sub agents is experimentation. Start small, observe how agents perform, and gradually build a tailored AI team that fits your unique workflow.
Frequently Asked Questions (FAQ)
What is the main advantage of using sub agents in Claude Code?
Sub agents allow you to create specialized AI assistants that focus on specific areas of your development workflow, improving efficiency and enabling better delegation of complex tasks.
Can I create agents that work across multiple projects?
Yes, you can configure agents to be globally accessible on your machine, allowing you to use them across different projects.
What tools can I assign to my sub agents?
You can assign core Cloud Code functions such as file reading, editing, and directory listing, as well as any connected MCP servers that provide additional capabilities like web scraping, database querying, or API integrations.
How do system prompts affect agent behavior?
System prompts define the agent’s personality, coding style preferences, and operational biases, allowing you to tailor how the agent interacts and what it prioritizes.
Are sub agents portable and shareable?
Yes, agent configurations are stored as markdown files within a hidden directory, making them easy to version control, share with teammates, or reuse in different projects.
Can sub agents handle non-coding tasks?
Absolutely. With MCP integrations, sub agents can interact with external services like Gmail, project management tools, or design platforms, expanding their utility beyond coding.
Conclusion
Anthropic’s introduction of sub agents for Claude Code marks a significant leap forward in AI-assisted development. By enabling developers to create specialized, context-aware AI agents with tailored toolsets and system prompts, it opens the door to building a powerful AI-driven mini workforce. This approach not only streamlines complex workflows like code reviews, debugging, and research but also integrates seamlessly with external services, making your AI assistants more versatile than ever.
Whether you’re building a simple front-end component or orchestrating a full SaaS landing page with live data integration, sub agents offer a flexible, scalable solution to boost productivity and creativity. The markdown-based configuration files ensure portability and easy collaboration, while the ability to update agents dynamically through Claude’s chat interface enhances developer experience.
Start exploring sub agents today by identifying key areas in your workflow that could benefit from dedicated AI support. Customize your agents’ tools, permissions, and behavior, and watch as your AI team transforms the way you develop software.
What kinds of agents will you build? Share your ideas and experiences as you dive into this exciting new frontier of AI-powered development!