Design and implement a new feature with parallel best-practice research, codebase exploration, architectural planning, atomic phase specs, phase-by-phase code review, and automated documentation
Executes comprehensive feature development with context-aware research, codebase exploration, and phased implementation.
/plugin marketplace add RoniLeor/specWeaver/plugin install specweaver@specweaverYou are orchestrating a comprehensive feature development workflow with multi-agent collaboration. Follow this structured process:
IMPORTANT: This phase runs FIRST to understand the codebase context before researching solutions.
Step -1.1: Launch Parallel Research Agents
Use multiple web search tools IN PARALLEL (single message with 4 tool calls) to research:
Language Best Practices (Python + TypeScript for this project):
SOLID Design Principles (Keep It Simple):
Feature Design Patterns (Simplicity First):
Domain-Specific Patterns (based on $ARGUMENTS):
Step -1.2: Synthesize Research Findings
After ALL 4 parallel searches complete, synthesize the findings:
Create: .claude/specs/new-{feature-name}/00-research.md
# Best Practices Research: {feature-name}
**Research Date**: {date}
**Feature Domain**: {domain extracted from $ARGUMENTS}
## Language Best Practices
### Python
- [Key practices found from search 1]
- [Relevant async patterns]
- [Type hint best practices]
### TypeScript/React
- [Key practices found from search 1]
- [Modern React patterns]
- [TypeScript strict mode practices]
## SOLID Design Principles Application
### Single Responsibility
- [How to apply to this feature]
- [Examples from search]
### Open/Closed Principle
- [How to design for extension]
- [Plugin/strategy patterns]
### [Other SOLID principles...]
## Feature Design Patterns
### Applicable Patterns
- [Pattern 1: description and when to use]
- [Pattern 2: description and when to use]
- [Anti-patterns to avoid]
### Modularity Considerations
- [How to isolate this feature]
- [Dependency injection points]
- [Testing strategies]
## Domain-Specific Patterns
### {Domain} Best Practices
- [Domain-specific patterns from search 4]
- [Performance considerations]
- [Security considerations]
- [Common pitfalls in this domain]
## Recommendations for {feature-name}
Based on research, this feature should:
1. [Specific recommendation 1 based on SOLID + language practices]
2. [Specific recommendation 2 based on feature patterns]
3. [Specific recommendation 3 based on domain patterns]
4. [Anti-patterns to explicitly avoid]
## References
- [Links to key resources found]
Step -1.3: Present Research Summary
Present a brief summary to the user:
BEST PRACTICES RESEARCH COMPLETE
Researched:
Python + TypeScript best practices (2025)
SOLID design principles application
Feature design patterns (modularity, testability)
{Domain}-specific patterns and anti-patterns
Key Recommendations:
- [Top 3 recommendations for this feature]
Full research saved to: .claude/specs/new-{feature-name}/00-research.md
This research will inform the architecture design in the next phase.
Step 0.1: Invoke Code Explorer
Use the Task tool with subagent_type=code-explorer to analyze the existing codebase for features that might connect with: $ARGUMENTS
The code-explorer should:
/docs folder for relevant documentation that relates to or connects with this feature:
/docs/backend/systems/ for system documentation/docs/backend/guides/ for implementation guides/docs/frontend/ for frontend-related docs/docs/architecture.md for architectural patternsStep 0.2: Create Exploration Report
After receiving the code-explorer's analysis:
.claude/specs/new-{feature-name}/.claude/specs/new-{feature-name}/01-exploration.mdThe exploration report should include:
/docs that relates to this feature (with file paths)Step 0.3: Extract Domain Context
After exploration complete, analyze the feature requirements and codebase context to extract:
Append domain context to 01-exploration.md:
## Domain Analysis
**Feature Domain**: {extracted domain from $ARGUMENTS and codebase}
**Technology Stack**: {relevant stack from exploration}
**Existing Patterns**: {patterns found in similar features}
**Integration Complexity**: {Low/Medium/High based on integration points}
IMPORTANT: This phase runs AFTER exploration to ensure research is informed by codebase context.
Step 1.1: Launch Context-Aware Parallel Research
Use multiple web search tools IN PARALLEL (single message with 4 tool calls) to research solutions based on the domain and codebase context from exploration:
Language Best Practices (Python + TypeScript for this project):
SOLID Design Principles (Keep It Simple):
Feature Design Patterns (Simplicity First):
Domain-Specific Patterns (based on domain analysis from exploration):
Step 1.2: Synthesize Research Findings with Codebase Context
After ALL 4 parallel searches complete, synthesize the findings WITH codebase context:
Create: .claude/specs/new-{feature-name}/02-research.md
# Best Practices Research: {feature-name}
**Research Date**: {date}
**Feature Domain**: {domain from exploration Step 0.3}
**Codebase Context**: Based on exploration of related features
## Codebase Integration Context
**Related Features**: {from exploration}
**Existing Patterns**: {patterns from codebase}
**Technology Stack**: {from exploration}
**Integration Points**: {from exploration}
## Language Best Practices
### Python
- [Key practices found from search 1]
- [Relevant async patterns]
- [Type hint best practices]
- **How this applies to our codebase**: {specific to existing patterns}
### TypeScript/React
- [Key practices found from search 1]
- [Modern React patterns]
- [TypeScript strict mode practices]
- **How this applies to our codebase**: {specific to existing patterns}
## SOLID Design Principles Application
### Single Responsibility
- [How to apply to this feature]
- [Examples from search]
- **Codebase alignment**: {how this aligns with existing code}
### Open/Closed Principle
- [How to design for extension]
- [Plugin/strategy patterns]
- **Codebase alignment**: {how this aligns with existing code}
### [Other SOLID principles...]
## Feature Design Patterns
### Applicable Patterns
- [Pattern 1: description and when to use]
- [Pattern 2: description and when to use]
- [Anti-patterns to avoid]
- **Codebase consistency**: {ensure consistency with existing patterns}
### Modularity Considerations
- [How to isolate this feature]
- [Dependency injection points]
- [Testing strategies]
## Domain-Specific Patterns
### {Domain} Best Practices
- [Domain-specific patterns from search 4]
- [Performance considerations]
- [Security considerations]
- [Common pitfalls in this domain]
- **Integration with existing {domain} features**: {specific to our codebase}
## Recommendations for {feature-name}
Based on research AND codebase context:
1. [Specific recommendation 1 based on SOLID + language practices + existing patterns]
2. [Specific recommendation 2 based on feature patterns + integration points]
3. [Specific recommendation 3 based on domain patterns + similar features]
4. [Anti-patterns to explicitly avoid based on both research and codebase]
5. [How to maintain consistency with existing features from exploration]
## References
- [Links to key resources found]
Step 1.3: Present Research Summary
Present a brief summary to the user:
★ CONTEXT-AWARE RESEARCH COMPLETE
Codebase Context (from exploration):
✓ {N} related features analyzed
✓ Existing patterns: {list patterns}
✓ Integration points: {N} identified
✓ Domain: {domain}
Web Research (informed by codebase):
✓ Python + TypeScript best practices (2025)
✓ SOLID design principles application
✓ Feature design patterns (modularity, testability)
✓ {Domain}-specific patterns and anti-patterns
Key Recommendations:
- [Top 3 recommendations that integrate with existing codebase]
Full research saved to: .claude/specs/new-{feature-name}/02-research.md
This context-aware research will inform the architecture design in the next phase.
Step 2.1: Invoke Code Architect
Use the Task tool with subagent_type=code-architect to design the feature architecture for: $ARGUMENTS
IMPORTANT: Provide the code-architect with:
.claude/specs/new-{feature-name}/01-exploration.md (related features, integration points, codebase context).claude/specs/new-{feature-name}/02-research.md (best practices, SOLID, patterns - informed by codebase)The code-architect should design with full awareness of:
The code-architect should:
Step 2.2: Create Architecture Overview
After receiving initial analysis from code-architect:
.claude/specs/new-{feature-name}/03-overview.mdThe overview should include:
Step 2.3: Design Atomic Phases Incrementally (With User Approval Per Phase)
IMPORTANT: Design phases ONE AT A TIME with user approval after each phase design.
For EACH phase in the Build Sequence:
2.3.1 - Invoke code-architect for Single Phase Design
Use the Task tool with subagent_type=code-architect to design ONLY the current phase.
Provide context:
.claude/specs/new-{feature-name}/03-overview.md.claude/specs/new-{feature-name}/01-exploration.md (codebase context).claude/specs/new-{feature-name}/02-research.md (best practices)2.3.2 - Create Atomic Phase Spec
After receiving the phase design from code-architect:
Use the Write tool to save the atomic phase spec to: .claude/specs/new-{feature-name}/0{X}-phase-{phase-name}.md
Each atomic phase spec should include:
1.3.3 - Present Phase Design for Approval (CHECKPOINT)
Present the phase design to the user:
PHASE {X} DESIGN: {phase-name}
Objective: [What this phase accomplishes]
Files to Modify/Create:
- [List of files with brief descriptions]
Key Implementation Points:
- [Bullet points of critical changes]
Dependencies:
- [Previous phases this depends on]
Acceptance Criteria:
- [How to verify this phase works]
Spec saved to: .claude/specs/new-{feature-name}/0{X}-phase-{phase-name}.md
Does this phase design look correct? Should I proceed to design the next phase?
STOP and WAIT for user approval.
1.3.4 - Handle User Response
Step 1.4: Present Complete Architecture for Final Approval
After ALL atomic phase specs are designed and individually approved:
Present the complete architecture summary:
COMPLETE ARCHITECTURE DESIGN READY
Specifications Created:
- Exploration: .claude/specs/new-{feature-name}/01-exploration.md
- Overview: .claude/specs/new-{feature-name}/00-overview.md
- Phase 1 spec: 02-phase-{name}.md (approved)
- Phase 2 spec: 03-phase-{name}.md (approved)
- Phase 3 spec: 04-phase-{name}.md (approved)
- ... (all phases listed)
Implementation Plan:
[Summary of all phases in order]
All individual phases have been approved. Ready to proceed to design review phase.
WAIT FOR USER CONFIRMATION BEFORE CONTINUING TO DESIGN REVIEW.
Note: This phase reviews the DESIGN of each phase before implementation begins. code-reviewer checks if the architecture is sound, complete, and follows best practices.
Step 2.5.1: Check for Existing Design Review
Before starting design review, check if a design review already exists for this feature:
⚠️ CRITICAL - File Existence Checking:
[ -f filepath ]ls, ls -la, ls -l, or any ls variantstat, find, or other file inspection commandsls returns errors to stderr when file doesn't exist, causing noiseCheck for file: .claude/specs/new-{feature-name}/03-design-review.md
# CORRECT METHOD - Use bash test [ -f ... ]
if [ -f .claude/specs/new-{feature-name}/03-design-review.md ]; then
# Design review EXISTS
else
# Design review DOES NOT EXIST
fi
If design review EXISTS:
If design review DOES NOT EXIST:
Step 2.5.2: Invoke code-reviewer for Phase-by-Phase Design Review
IMPORTANT: Review the DESIGN of each phase sequentially, not the implementation.
For EACH atomic phase spec (in order):
Use the Task tool with subagent_type=code-reviewer to review the phase DESIGN.
Provide the code-reviewer with:
The phase spec path: .claude/specs/new-{feature-name}/0{X}-phase-{phase-name}.md
The overview spec: .claude/specs/new-{feature-name}/03-overview.md
The exploration report: .claude/specs/new-{feature-name}/01-exploration.md (codebase context)
The research report: .claude/specs/new-{feature-name}/02-research.md (best practices)
Previously reviewed phase specs (if any)
Existing design review (if updating)
Instruction: "Review the DESIGN of this phase specification (not implementation). Check for:
Only report high-confidence design issues (≥ 80). Focus on design flaws that would cause implementation problems."
Step 2.5.3: Aggregate Phase Design Reviews
After reviewing ALL phase designs, aggregate the findings:
Create or UPDATE: .claude/specs/new-{feature-name}/03-design-review.md
The design review should include:
# Design Review: {feature-name}
**Review Date**: {current-date}
**Reviewer**: code-reviewer
**Architecture Reviewed**: All phases (Phase 1 through Phase {N})
## Overall Architecture Assessment
[Summary of architecture quality, strengths, and concerns]
## Phase-by-Phase Review
### Phase 1: {phase-name}
**Spec**: 02-phase-{name}.md
**Status**: Approved | Minor Issues | Critical Issues
**Findings**:
- [Issue 1 with confidence score]
- [Issue 2 with confidence score]
- ...
**Recommendations**:
- [Specific actions to address issues]
---
### Phase 2: {phase-name}
[Same structure as Phase 1]
---
[Continue for all phases]
## Cross-Phase Analysis
[Any issues that span multiple phases or affect overall integration]
## High-Confidence Issues Summary (≥ 80)
[List of all issues with confidence ≥ 80 that MUST be addressed]
## Design Quality Score
- **Completeness**: [Score/10]
- **Architecture Alignment**: [Score/10]
- **Integration Clarity**: [Score/10]
- **Implementation Readiness**: [Score/10]
## Recommendation
**APPROVED**: Design is sound, ready for implementation
**APPROVED WITH NOTES**: Minor issues noted, but can proceed
**REVISIONS REQUIRED**: Critical issues must be addressed before implementation
Step 2.5.4: Handle Design Review Feedback (Update Loop)
If high-confidence issues found (≥ 80):
Present issues to user:
DESIGN REVIEW: Critical Issues Found
The code-reviewer found {N} high-confidence design issues:
Phase {X}: {phase-name}
- Issue: {description} (Confidence: {score})
- Impact: {why this matters}
- Fix: {recommended action}
[List all issues]
These design flaws should be fixed before implementation.
Should I update the affected phase specs?
WAIT FOR USER DECISION:
Update Loop:
00-design-review.md with new findingsIf no high-confidence issues (design approved):
00-design-review.md with approval status DESIGN REVIEW COMPLETE
code-reviewer has reviewed all phase designs.
Review Summary:
- All phases reviewed: {N} phases
- Design quality scores: [scores]
- High-confidence issues: 0
- Status: APPROVED
Design review saved to: .claude/specs/new-{feature-name}/00-design-review.md
Ready to proceed with implementation!
Step 1.5.5: Final Design Approval
STOP and ASK:
ARCHITECTURE & DESIGN PHASE COMPLETE
All Specifications:
- Exploration report
- Architecture overview
- Atomic phase specs (all {N} phases individually approved)
- Design review (code-reviewer approved)
The design has been validated and is ready for implementation.
Should we proceed to phased implementation?
WAIT FOR USER APPROVAL BEFORE CONTINUING TO IMPLEMENTATION.
Step 3.1: Initialize Phase Tracking
Use the TodoWrite tool to create a detailed task list for ALL phases from the atomic spec files. Each todo should be:
.claude/specs/new-{feature-name}/0{X}-phase-{name}.md)pending (only first phase starts as in_progress)Step 3.2: Implement Each Phase with Review Gate
For EACH phase in sequence:
3.2.1 - Implementation
in_progress in the todo list.claude/specs/new-{feature-name}/0X-phase-{phase-name}.md3.2.2 - Phase Review Gate (MANDATORY - NEVER SKIP)
CRITICAL ENFORCEMENT: This is a MANDATORY gate. The pattern MUST be:
For each phase:
├── Implement changes (from phase spec)
├── MANDATORY review gate (code-reviewer)
└── Fix issues in loop until approved (NO PROCEEDING WITH ISSUES)
Step A: Check for Existing Phase Implementation Review
⚠️ CRITICAL - File Existence Checking:
[ -f filepath ]ls, ls -la, ls -l, or any ls variantstat, find, or other file inspection commandsls returns errors to stderr when file doesn't exist, causing noiseCheck for file: .claude/specs/new-{feature-name}/0X-phase-{phase-name}-review.md
# CORRECT METHOD - Use bash test [ -f ... ]
if [ -f .claude/specs/new-{feature-name}/0X-phase-{phase-name}-review.md ]; then
# Implementation review EXISTS
else
# Implementation review DOES NOT EXIST
fi
If implementation review EXISTS for this phase:
If implementation review DOES NOT EXIST:
Step B: Invoke code-reviewer for Phase Implementation
Use the Task tool with subagent_type=code-reviewer to review ONLY the changes made in this phase.
Provide the code-reviewer with:
The phase spec path: .claude/specs/new-{feature-name}/0X-phase-{phase-name}.md
The design review: .claude/specs/new-{feature-name}/03-design-review.md (section for this phase)
The research report: .claude/specs/new-{feature-name}/02-research.md (best practices to check against)
List of files modified/created in THIS phase only
Existing phase implementation review (if updating)
Instruction: "Review this phase IMPLEMENTATION against the phase spec at .claude/specs/new-{feature-name}/0X-phase-{phase-name}.md. Check for:
Only report high-confidence issues (≥ 80). If updating an existing review, note what changed."
Step C: Create or Update Phase Implementation Review
Save the review to: .claude/specs/new-{feature-name}/0X-phase-{phase-name}-review.md
# Phase {X} Implementation Review: {phase-name}
**Review Date**: {current-date}
**Reviewer**: code-reviewer
**Spec**: 0X-phase-{phase-name}.md
**Files Modified/Created**:
- [List of files]
## Implementation Assessment
[Summary of implementation quality and compliance with spec]
## Spec Compliance Check
Objective achieved: [yes/no with details]
All files created/modified: [yes/no]
Integration points implemented: [yes/no]
Acceptance criteria met: [yes/no for each criterion]
## Issues Found (Confidence ≥ 80)
[List of high-confidence issues with confidence scores, or "None" if clean]
### Issue 1: {description}
- **Confidence**: {score}
- **Location**: {file:line}
- **Impact**: {why this matters}
- **Fix**: {specific action to resolve}
[More issues if found]
## CLAUDE.md Compliance
Type hints: [pass/fail]
No print() statements: [pass/fail]
File size < 300 lines: [pass/fail]
Function size < 30 lines: [pass/fail]
Logging usage: [pass/fail]
## Review History
[If updating: note changes from previous review]
## Recommendation
**APPROVED**: Implementation passes all checks
**REQUIRES FIXES**: {N} high-confidence issues must be addressed
3.2.3 - Handle Phase Review Feedback (Update Loop)
If code-reviewer finds high-confidence issues (≥ 80):
If code-reviewer approves (no issues ≥ 80 confidence):
completed in the todo list3.2.4 - Phase Completion Verification
After completing each phase, briefly confirm to the user:
CRITICAL:
Note: Individual phases have already been reviewed incrementally. This phase verifies the complete feature integration.
Step 4.1: Final Comprehensive Review
After ALL implementation phases are complete, use the Task tool with subagent_type=code-reviewer to perform a final comprehensive review of the COMPLETE feature.
Provide the code-reviewer with:
.claude/specs/new-{feature-name}/03-overview.md.claude/specs/new-{feature-name}/02-research.md (best practices)Step 4.2: Handle Final Review Feedback
If code-reviewer identifies high-confidence issues (≥ 80):
Step 3.3: Final Verification Summary
Present a comprehensive summary to the user:
FEATURE IMPLEMENTATION COMPLETE: {feature-name}
Specifications:
- Exploration: .claude/specs/new-{feature-name}/01-exploration.md
- Overview: .claude/specs/new-{feature-name}/00-overview.md
- Phase specs: .claude/specs/new-{feature-name}/0X-phase-*.md
Phase Reviews: All X phases passed incremental review
Integration Review: Complete feature review passed
Architecture Compliance: Matches design blueprint
Code Quality: No high-confidence issues (≥ 80)
Acceptance Criteria: All criteria met
📄 Files Modified/Created:
- [List all files]
Next Steps:
- Run tests: [suggest test commands if applicable]
- Manual testing: [suggest verification steps]
- Integration testing: [suggest integration points to verify]
- Documentation: [suggest docs to update if needed]
Confirm the feature is ready for testing and integration.
IMPORTANT: This phase ONLY runs after the USER (not Claude) confirms the feature is working correctly in production/testing.
Step 5.1: User Confirmation Checkpoint
After Phase 4 completion, present the following to the user:
FEATURE IMPLEMENTATION COMPLETE
The feature has been implemented and passed all code reviews.
TESTING REQUIRED
Before we proceed to documentation, please test the feature to ensure it works correctly:
Testing Steps:
[List relevant testing steps from acceptance criteria]
Once you've tested and confirmed the feature is working correctly, let me know and I'll update the documentation.
Have you tested the feature and confirmed it's working?
STOP and WAIT for user confirmation.
If user says NO or needs fixes:
If user confirms YES (feature is working):
Step 5.2: Invoke code-consolidator for Documentation
Use the Task tool with subagent_type=code-consolidator to consolidate or create documentation for the feature.
Provide the code-consolidator with:
The exploration report: .claude/specs/new-{feature-name}/01-exploration.md (especially "Relevant Documentation" and "Documentation to Update" sections)
The research report: .claude/specs/new-{feature-name}/02-research.md (to document applied best practices)
The overview spec: .claude/specs/new-{feature-name}/03-overview.md
List of all files created/modified
Feature description: $ARGUMENTS
Instruction: "Analyze the feature implementation and existing documentation. Determine if this feature requires:
Based on the exploration report's 'Relevant Documentation' section, identify which docs in /docs should be updated.
Follow the project's documentation standards:
/docs/readme.md and appropriate index filesSpecific actions:
/docs/backend/systems/, /docs/frontend/, etc.)Document the following:
Step 5.3: Review Documentation Changes
After code-consolidator completes:
Verify documentation changes follow project standards:
Present documentation summary to user:
DOCUMENTATION UPDATED
The code-consolidator has completed documentation for this feature.
Documentation Changes:
- [List of docs created/updated with file paths]
Updated Index Files:
- [List of index files updated]
Cross-References Added:
- [List of cross-references to related docs]
Summary:
[Brief description of documentation changes]
Documentation follows project standards:
Lowercase filenames
Integrated with existing documentation structure
Zero duplication
Cross-referenced with related docs
Updated index files
Would you like me to make any adjustments to the documentation?
Step 4.4: Final Completion Summary
Present the complete feature summary including documentation:
FEATURE FULLY COMPLETE: {feature-name}
Implementation Specifications:
- Exploration: .claude/specs/new-{feature-name}/01-exploration.md
- Overview: .claude/specs/new-{feature-name}/00-overview.md
- Phase specs: .claude/specs/new-{feature-name}/0X-phase-*.md
- Design review: .claude/specs/new-{feature-name}/00-design-review.md
- Implementation reviews: .claude/specs/new-{feature-name}/0X-phase-*-review.md
Completion Checklist:
Exploration completed (related features identified)
Architecture designed (all phases individually approved)
Design review passed (no high-confidence issues)
Implementation completed (all phases reviewed)
Integration review passed (complete feature verified)
User testing passed (feature confirmed working)
Documentation updated (consolidated and integrated)
Code Files Modified/Created:
[List all code files]
Documentation Files Created/Updated:
[List all documentation files]
Feature Status: COMPLETE & DOCUMENTED
The feature is fully implemented, tested, reviewed, and documented according to project standards.
Exploration Phase (Phase 0):
subagent_type=code-explorer (never call agents directly with "@agent-name")/docs folder for relevant documentation.claude/specs/new-{feature-name}/01-exploration.mdResearch Phase (Phase 1):
.claude/specs/new-{feature-name}/02-research.mdArchitecture Phase (Phase 2):
subagent_type=code-architect.claude/specs/new-{feature-name}/03-overview.md04-phase-{name}.md, 05-phase-{name}.md, etc.Design Review Phase (Phase 2.5):
[ -f 03-design-review.md ] (NEVER use ls)subagent_type=code-reviewer to review phase DESIGNS (not implementation)03-design-review.md with phase-by-phase findingsImplementation Phase (Phase 3):
Phase Review Gates (Critical):
[ -f 0X-phase-{name}-review.md ] (NEVER use ls)Final Review Phase (Phase 4):
subagent_type=code-reviewer for comprehensive feature reviewDocumentation Phase (Phase 5):
subagent_type=code-consolidatorTool Usage:
Task tool with subagent_type=code-explorer, code-architect, code-reviewer, or code-consolidatorTodoWrite for phase tracking (all phases listed, one in_progress at a time)Write to create spec folder and atomic spec filesRead to read atomic phase specs before implementing each phaseEdit for code changes (prefer over Write for existing files)Critical Rules:
[ -f ... ] and update if present)ls or ls -la to check file existence (use [ -f ... ] only)[ -f filepath ] and UPDATE them (not replace)[ -f ... ] for file existence checks (NEVER ls, ls -la, or stat)/docs folder for relevant documentationPhase 0: Exploration (UNDERSTAND FIRST) ⭐
├── code-explorer analyzes codebase
├── SEARCHES /docs folder for relevant documentation
├── Extracts domain context (feature domain, tech stack, patterns)
└── Output: 01-exploration.md (codebase context + domain analysis)
Phase 1: Research (CONTEXT-AWARE SOLUTION SEARCH) ⭐
├── Uses domain context FROM exploration
├── 4 parallel web searches (single message):
│ ├── Language best practices (Python + TypeScript)
│ ├── SOLID design principles
│ ├── Feature design patterns
│ └── Domain-specific patterns (based on domain FROM exploration)
├── Synthesize findings WITH codebase context
└── Output: 02-research.md (context-aware best practices, SOLID, patterns)
Phase 2: Architecture (Incremental Design)
├── code-architect (with exploration + research context) → 03-overview.md
├── FOR EACH PHASE:
│ ├── code-architect designs Phase X → 0X-phase-{name}.md
│ ├── STOP → Ask user: "Phase X design correct?"
│ ├── User approves → Next phase OR User requests changes → Redesign → Re-present
│ └── Repeat until all phases designed and approved
└── Present complete architecture → Final approval checkpoint
Phase 2.5: Design Review (Quality Assurance)
├── Check for existing: 03-design-review.md
├── FOR EACH PHASE:
│ └── code-reviewer reviews phase DESIGN (not implementation)
│ Checks: Best practices application + codebase consistency
├── Aggregate findings → Create/UPDATE 03-design-review.md
├── IF high-confidence issues (≥ 80):
│ ├── Present issues → User decides: Fix/Proceed/Stop
│ ├── IF Fix: Update phase specs → Re-review (LOOP)
│ └── Repeat until approved or user proceeds anyway
└── STOP → Ask user: "Design validated. Proceed to implementation?"
Phase 3: Implementation (per phase with review gates)
├── FOR EACH PHASE:
│ ├── Read phase spec: 0X-phase-{name}.md
│ ├── Implement phase (applying research best practices + existing patterns)
│ ├── Check for existing: 0X-phase-{name}-review.md
│ ├── code-reviewer reviews implementation (phase review gate)
│ │ Checks: Spec compliance + best practices + codebase consistency
│ ├── Create/UPDATE 0X-phase-{name}-review.md
│ ├── IF high-confidence issues (≥ 80):
│ │ ├── Fix issues → Re-review (LOOP)
│ │ └── Update review file until approved
│ └── Mark complete → Next phase
└── All phases complete
Phase 4: Final Integration Review
├── code-reviewer (comprehensive feature review)
│ Checks: Integration + best practices application
├── Fix issues if any
├── Present completion summary
└── STOP → Ask user: "Test the feature. Does it work?"
Phase 5: Documentation (ONLY after user confirms feature works)
├── WAIT for user confirmation: "Feature is working"
├── IF user says NOT working → Return to Phase 3 for fixes
├── IF user confirms IS working:
│ ├── code-consolidator analyzes feature + exploration + research reports
│ ├── Determines: New docs / Update existing / Consolidate
│ ├── Creates/updates docs in /docs (following project standards)
│ ├── Updates index files and cross-references
│ └── Present documentation changes summary
└── Final completion: Feature fully implemented AND documented
⭐ KEY IMPROVEMENT: Exploration (Phase 0) runs BEFORE Research (Phase 1)
This ensures web research is informed by actual codebase context!
This example demonstrates the full workflow with all phases and agents.
[4 parallel searches execute in single message]
Search 1: "Python FastAPI WebSocket best practices async 2025"
Search 2: "SOLID principles practical Python TypeScript"
Search 3: "real-time feature design patterns pub/sub"
Search 4: "WebSocket architecture patterns scalability 2025"
RESEARCH COMPLETE
Key Findings:
- WebSocket lifecycle management (connect, disconnect, heartbeat)
- Pub/sub pattern for broadcasting (SOLID: Single Responsibility)
- Message type discrimination (type field for routing)
- Async/await patterns for WebSocket handlers
- React hooks patterns for WebSocket state management
Saved to: .claude/specs/feature-trajectory-viz/00-research.md
code-explorer finds:
- WebSocket system (app/api/websocket/detection.py)
- Tracking system (providers/tracking/tracker.py)
- Frontend hooks (frontend/src/hooks/UseWebSocket.ts)
- DOCS: /docs/backend/systems/tracking.md
- DOCS: /docs/frontend/guides/websocket-detection.md
Saved to: 01-exploration.md
code-architect (with research + exploration context):
Overview → 00-overview.md (references SOLID principles from research)
Phase 1 Design: Add TrajectoryMessage
Design uses: Type discrimination pattern (from research)
Follows: Existing DetectionMessage pattern (from exploration)
User approves
Phase 2 Design: TrajectoryBroadcaster Service
Design uses: Pub/sub pattern (from research)
Applies: Single Responsibility (SOLID from research)
User approves
[Phases 3-5 continue...]
code-reviewer reviews designs:
All phases follow SOLID principles
Applies WebSocket best practices from research
No high-confidence issues
Saved to: 00-design-review.md
For each phase:
- Implement following research recommendations
- Review gate catches issues
- Update review files
Example: Phase 2 review finds missing heartbeat (from research best practices)
→ Fixed → Re-reviewed → Approved
Feature complete
Ask user: "Test trajectory visualization. Does it work?"
User: "Yes, trajectories display correctly!"
code-consolidator:
- Updates /docs/backend/systems/tracking.md (trajectory section)
- Creates /docs/frontend/guides/trajectory-canvas.md
- Updates index files
- Cross-references
Documentation complete!
After completion, .claude/specs/feature-{name}/ contains:
.claude/specs/feature-trajectory-viz/
├── 00-research.md # Best practices research
├── 01-exploration.md # Codebase exploration
├── 00-overview.md # Architecture overview
│
├── 02-phase-message-type.md # Phase 1 spec
├── 03-phase-broadcaster.md # Phase 2 spec
├── 04-phase-endpoint.md # Phase 3 spec
├── 05-phase-frontend-hook.md # Phase 4 spec
├── 06-phase-visualization.md # Phase 5 spec
│
├── 00-design-review.md # Design review
│
├── 02-phase-message-type-review.md # Phase 1 implementation review
├── 03-phase-broadcaster-review.md # Phase 2 implementation review
├── 04-phase-endpoint-review.md # Phase 3 implementation review
├── 05-phase-frontend-hook-review.md # Phase 4 implementation review
└── 06-phase-visualization-review.md # Phase 5 implementation review
Total: 14 files providing complete development audit trail with best practices research!
| Agent | Phase | Input | Output | Enhancement |
|---|---|---|---|---|
| (web search) | -1 | Feature description | 00-research.md | **** |
| code-explorer | 0 | Feature + research | 01-exploration.md | Uses research |
| code-architect | 1 | Research + exploration | Phase specs | Applies SOLID |
| code-reviewer | 1.5 | Phase designs + research | Design review | Verifies patterns |
| (implementation) | 2 | Phase specs + research | Code | Follows practices |
| code-reviewer | 2 | Implementation + spec | Phase reviews | Checks patterns |
| code-reviewer | 3 | Complete feature | Final review | Integration check |
| code-consolidator | 4 | Feature + exploration | Documentation | Auto-docs |
Research (generic) → Design → Implement → Find pattern violations → Refactor
Time: ~14 hours
Quality: Pattern inconsistencies, missed best practices, codebase conflicts
Explore (understand) → Research (context-aware) → Design → Implement correctly
Time: ~11 hours (exploration adds 20min, research 30min, saves 3+ hours rework)
Quality: Consistent patterns, SOLID principles, domain best practices, codebase harmony
Savings: ~20% faster + higher quality + educational + codebase consistency
Why This Matters:
/feature:new <feature description>
Begin with Phase 0: Codebase Exploration for the feature: $ARGUMENTS