Claude Code Sub Agents in Practice: Reproducing Kiro's Spec-Driven Development Workflow in Three Minutes

Claude Code's Sub Agents enable spec-driven AI programming workflows that reproduce and outperform Kiro IDE.
Claude Code's latest Sub Agents feature runs each sub-agent in an independent sandbox with its own context window, enabling task specialization and modularization. By building three specialized Agents — Project Architect, Software Planner, and Software Engineer — you can fully reproduce Kiro IDE's Spec-Driven development workflow with higher execution efficiency. This marks a paradigm shift from improvisational Vibe Coding to structured, spec-driven AI development.
The latest version of Claude Code introduces a groundbreaking feature — Sub Agents. This capability transforms Claude Code from a mere AI coding tool into a fully-featured AI agent platform. Even more exciting, with Sub Agents, we can perfectly reproduce the Spec-Driven AI programming workflow from the recently hyped Kiro IDE — and the actual experience is significantly faster than Kiro, which hasn't even officially launched yet.
What Are Sub Agents? Isolated Sandboxes and Task Specialization
The core philosophy of Sub Agents is task specialization and modularization. Think of it as an expert team — each member has their own expertise and is responsible for a specific domain.
The most critical technical characteristic is that each sub-agent runs in an independent sandbox environment with its own context window. This means a sub-agent's context won't pollute the main conversation's context, allowing the main conversation to stay focused on higher-level task orchestration without being cluttered by sub-task details.
To understand why this design matters, some technical background is helpful. A Sandbox is a security isolation mechanism originally used widely in operating systems and browsers to confine untrusted code within controlled environments. In the AI Agent context, sandboxing means each sub-agent has its own independent runtime environment and memory space, with no state interference between them. The Context Window is one of the core limitations of large language models, referring to the maximum number of tokens a model can process in a single inference. Current mainstream models like Claude have a context window of 200K tokens, but as conversations deepen, the context fills with historical information, reducing the model's attention to new information — this is the so-called "context pollution" problem. Sub Agents fundamentally solve this by allocating an independent context window to each sub-agent: the main conversation maintains a streamlined task orchestration perspective, while sub-agents handle specific details within their own contexts, returning only result summaries to the main conversation upon completion.

The core advantages of Sub Agents include:
- Single Responsibility Principle: Each Agent focuses on one specific domain, such as code review, documentation generation, or architecture design
- Cross-Project Reuse: Created Agents can be shared across different projects and distributed uniformly within teams
- Security Control: You can precisely limit the tools each sub-agent can access, implementing the principle of least privilege
- MCP Tool Support: Full support for MCP protocol tool invocation, making extensibility virtually unlimited
- Version Control Friendly: Agent configurations are stored as files, naturally supporting Git version management
The Single Responsibility Principle (SRP) is the first of the five SOLID principles in object-oriented design, proposed by Robert C. Martin. Its core idea is that "a module should have one, and only one, reason to change." Applying this principle to AI Agent design means each sub-agent is responsible for only one clearly defined task domain, avoiding the bloated prompts and unpredictable behavior that come with "omnipotent Agents." The Principle of Least Privilege originates from information security, requiring that every subject in a system be granted only the minimum set of permissions needed to complete its task. In the Sub Agents context, an Agent responsible for code review shouldn't have file write permissions, and an Agent responsible for documentation generation doesn't need database access. The combination of these two principles ensures that the Sub Agents system remains controllable and secure while being powerful — especially important for enterprise-level application scenarios.
Regarding MCP (Model Context Protocol), this is an open standard protocol introduced by Anthropic in late 2024, designed to provide large language models with a unified way to connect to external data sources and tools. Think of MCP as the "USB-C port" of the AI world — before MCP, every AI application needing to integrate with different external tools (databases, APIs, file systems, etc.) required custom integration code, leading to massive duplication and compatibility issues. MCP uses a client-server architecture: AI applications act as MCP clients making requests, while various tools and data sources expose their capabilities through MCP servers. The MCP ecosystem currently covers hundreds of commonly used tools including GitHub, Slack, PostgreSQL, Puppeteer, and more. Sub Agents' full support for MCP means each sub-agent can flexibly invoke these external capabilities, dramatically expanding the boundaries of automation.
Getting Started: Creating Your First Sub Agent
Using Sub Agents is straightforward. First, make sure you have the latest version of Claude Code installed, then open Claude Code in VS Code with Cmd + Esc and type /agents to enter the sub-agent management interface.
Method 1: Auto-Generate Agent Configuration
Claude Code supports automatically generating Agent configurations from natural language descriptions. For example, entering "Create an Agent that can generate product requirement documents" will automatically produce a complete name, description, system prompt, and tool configuration.

