12 KiB
description, argument-hint
| description | argument-hint |
|---|---|
| Create comprehensive planning documentation for a feature | <feature-slug> |
User Input
$ARGUMENTS
You MUST parse the user input to extract the feature slug (the folder name in rpi/).
Purpose
This command creates comprehensive planning documentation for a feature request. It generates detailed specifications, technical design, and implementation plans in the feature's RPI folder.
Prerequisites:
- Feature folder exists at
rpi/{feature-slug}/ - Research completed with GO recommendation (
rpi/{feature-slug}/research/RESEARCH.mdexists)
Output Location: All files saved to rpi/{feature-slug}/plan/
This is Step 3 of the RPI Workflow (after Research approves with GO).
Outline
- Load Context: Read research report and project constitution (if exists)
- Understand Requirements: Parse feature scope and requirements
- Analyze Technical Requirements: Review architecture and dependencies
- Design Architecture: Create high-level architecture and API contracts
- Break Down Implementation: Create phased task breakdown
- Generate Documentation: Create structured documentation files
- Validate Output: Ensure all quality gates pass
- Report Completion: Provide summary and next steps
Phases
Phase 0: Load Context
Prerequisites: Feature slug provided
Process:
-
Verify research completed:
- Check
rpi/{feature-slug}/research/RESEARCH.mdexists - Verify GO recommendation (warn if NO-GO or CONDITIONAL)
- Check
-
Read research findings:
- Extract product analysis
- Extract technical discovery
- Extract technical feasibility assessment
- Note risks and constraints
-
Load project constitution (if exists):
- Look for a constitution or principles document in the repository
- Extract relevant constraints and preferences
Outputs:
- Research summary
- Constitutional context (if found)
- Planning constraints
Validation:
- Research report exists
- GO recommendation confirmed
- Constitution loaded (if exists)
Phase 1: Understand Feature Requirements
Prerequisites: Phase 0 complete
Process:
-
Parse Feature Description from research report:
- Extract feature name and primary goal
- Identify target component(s)
- Understand user-facing vs. technical feature
- Determine feature complexity level
-
Identify Affected Components:
- Primary component (where feature lives)
- Secondary components (integration points)
- Shared utilities needed
- External dependencies
-
Research Existing Patterns:
- Search for similar features in codebase
- Review component architecture and patterns
- Identify reusable code and patterns
Outputs:
- Feature scope document (internal)
- Affected components list
- Existing patterns catalog
Validation:
- Feature name and goal clearly defined
- Target component(s) identified
- Feature complexity assessed
Phase 2: Analyze Technical Requirements
Prerequisites: Phase 1 complete
Process:
-
Review Component Architecture:
- Read component README and documentation
- Review existing code structure
- Identify architectural patterns used
-
Identify Technical Dependencies:
- Internal dependencies (other components, shared utilities)
- External dependencies (APIs, services, libraries)
- Database/storage requirements
- Authentication/authorization needs
-
Assess Integration Points:
- APIs that need to be created or modified
- Database schema changes required
- Event/message flows
- Frontend-backend integration
-
Evaluate Technical Risks:
- Breaking changes to existing features
- Performance implications
- Security concerns
- Data migration needs
Outputs:
- Technical requirements document (internal)
- Dependency map
- Integration point diagram
- Risk assessment
Validation:
- Component architecture understood
- All dependencies identified
- Integration points mapped
- Technical risks assessed
Phase 3: Design Feature Architecture
Prerequisites: Phases 1-2 complete
Agent: senior-software-engineer
Process:
-
Design High-Level Architecture:
- Component/module structure
- Data flow diagrams
- API interfaces
- Database schema changes
-
Define Implementation Approach:
- File structure and organization
- Code organization patterns
- Testing strategy
- Error handling approach
-
Plan Database/Storage Changes (if applicable):
- New collections/tables
- Schema modifications
- Migration strategy
- Data validation rules
-
Design API Contracts (if applicable):
- Request/response formats
- Authentication requirements
- Error responses
-
Plan Testing Strategy:
- Unit test requirements
- Integration test scenarios
- End-to-end test cases
Outputs:
- Architecture design document (internal)
- API specifications
- Database schema design
- Testing strategy
Validation:
- High-level architecture designed
- Implementation approach defined
- Database changes planned (if needed)
- API contracts specified (if needed)
- Testing strategy complete
Phase 4: Break Down Implementation Tasks
Prerequisites: Phases 1-3 complete
Process:
-
Identify Implementation Phases:
- Break feature into 3-5 logical phases
- Each phase should deliver working, testable functionality
- Phases should build on each other progressively
-
Create Task Breakdown for Each Phase:
- List specific implementation tasks
- Estimate complexity (Low/Medium/High)
- Identify task dependencies
- Assign to appropriate code areas
-
Define Success Criteria:
- Acceptance criteria for each phase
- Testing requirements
- Documentation requirements
-
Identify Parallelization Opportunities:
- Tasks that can be done concurrently
- Frontend/backend parallel work
- Independent module development
Outputs:
- Phased implementation plan
- Task breakdown with estimates
- Success criteria per phase
- Dependency chart
Validation:
- Feature broken into 3-5 logical phases
- Each phase has specific tasks
- All tasks have complexity estimates
- Dependencies clearly marked
- Success criteria defined
Phase 5: Generate Documentation
Prerequisites: Phases 1-4 complete
Agent: documentation-analyst-writer (via Task tool)
Process:
-
Generate pm.md (Product Requirements):
- Feature description and user stories
- Constitutional alignment (if applicable)
- Business value and success metrics
- User personas and use cases
- Acceptance criteria
- Out of scope items
-
Generate ux.md (User Experience Design):
- User interface mockups (text description)
- User flows and interactions
- Accessibility considerations
- Error states and edge cases
-
Generate eng.md (Technical Specification):
- Architecture design
- API specifications
- Database schema changes
- Technology stack
- Technical risks and mitigation
-
Generate PLAN.md (Implementation Roadmap):
- Phased implementation breakdown
- Task list with estimates per phase
- Dependencies and ordering
- Success criteria per phase
- Testing requirements
- Validation checkpoints
Output Files (all saved to rpi/{feature-slug}/plan/):
pm.md- Product requirementsux.md- UX designeng.md- Technical specificationPLAN.md- Detailed implementation roadmap
Validation:
- All 4 files present (pm, ux, eng, PLAN)
- pm.md covers business requirements
- ux.md addresses user experience
- eng.md provides technical specification
- PLAN.md has phased implementation
- No placeholder text remains
- Markdown formatting is clean
Sub-Agent Delegation
This command orchestrates specialist agents:
| Phase | Agent | Type | Purpose |
|---|---|---|---|
| Phase 3 | senior-software-engineer | Custom | Architecture design |
| Phase 5 | product-manager | Custom | Product requirements (pm.md) |
| Phase 5 | ux-designer | Custom | User experience (ux.md) |
| Phase 5 | senior-software-engineer | Custom | Technical spec (eng.md) |
| Phase 5 | documentation-analyst-writer | Built-in | Documentation synthesis |
Agent Invocation
Custom Agents (product-manager, senior-software-engineer, ux-designer):
- Claude Code automatically detects these from
.claude/agents/ - Reference them naturally: "Acting as the senior-software-engineer agent..."
- NO Task tool invocation needed
Built-in Agent (documentation-analyst-writer):
- Use Task tool with
subagent_type="documentation-analyst-writer"
Completion Report
Report the following on successful completion:
Outputs Created
Documentation Folder: rpi/{feature-slug}/plan/
Files created:
- pm.md: Product requirements and user stories ({Y} stories)
- ux.md: User experience design ({Z} flows)
- eng.md: Technical specification ({A} APIs, {B} schema changes)
- PLAN.md: Detailed roadmap ({C} phases, {D} tasks)
Feature Summary
- Feature Name: {feature-name}
- Target Component: {component-name}
- Complexity: {Simple/Medium/Complex}
- Implementation Phases: {N} phases
- Total Tasks: {M} tasks
- Dependencies: {Y} internal, {Z} external
Technical Overview
- Architecture Pattern: {pattern-name}
- APIs Added/Modified: {N} APIs
- Database Changes: {Y} collections/tables
- Testing Requirements: {Z} test suites
- Risk Level: {Low/Medium/High}
Implementation Phases
- Phase 1: {phase-name} - {task-count} tasks
- Phase 2: {phase-name} - {task-count} tasks
- Phase 3: {phase-name} - {task-count} tasks [Continue for all phases...]
Next Steps
-
Review Documentation:
- Read planning docs in
rpi/{feature-slug}/plan/ - Review technical spec in
eng.md - Understand implementation phases in
PLAN.md
- Read planning docs in
-
Validate with Stakeholders:
- Product review of pm.md
- UX review of ux.md
- Technical review of eng.md
-
Begin Implementation:
- Run
/rpi:implement "{feature-slug}"to execute phased implementation - Follow PLAN.md phases
- Complete validation gates at each phase
- Run
Error Handling
If research report doesn't exist:
- Action: Stop and inform user
- Message: "Research report not found. Run
/rpi:researchfirst."
If research recommendation is NO-GO:
- Action: Warn user but allow proceeding
- Message: "Research recommended NO-GO. Proceed anyway? (y/n)"
If target component doesn't exist:
- Action: Confirm with user if this is a new component
- Message: "Component not found. Is this a new component?"
If documentation agent fails:
- Action: Generate documentation directly
- Warning: "Documentation may not fully adhere to standards"
Notes
- Prerequisites: Research completed with GO recommendation
- Part of RPI Workflow: Step 3 of 4 (Describe → Research → Plan → Implement)
Best Practices:
- Review Research First: Ensure you understand the viability assessment
- Leverage Discovery: Use technical discovery from research phase
- Be Specific: Detailed plans lead to smoother implementation
- Validate Early: Review docs before implementing
Post-Completion Action
IMPORTANT: After completing the planning workflow, ALWAYS prompt the user to compact the conversation:
Context Management: This planning workflow consumed significant context. To free up space for implementation, please run:
/compactThis will summarize the conversation and preserve the planning decisions while reducing token usage for the implementation phase.