Transform how you build web applications with intelligent agent orchestration and human-in-the-loop development
The Subagent Context Engineering Workflow revolutionizes web application development by combining the power of context engineering with Claude Code's intelligent subagent capabilities. This workflow emphasizes rapid prototyping with systematic testing checkpoints, clean code practices, and specialized agent orchestration to deliver production-ready applications faster than traditional development approaches.
Traditional development often falls into these traps:
- Over-engineering before validation - Building complex features before user testing
- Context loss between sessions - Losing project understanding across development cycles
- Inconsistent patterns - Code quality degrading as projects grow
- Deployment complexity - Manual, error-prone deployment processes
- Siloed development - Different aspects of the project developed in isolation
This workflow solves these problems through:
- Structured context management - AI agents maintain comprehensive project understanding
- Incremental development gates - Human testing checkpoints prevent over-building
- Specialized agent teams - Project-specific AI agents handle complex coordination
- Automated deployment orchestration - Multi-service deployments made simple
- 60% Faster Development - Parallel agent execution and automated coordination
- Higher Code Quality - Built-in clean code practices and refactoring workflows
- Reduced Technical Debt - Continuous cleanup and pattern enforcement
- Simplified Deployments - Automated multi-service deployment management
- Better Testing Coverage - Human-in-the-loop testing at every checkpoint
- Enhanced Team Coordination - Clear context sharing and decision documentation
- Claude Code installed and configured
- Node.js 18+ (for web projects)
- Git for version control
-
Clone the workflow into your project:
git clone https://github.com/yourusername/subagent-context-engineering-workflow.git .claude cd your-project -
Initialize from your PRD (Product Requirements Document):
claude chat > /init-from-prd your-prd.mdThe system will analyze your PRD, generate a Project Requirements Plan (PRP), create specialized agents, and prepare your development environment.
-
Start building incrementally:
> /prototype-feature "User Authentication" > /test-checkpoint > /prototype-feature "Dashboard Interface" > /test-checkpoint
# Day 1: Complete AI SaaS Application
> /init-from-prd ai-analytics-prd.md
# Auto-creates: ai-integration, payment-processor, auth-specialist agents
> /prototype-feature "Magic link authentication"
> /test-checkpoint
# ✅ Test: Users can log in via email
> /prototype-feature "AI data analysis interface"
> /test-checkpoint
# ✅ Test: Users can upload CSV and get insights
> /prototype-feature "Stripe subscription billing"
> /test-checkpoint
# ✅ Test: Payment flow works end-to-end
> /deploy-check vercel,railway
# 🚀 Live application in productionBuild incrementally with mandatory testing gates. Never build more than 45 minutes worth of features without human validation.
The system analyzes your PRD and automatically generates project-specific AI agents. A real-time collaboration app gets WebSocket specialists; an e-commerce platform gets payment and inventory agents.
Agents prioritize simplicity, maintainability, and consistent patterns. Technical debt is addressed continuously, not accumulated.
Use the task tool to run multiple specialized agents simultaneously:
task "Frontend: Build login UI" frontend-dev
task "Backend: Create auth API" backend-dev
task "Database: User schema" database-engEach agent maintains specialized knowledge while sharing project understanding through structured context files.
project-root/
├── .claude/
│ ├── claude.md # Master context (auto-updated)
│ ├── subagents.md # Dynamic agent registry
│ ├── commands/
│ │ ├── init-from-prd.md # PRD → PRP → Project setup
│ │ ├── prototype-feature.md # Rapid feature prototyping
│ │ ├── test-checkpoint.md # Human testing workflow
│ │ ├── refactor-clean.md # Code cleanup passes
│ │ ├── add-feature.md # Adding features to existing project
│ │ ├── deploy-check.md # Pre-deployment validation
│ │ └── migrate-to-workflow.md # Adopt workflow in existing projects
│ ├── agents/
│ │ ├── core/ # Always-present agents
│ │ │ ├── prd-analyzer.md # Converts PRD to PRP
│ │ │ ├── architect.md # System design
│ │ │ ├── prototype-lead.md # Rapid prototyping coordinator
│ │ │ ├── test-coordinator.md # Human test management
│ │ │ ├── context-keeper.md # Maintains context accuracy
│ │ │ └── deploy-manager.md # Deployment orchestration
│ │ └── project/ # Project-specific agents (auto-generated)
│ │ ├── websocket-specialist.md # Real-time features
│ │ ├── payment-integration.md # Stripe/payment processing
│ │ ├── ai-integration.md # LLM features
│ │ └── email-automation.md # Email sequences
│ └── context/
│ ├── prp.md # Project Requirements Plan
│ ├── current-state.md # What's built so far
│ ├── test-results.md # Human testing feedback
│ ├── tech-decisions.md # Architecture choices
│ └── deployment-status.md # Current deployment info
├── README.md # Your project's README
└── [your project files]
PRD Analyzer - Converts business requirements into technical specifications
- Analyzes Product Requirements Documents
- Generates comprehensive Project Requirements Plans (PRPs)
- Identifies needed specialized agents based on project complexity
- Defines testable milestones and success criteria
Architect - Designs system architecture and maintains technical consistency
- Creates system architecture diagrams
- Defines API contracts and data models
- Makes technology stack decisions with documented rationale
- Ensures pattern consistency across the application
Prototype Lead - Rapid feature development with clean code practices
- Breaks features into 30-45 minute development chunks
- Implements with clean, testable code from the start
- Manages parallel development coordination
- Prepares clear test scenarios for human validation
Test Coordinator - Manages human testing checkpoints
- Generates comprehensive test scenarios
- Creates visual test guides and documentation
- Processes human feedback into actionable tasks
- Maintains testing history and issue tracking
Context Keeper - Maintains project context accuracy in real-time
- Updates context files automatically after each development cycle
- Identifies and resolves context contradictions
- Archives outdated decisions appropriately
- Ensures single source of truth across all project documentation
Deploy Manager - Orchestrates complex multi-service deployments
- Manages deployment across Railway, Vercel, Supabase, and custom platforms
- Coordinates environment variables and service dependencies
- Handles deployment sequencing for interdependent services
- Provides rollback capabilities and deployment monitoring
Based on your PRD analysis, the system creates specialized agents:
- WebSocket Specialist - Real-time features, live collaboration, chat systems
- Payment Integration - Stripe, PayPal, subscription management, billing
- AI Integration - OpenAI, Anthropic, local LLMs, prompt engineering
- Email Automation - Transactional emails, sequences, template management
- Database Migration - Schema changes, data migrations, optimization
- Security Auditor - Security reviews, vulnerability scanning, compliance
- Performance Optimizer - Code optimization, caching, monitoring
Initialize a new project from a Product Requirements Document.
> /init-from-prd startup-idea-prd.mdProcess:
- Analyzes PRD for technical requirements
- Generates comprehensive PRP with milestones
- Creates project-specific agents
- Sets up file structure and git repository
- Prepares for first prototype iteration
Rapidly prototype a feature with automatic testing checkpoints.
> /prototype-feature "Real-time chat with message history"Process:
- Breaks feature into testable 30-45 minute chunks
- Coordinates parallel agent execution
- Implements with clean code practices
- Updates project context automatically
- Generates test scenarios for human validation
Generate test scenarios and coordinate human testing.
> /test-checkpointOutput:
- Specific test scenarios with expected behaviors
- Easy-to-follow testing instructions
- Visual guides for UI testing
- Clear success/failure criteria
- Quick-fix options for common issues
Clean up and refactor code while maintaining functionality.
> /refactor-clean "authentication system"Process:
- Analyzes code for improvement opportunities
- Removes duplication and improves naming
- Extracts common patterns into reusable components
- Enhances error handling and documentation
- Validates changes don't break functionality
Validate and deploy to specified platforms.
> /deploy-check vercel,railway,supabaseMulti-Service Coordination:
- Determines optimal deployment sequence
- Manages environment variables across services
- Coordinates database migrations
- Runs integration tests
- Provides rollback capabilities
Add new features to existing projects.
> /add-feature "Social media sharing with analytics"Adopt this workflow in existing projects.
> /migrate-to-workflowAnalyzes existing codebase and creates appropriate context structure.
PRD → PRP → Specialized Agents → Prototype → Test → Refactor → Deploy
↑ ↓
←────────────── Add New Features ←──────────────────────────
-
Project Initialization
- Write comprehensive PRD with business objectives
- Run
/init-from-prdto generate PRP and agents - Review generated architecture and milestones
-
Feature Development
- Select next feature from PRP milestones
- Run
/prototype-featurefor rapid implementation - Agents work in parallel on different aspects
- Code remains clean and well-documented
-
Human Testing
- Automatic test checkpoint after each feature
- Clear test scenarios and success criteria
- Human provides feedback and reports issues
- System generates fix tasks from feedback
-
Continuous Refinement
- Regular
/refactor-cleanpasses - Update documentation and context
- Address technical debt incrementally
- Maintain code quality standards
- Regular
-
Deployment
- Run
/deploy-checkfor comprehensive validation - Automated multi-service deployment coordination
- Post-deployment monitoring and verification
- Rollback capabilities if issues arise
- Run
# Good PRD Structure
## Business Objectives
- Clear success metrics
- Target user personas
- Revenue/growth goals
## Functional Requirements
- Detailed user flows
- Feature specifications
- Integration requirements
## Technical Constraints
- Performance requirements
- Security considerations
- Scalability needs
## Success Criteria
- Measurable outcomes
- Testing requirements
- Launch criteria- Never skip checkpoints - Each test prevents costly rework
- Test early and often - Small iterations catch issues quickly
- Document everything - Issues become learning opportunities
- Fix before continuing - Technical debt compounds quickly
# Effective parallel execution
task "Build user interface" frontend-dev
task "Create API endpoints" backend-dev
task "Design email templates" email-specialist
task "Set up monitoring" ops-engineer
# Avoid dependencies in parallel tasks
# Bad: Frontend needs API to be complete first
# Good: Independent tasks that can merge later- Let agents update context automatically
- Review context files weekly for accuracy
- Archive outdated decisions with timestamps
- Maintain clear documentation standards
- Small features (30-45 minutes of work)
- Quick testing cycles (immediate feedback)
- Rapid iteration based on results
- Continuous deployment and monitoring
Project: SaaS analytics platform with AI insights Timeline: 3 days from PRD to production
# Day 1: Core Setup
> /init-from-prd ai-analytics-prd.md
# Generated agents: ai-integration, payment-processor, auth-specialist
> /prototype-feature "User authentication with magic links"
> /test-checkpoint
# ✅ Users can register and log in
> /prototype-feature "CSV upload and parsing"
> /test-checkpoint
# ✅ Users can upload data files
# Day 2: AI Features
> /prototype-feature "AI-powered data insights"
# Parallel execution:
task "OpenAI integration" ai-integration
task "Data visualization" frontend-dev
task "Insight generation API" backend-dev
> /test-checkpoint
# ✅ AI generates meaningful insights from data
# Day 3: Monetization & Deploy
> /prototype-feature "Stripe subscription billing"
> /test-checkpoint
# ✅ Payment flow works end-to-end
> /deploy-check vercel,railway
# 🚀 Production deployment successfulProject: Document collaboration with live editing Timeline: 4 days with complex WebSocket coordination
# Setup with specialized agents
> /init-from-prd collab-platform-prd.md
# Generated: websocket-specialist, conflict-resolver, sync-manager
# Parallel development of complex real-time features
> /prototype-feature "Real-time document editing"
task "WebSocket server with rooms" websocket-specialist
task "Conflict-free data types" conflict-resolver
task "React collaboration hooks" frontend-dev
task "Document persistence" database-eng
> /test-checkpoint
# ✅ Multiple users can edit simultaneously without conflictsProject: Multi-vendor marketplace with complex workflows Timeline: 1 week for MVP
# Complex multi-service architecture
> /init-from-prd marketplace-prd.md
# Generated: payment-integration, inventory-manager, order-processor,
# email-automation, shipping-calculator, vendor-portal
# Systematic feature development
> /prototype-feature "Vendor onboarding workflow"
> /test-checkpoint
> /prototype-feature "Product catalog with advanced search"
> /test-checkpoint
> /prototype-feature "Multi-vendor cart and checkout"
> /test-checkpoint
> /prototype-feature "Order management and fulfillment"
> /test-checkpoint
# Complex deployment coordination
> /deploy-check railway,vercel,supabase,stripe,sendgrid
# Coordinates deployment across 5 different services# Check available agents
> task "List all agents" context-keeper
# Regenerate missing agents
> /init-from-prd [original-prd].md
# Manually create specific agent if needed# Validate and fix context
> task "Resolve context conflicts" context-keeper
# Force context rebuild
> task "Rebuild all context" context-keeper# Check deployment status
> task "Deployment health check" deploy-manager
# Review environment configuration
> task "Validate all env vars" deploy-manager
# Emergency rollback
> /rollback --to-checkpoint [number]- Provide more specific acceptance criteria in PRD
- Include visual mockups for UI features
- Add edge cases and error scenarios
- Request step-by-step testing instructions
# System health check
> task "Complete system analysis" architect
# Agent status verification
> task "Validate all agents and context" context-keeper
# Performance analysis
> task "Identify bottlenecks" performance-optimizer
# Security audit
> task "Security vulnerability scan" security-auditorCreate project-specific agents for unique requirements:
# .claude/agents/project/blockchain-integration.md
You are a blockchain integration specialist for Web3 applications.
## Your Context
- Access: /prp.md, /tech-decisions.md, /current-state.md
- Update: /tech-decisions.md, /blockchain-status.md
## Responsibilities
1. Smart contract deployment and interaction
2. Wallet integration (MetaMask, WalletConnect)
3. Gas optimization strategies
4. Web3 security best practices
5. DeFi protocol integrations
## Integration Patterns
- Use ethers.js for Ethereum interactions
- Implement proper error handling for network issues
- Cache blockchain data appropriately
- Handle wallet connection states gracefullyFor complex projects spanning multiple repositories:
# Initialize each service with shared context
> /init-from-prd microservice-prd.md --service frontend
> /init-from-prd microservice-prd.md --service backend
> /init-from-prd microservice-prd.md --service auth-service
# Coordinate cross-service features
> /prototype-feature "Cross-service user authentication" --services frontend,backend,auth-serviceExtend deployment support for custom platforms:
# .claude/agents/project/custom-deploy.md
You manage deployments to custom Kubernetes clusters.
## Deployment Process
1. Build Docker images with proper tags
2. Update Kubernetes manifests
3. Apply rolling updates
4. Verify health checks
5. Update ingress routingWe welcome contributions to improve this workflow! Here's how to get involved:
- Fork the repository and create a feature branch
- Test your changes thoroughly with real projects
- Update documentation for any new features
- Add examples demonstrating new capabilities
- Submit a pull request with clear description
- New core agents for common development patterns
- Platform integrations for additional deployment targets
- Command improvements for better developer experience
- Documentation enhancements with more examples
- Testing frameworks for agent behavior validation
- Create agent file in
.claude/agents/core/ - Define clear responsibilities and context access
- Add agent to subagents registry
- Update documentation with usage examples
- Test with multiple project types
- Create command file in
.claude/commands/ - Define clear process with error handling
- Add comprehensive examples
- Update command reference documentation
- Test edge cases and failure scenarios
This workflow is inspired by and builds upon the excellent context engineering patterns introduced by Cole Medin in context-engineering-intro. We've extended these concepts to create a comprehensive development workflow specifically designed for Claude Code's capabilities.
- Context Engineering Principles - Structured AI context management
- Human-in-the-Loop Development - Systematic testing checkpoints
- Agent-Based Architecture - Specialized AI agents for complex tasks
- Modern DevOps Practices - Automated deployment and monitoring
- Claude Code Documentation - Official Claude Code guide
- Context Engineering Introduction - Original context engineering patterns
- Anthropic Developer Console - API keys and usage monitoring
- Claude Model Documentation - Understanding Claude's capabilities
- Video Tutorials - Coming soon on YouTube
- Blog Posts - Development workflow deep-dives
- Case Studies - Real-world project examples
- Community Forum - Questions and best practices
- Vercel Deployment - Frontend and full-stack applications
- Railway Deployment - Backend services and databases
- Supabase Integration - Authentication, database, and real-time features
- Stripe Integration - Payment processing and subscription management
This project is licensed under the MIT License - see the LICENSE file for details.
- ✅ Commercial use allowed
- ✅ Modification and distribution permitted
- ✅ Private use encouraged
⚠️ No warranty provided⚠️ Authors not liable for any damages
/init-from-prd [prd.md] # Start new project from PRD
/prototype-feature "[name]" # Build feature incrementally
/test-checkpoint # Human testing checkpoint
/refactor-clean "[area]" # Clean up code
/deploy-check [platforms] # Deploy application
/add-feature "[description]" # Add to existing project
/migrate-to-workflow # Convert existing projectprd-analyzer- PRD → PRP conversionarchitect- System design and architectureprototype-lead- Rapid feature developmenttest-coordinator- Human testing managementdeploy-manager- Multi-service deploymentcontext-keeper- Context accuracy maintenance
- Test early, test often - Human validation at every checkpoint
- Keep it clean - Code quality from day one
- Build incrementally - Small features, quick iterations
- Document decisions - Context-aware development
- Deploy confidently - Automated validation and rollback
Ready to transform your development workflow? Start with a simple PRD and watch the agents coordinate to build your application faster than ever before.