The generated Agent is saved as a configuration file in your project directory. Afterward, simply invoke it — for instance, typing "Use PRD Generator to write a PRD document for an e-commerce App" — to receive a well-structured, comprehensive product requirements document.
Method 2: Manual Agent Creation
For scenarios requiring precise control, you can also create Agents manually. Manual creation requires specifying:
- Agent Name: e.g., "Code Review Expert"
- System Prompt: Defining role, objectives, and workflow
- Tool Permissions: Selecting the tool set available to this Agent
- Scope: Project-level or global-level
Reproducing Kiro's Spec-Driven Development Workflow
Amazon's Kiro IDE has attracted widespread attention for its spec-driven approach to AI programming, but since it hasn't officially launched yet, actual response times are extremely slow. With Claude Code's Sub Agents, we can fully reproduce this workflow with even higher execution efficiency.
Kiro is an AI-native IDE launched by Amazon AWS in mid-2025. Its core concept of "Spec-Driven Development" isn't entirely new — it's an AI-era reinterpretation of the classic "waterfall model" and "design-first" philosophy in software engineering. In traditional software development, large projects typically go through requirements analysis, high-level design, detailed design, coding implementation, and testing verification stages, each producing corresponding specification documents. However, as agile development gained popularity, many teams gradually de-emphasized the importance of upfront documentation. The emergence of AI programming tools has made this problem even more pronounced — when developers describe requirements in natural language and let AI generate code directly, the lack of intermediate specification documents causes AI's misunderstandings of requirements to compound throughout subsequent development. Kiro's innovation lies in delegating specification document generation to AI as well, forming a closed loop of "AI generates specs → humans review specs → AI codes according to specs," balancing efficiency and quality.
The Complete Execution Flow of Kiro's Spec-Driven Development
Kiro's workflow is divided into two major phases:
Planning Phase:
- Project Initialization: Analyze existing codebase, generate project rules file, product vision, tech stack structure, etc.
- Feature Requirements Definition: User role story analysis, generate requirements specification file
- Technical Architecture Design: Component structure design, generate architecture document
- Task Decomposition: Dependency ordering, generate execution checklist
Execution Phase:
- Strictly follow specifications to write and modify code
- Real-time updates to task status files

Building the Three Core Sub Agents
To reproduce this Kiro workflow with Claude Code, we need to create three specialized Sub Agents:
Agent 1: Project Guide Architect
- Role: AI Project Analyst + Documentation Architect
- Responsibilities: Analyze project and create guidance files, including project structure, tech stack configuration, and other foundational documents
- Workflow: Analyze existing code → Initialize project files → Interactive confirmation of details
Agent 2: Expert Software Architect + Collaborative Planner
- Responsibilities: Feature planning, requirements analysis, task decomposition
- Output: Three core files — requirements document, architecture document, and task checklist
Agent 3: Software Engineer
- Responsibilities: Execute coding strictly according to the task checklist, step by step
- Characteristics: Focused on code implementation, following the specification documents produced by the first two Agents
The collaboration model of these three Agents is essentially a Pipeline Architecture: each Agent's output becomes the next Agent's input, forming a progressive refinement process from abstract to concrete. This design aligns with the separation of concerns philosophy in microservices architecture, ensuring that each stage's output quality can be independently verified and adjusted.
Hands-On Demo: Building a TodoList App with Sub Agents
Using a TodoList project as an example, here's the complete spec-driven development workflow:
Step 1: Invoke the Project Guide Architect
After entering the prompt, the Agent automatically analyzes the project environment and creates project guidance files, including project structure definitions and tech stack configuration.

