---
roadcrew_template_name: "plan-implementation.md"
roadcrew_template_type: "command"
execution_mode: "auto-execute"
roadcrew_template_version: "v1.0"
roadcrew_last_updated: "2025-10-25"
roadcrew_min_version: "1.5.0"
roadcrew_license: "See LICENSE file in .roadcrew folder"
roadcrew_copyright: "Copyright (c) 2025 North Star Holdings, LLC"
spdx_license_identifier: "LicenseRef-RoadcrewLicense-1.0"
---

# plan-implementation

<!-- Usage: /plan-implementation 185 -->

You are generating detailed technical implementation plans for a GitHub Epic's child issues.

**Input:** GitHub Epic number (from `/analyze-epic` output)

**Output:** For each child issue:
- Technical architecture and design decisions
- Code structure blueprint (files to create/modify)
- Test strategy guide (unit/integration/E2E boundaries)
- Implementation checklist (concrete tasks)
- Approval prompt to proceed with `/write-tests`

**Key Principle:** Transform "What to build" (from analyze-epic) into "How to build it" (technical design).

---

## WORKFLOW

### 1. FETCH EPIC & CHILD ISSUES

```bash
# Run plan-implementation for Epic #{{EPIC_NUMBER}}
/plan-implementation {{EPIC_NUMBER}}
```

The command will:
- Fetch Epic via GitHub API
- Extract all child issues using parent epic reference
- Sort by dependency order from `/analyze-epic`

### 2. FOR EACH ISSUE, GENERATE TECHNICAL PLAN

**Technical Design Document (per issue):**

```
# Issue #N: [Title]

## Technical Approach
- Architecture overview
- Design decisions (Why this approach?)
- Key components and their responsibilities

## Code Structure Blueprint
Files to create:
- `path/to/new-file-1.ts` (lines: ~200, purpose: ...)
- `path/to/new-file-2.ts` (lines: ~150, purpose: ...)

Files to modify:
- `path/to/existing-file.ts` (current: ~500 lines, add: ~100 lines, purpose: ...)

## Integration Points
- Module A: How does this integrate?
- Module B: What functions/interfaces are used?
- External APIs: Any new dependencies?

## Data Model Changes (if any)
- Schema updates
- Migration path
- Backward compatibility concerns

## Test Strategy
### Unit Tests (Core Logic)
- Test function: `calculateMetric()`
- Test function: `validateInput()`
- Mock strategy: Dependency injection for external services

### Integration Tests (Component Interaction)
- Test: Issue discovery → Planning pipeline
- Test: Plan output → Write-tests input handoff
- Mock strategy: Use test fixtures for GitHub API responses

### E2E Tests (Optional)
- Full workflow from analyze-epic through implementation

## Implementation Checklist
- [ ] Create base module structure
- [ ] Implement core logic
- [ ] Add error handling
- [ ] Add logging/debugging
- [ ] Write unit tests
- [ ] Write integration tests
- [ ] Update documentation
- [ ] Code review and approval

## Dependencies & Prerequisites
- Requires: Issue #158 output (plan-implementation output format)
- External: GitHub API, TypeScript compiler
- Internal: scripts/utils/issue-classification.ts

## Estimated Breakdown
- Setup & structure: 1-2 hours
- Core logic: 4-6 hours
- Testing: 2-3 hours
- Documentation: 1 hour
```

### 3. PRESENT OUTPUTS

**Display for each issue:**
- Technical design document
- Code structure blueprint
- Test strategy guide
- Implementation checklist

**Then prompt:**
```
Ready to proceed with /write-tests {{ISSUE_NUMBER}}?
This will generate failing tests based on this technical design.
```

### 4. AUTO-PROCEED TO NEXT ISSUE

After user confirms (or auto-confirms), move to next issue. Repeat until all issues planned.

---

## TECHNICAL REQUIREMENTS

**Input (from /analyze-epic):**
- Epic number
- List of child issues with:
  - Issue number
  - Title
  - Acceptance criteria
  - Dependencies
  - Classification (1-10)

**Output (for each issue):**
- Technical design document (markdown)
- Code structure blueprint (file list with purposes)
- Test strategy guide (unit/integration/E2E breakdown)
- Implementation checklist (concrete steps)

**Integration:**
- Output feeds into `/write-tests` (needs tech design + acceptance criteria)
- Output feeds into `/implement-issue` (needs code structure blueprint)

---

## EXAMPLE OUTPUT

See linked implementation files:
- `scripts/plan-implementation.ts` - Command logic
- `scripts/utils/roadcrew/plan-coordinator.ts` - Shared planning utilities

---

## ACCEPTANCE CRITERIA

✅ Command accepts Epic number
✅ Fetches all child issues from GitHub
✅ Generates technical design for each issue
✅ Includes code structure blueprint
✅ Includes test strategy guide
✅ Provides implementation checklist
✅ Ready for /write-tests integration
✅ Handles 4+ issues without performance issues
✅ Errors gracefully if GitHub API unavailable

---

**Parent Epic:** #185 (Implement Pattern Framework Phase 2)
**Related:** #159 (write-tests), #160 (autopilot)

---

Done