Step 2: Invoke the Software Architect for Feature Planning
This Agent invokes multiple tools and generates complete feature planning for the TodoList, including three files: requirements document, architecture document, and task checklist.
Step 3: Invoke the Software Engineer to Execute Coding Tasks
The third Agent strictly follows the task checklist step by step, ultimately generating the complete project code. The final TodoList application is fully functional, supporting:
- Task addition with priority settings
- Task completion status toggling
- Task editing and deletion
- Pending/completed task categorized display
The entire process from requirements to code output has corresponding specification documents as the basis for every step — this is the core value of Spec-Driven development.
The Paradigm Shift from Vibe Coding to Spec-Driven Development
The emergence of Sub Agents marks an important paradigm shift in AI programming. Traditional Vibe Coding (improvisational AI programming) has a low barrier to entry and is quick to get started with, but often becomes unmaintainable as project complexity grows.
The concept of Vibe Coding was coined by OpenAI co-founder Andrej Karpathy in early 2025. He described it as a programming approach where you "fully surrender to the vibes, embrace exponentials, and forget that the code even exists." In Vibe Coding mode, developers only need to describe desired functionality in natural language, and AI tools (such as Cursor, GitHub Copilot, Claude Code, etc.) directly generate code — developers don't even need to fully understand the generated code to run the project. This approach dramatically lowers the programming barrier, enabling non-professional developers to quickly build prototypes. However, Vibe Coding's limitations have gradually become apparent in real engineering: generated code lacks unified architecture, different modules have inconsistent styles, systematic refactoring is difficult, and technical debt accumulates rapidly. When projects exceed a few thousand lines of code, AI generating new code without global specification guidance often conflicts with existing code, causing frequent bugs. This is precisely the core pain point that spec-driven development aims to solve.
The spec-driven development approach, through its structured process of plan first, execute second, delivers significant engineering advantages:
- Consistency: All code follows unified architectural specifications
- Traceability: Every step from requirements to implementation is documented
- Maintainability: Clear task decomposition makes subsequent iterations more controllable
- Team Collaboration: Standardized workflows enable seamless handoffs between team members
Claude Code's Sub Agents not only make this spec-driven workflow possible but also ensure the security and reliability of the entire process through mechanisms like independent sandboxes and tool permission controls. For development teams pursuing engineering quality, this is undoubtedly a direction worth exploring in depth.
Key Takeaways
- Claude Code's new Sub Agents feature runs each sub-agent in an independent sandbox with its own context window, enabling task specialization and modularization
- Sub Agents support cross-project reuse, team sharing, tool permission control, and MCP protocol, configurable via auto-generation or manual creation
- By building three specialized Agents (Project Architect, Software Planner, Software Engineer), you can fully reproduce Kiro's Spec-Driven development workflow
- Spec-driven development follows a structured "plan first, execute second" process, sequentially completing project initialization, feature planning, task decomposition, and code execution
- The emergence of Sub Agents marks a paradigm shift in AI programming from Vibe Coding to structured spec-driven development, significantly improving code consistency and maintainability
Related articles
TutorialsChatGPT Plus Subscription Guide: Are GPT-5.5, image-2, and Codex Worth the Upgrade?
A detailed look at ChatGPT Plus features — GPT-5.5, image-2, and Codex — with a Plus vs Pro comparison and a complete step-by-step subscription guide for users outside the US.
TutorialsHarness AI Engineering in Practice: Using Claude Code to Master Enterprise-Level E-Commerce Development
Deep dive into Harness AI Engineering: master enterprise e-commerce development with Claude Code using the Rules, Skills, Wiki, and Changes framework.
TutorialsCursor + Codex Dual-IDE Collaboration: A Practical Methodology for Open-Source Project Customization
A complete methodology for open-source project customization based on real-world experience, detailing the Cursor+Codex dual-IDE workflow, seven-stage process, MVP validation, and AI source code reading techniques.