// Use this skill to create structured, comprehensive plans for complex features in ~/.ai/plans. This skill teaches how to use progressive disclosure, phase-based implementation strategies, and organized documentation that helps agents gather context quickly. Invoke manually for large features that need detailed planning and multi-PR implementation strategies.
| name | feature-planning |
| description | Use this skill to create structured, comprehensive plans for complex features in ~/.ai/plans. This skill teaches how to use progressive disclosure, phase-based implementation strategies, and organized documentation that helps agents gather context quickly. Invoke manually for large features that need detailed planning and multi-PR implementation strategies. |
| color | blue |
You are an expert technical architect specializing in breaking down complex software features into manageable, well-documented implementation plans.
This skill helps you create comprehensive, agent-friendly feature plans in ~/.ai/plans/ using progressive disclosure principles. These plans serve as "mini-skills" that help future agents (or yourself) quickly gather context and implement features in stackable PRs.
Create plans following this standard structure:
~/.ai/plans/feature-name/
โโโ overview.md # High-level feature summary (START HERE)
โโโ implementation-guide.md # Phased rollout strategy
โโโ phase-01-foundation/
โ โโโ technical-details.md # Detailed implementation specs
โ โโโ files-to-modify.md # List of affected files with context
โ โโโ context-notes.md # Decisions, gotchas, edge cases
โ โโโ testing-strategy.md # Testing approach for this phase
โโโ phase-02-core-features/
โ โโโ technical-details.md
โ โโโ files-to-modify.md
โ โโโ context-notes.md
โ โโโ testing-strategy.md
โโโ phase-03-polish/
โ โโโ ...
โโโ shared/
โโโ api-contracts.md # Shared API/interface definitions
โโโ database-schema.md # Schema changes across all phases
โโโ architecture-decisions.md # Key architectural choices
The overview is the entry point - keep it concise and high-level.
# [Feature Name] - Overview
## Problem Statement
[2-3 sentences describing the problem this feature solves]
## Solution Summary
[3-5 sentences describing the high-level approach]
## Impact
**Users Affected**: [who benefits]
**Systems Affected**: [which parts of the codebase]
**Estimated Complexity**: [straightforward/moderate/complex]
## Implementation Phases
Brief list of phases (details in implementation-guide.md):
1. **Phase 1: Foundation** - [one sentence summary]
2. **Phase 2: Core Features** - [one sentence summary]
3. **Phase 3: Polish** - [one sentence summary]
## Key Technical Decisions
- [Decision 1 with brief rationale]
- [Decision 2 with brief rationale]
- [Decision 3 with brief rationale]
## Success Criteria
**Functional:**
- [Criterion 1]
- [Criterion 2]
**Performance:**
- [Metric 1]
- [Metric 2]
**Quality:**
- [Criterion 1]
- [Criterion 2]
## Next Steps
1. Read `implementation-guide.md` for phased approach
2. Start with `phase-01-foundation/` when ready to implement
This document provides the strategic roadmap.
# [Feature Name] - Implementation Guide
## Implementation Strategy
[Explain the overall approach and why phases are structured this way]
## Phase Breakdown
### Phase 1: Foundation
**Goal**: [What this phase achieves]
**Why First**: [Rationale for doing this phase first]
**Deliverables**:
- [Deliverable 1]
- [Deliverable 2]
**Dependencies**: None
**PR Strategy**: Single PR / Multiple PRs - [explain]
**Risks**: [Any risks specific to this phase]
**Detailed Docs**: `phase-01-foundation/`
---
### Phase 2: Core Features
**Goal**: [What this phase achieves]
**Why After Phase 1**: [Rationale for ordering]
**Deliverables**:
- [Deliverable 1]
- [Deliverable 2]
**Dependencies**: Phase 1 complete
**PR Strategy**: [explain]
**Risks**: [Any risks specific to this phase]
**Detailed Docs**: `phase-02-core-features/`
---
### Phase 3: Polish
[Same structure as above]
## Migration & Rollout Strategy
**Pre-Deployment**:
1. [Step 1]
2. [Step 2]
**Deployment Order**:
- Week 1: [What gets deployed]
- Week 2: [What gets deployed]
**Rollback Plan**:
[How to rollback if issues occur]
**Monitoring**:
- [Metric 1 to monitor]
- [Metric 2 to monitor]
## Cross-Phase Concerns
**Backward Compatibility**: [Strategy across all phases]
**Testing**: [Overall testing approach]
**Performance**: [Overall performance considerations]
**Security**: [Security considerations across phases]
This is where implementation specifics live.
# Phase [N]: [Phase Name] - Technical Details
## Objective
[Detailed explanation of what this phase accomplishes]
## Current State
### Existing Architecture
[Describe relevant existing code/architecture]
```typescript
// Example of current code structure
class ExistingService {
// Show relevant existing patterns
}
[If applicable - database, API, data structures]
// New interfaces/types
interface NewStructure {
// ...
}
-- Database migrations (if applicable)
ALTER TABLE ...
path/to/file.tsCurrent (relevant excerpt):
// Show current implementation
Proposed:
// Show proposed changes
Rationale: [Why this change]
path/to/another-file.ts[Repeat structure above for each major file change]
File: path/to/new-file.ts
Purpose: [Why this file]
Structure:
// Outline of new file
Step-by-step:
Order Matters: [Explain if certain changes must happen in specific order]
[If applicable]
New Endpoints:
POST /api/v1/resource - [Description]Modified Endpoints:
GET /api/v1/resource/:id - [What changed and why]Breaking Changes: [Any breaking changes and migration path]
Scenario: [Describe the edge case]
Handling: [How code handles it]
Testing: [How to test this edge case]
[Repeat structure]
Expected Impact:
Optimizations:
Monitoring Points:
### 4. Phase Directory: files-to-modify.md Template
Quick reference for agents gathering context.
```markdown
# Phase [N]: Files to Modify
## Summary
- **New Files**: [count]
- **Modified Files**: [count]
- **Deleted Files**: [count]
## Quick Navigation
### Core Changes
- `path/to/main-file.ts` - [One sentence: what changes and why]
- `path/to/service.ts` - [One sentence]
### Supporting Changes
- `path/to/types.ts` - [One sentence]
- `path/to/utils.ts` - [One sentence]
### Tests
- `path/to/test-file.test.ts` - [One sentence]
---
## Detailed File List
### New Files
#### `path/to/new-file.ts`
**Purpose**: [Why this file exists]
**Dependencies**: [What it depends on]
**Used By**: [What uses it]
**Key Exports**:
- `functionName()` - [Description]
- `ClassName` - [Description]
---
### Modified Files
#### `path/to/existing-file.ts:45-67`
**Current Role**: [What this file currently does]
**Changes Needed**: [Specific changes]
**Impact**: [What else is affected by these changes]
**Sections to Modify**:
- Lines 45-67: [What to change]
- Lines 123-145: [What to change]
---
### Deleted Files
#### `path/to/old-file.ts`
**Why Deleted**: [Rationale]
**Migration Path**: [Where functionality moved to]
---
## Change Dependencies
**Change Order** (if specific order required):
1. Modify `file1.ts` first (other files depend on this)
2. Then modify `file2.ts` and `file3.ts` (can be parallel)
3. Finally add `new-file.ts`
## File References Map
Quick lookup of where important concepts are defined:
- **Type Definitions**: `lib/types/feature.ts:23-45`
- **Core Logic**: `lib/services/feature-service.ts:89-234`
- **API Routes**: `app/api/v1/feature/route.ts:12-67`
- **Database Queries**: `lib/repositories/feature-repo.ts:45-123`
- **Tests**: `test/integration/feature.test.ts`
Capture decisions and gotchas for future agents.
# Phase [N]: Context & Decisions
## Key Decisions
### Decision 1: [Decision Name]
**Context**: [Why this decision was needed]
**Options Considered**:
1. **[Option A]** - [Pros/cons]
2. **[Option B]** - [Pros/cons]
3. **[Option C]** - [Pros/cons]
**Decision**: [What was chosen]
**Rationale**: [Why this option was best]
**Trade-offs**: [What we're giving up]
---
### Decision 2: [Decision Name]
[Repeat structure]
---
## Gotchas & Pitfalls
### Gotcha 1: [Name]
**Issue**: [What's the problem]
**Why It Happens**: [Root cause]
**Solution**: [How to avoid/handle]
**Reference**: `file.ts:123` - [Where this is relevant]
---
### Gotcha 2: [Name]
[Repeat structure]
---
## Implementation Notes
### Optimization: [Name]
**What**: [What's optimized]
**Why**: [Why optimization is needed]
**How**: [Implementation approach]
**Measurement**: [How to verify it works]
---
### Workaround: [Name]
**Problem**: [What problem this works around]
**Root Cause**: [Why the workaround is needed]
**Workaround**: [What the workaround does]
**Future**: [Can this be removed later? When?]
---
## Related Code Patterns
### Pattern: [Pattern Name]
**Used In**: [Where in codebase]
**Example**:
```typescript
// Show the pattern
When to Use: [Guidelines for when to apply this pattern]
When Not to Use: [When to use a different approach]
Version: [version]
Why Needed: [Rationale for using this library]
Key APIs Used:
api.method() - [What it does in our context]Gotchas: [Any library-specific gotchas]
Alternatives Considered: [Why we didn't use X or Y]
Context: [Why this is uncertain]
Options:
Current Approach: [What we're doing for now]
Future Decision Point: [When this needs to be resolved]
Description: [What could be added later]
Why Not Now: [Why it's not in current scope]
Prerequisites: [What needs to be done first]
Estimated Effort: [Straightforward/moderate/complex]
### 6. Phase Directory: testing-strategy.md Template
```markdown
# Phase [N]: Testing Strategy
## Test Coverage Goals
- **Unit Tests**: [Target coverage %]
- **Integration Tests**: [Target coverage %]
- **E2E Tests**: [Target coverage %]
## Test Scenarios
### Unit Tests
#### Test Suite: [Component/Service Name]
**File**: `test/unit/path-to-test.test.ts`
**Scenarios**:
1. **Happy Path**: [What's tested]
- Input: [Example]
- Expected: [Expected result]
2. **Edge Case: [Name]**: [What's tested]
- Input: [Example]
- Expected: [Expected result]
3. **Error Handling: [Name]**: [What's tested]
- Input: [Example]
- Expected: [Expected behavior]
---
### Integration Tests
#### Test Suite: [Feature Name] Integration
**File**: `test/integration/path-to-test.test.ts`
**Setup Required**:
- [Database setup]
- [Mock services]
- [Test data]
**Scenarios**:
1. **Full Flow**: [Description]
- Steps: [1, 2, 3...]
- Assertions: [What to verify]
2. **With Dependencies**: [Description]
- Steps: [1, 2, 3...]
- Assertions: [What to verify]
---
### E2E Tests
#### Test Suite: [User Journey]
**File**: `test/e2e/path-to-test.test.ts`
**User Story**: As a [user], I want to [action] so that [benefit]
**Steps**:
1. [User action]
2. [System response]
3. [User verification]
**Assertions**:
- [What user should see]
- [What should be persisted]
---
## Test Data
### Fixtures
**File**: `test/fixtures/feature-data.ts`
**Data Sets**:
- `validInput` - [Description]
- `edgeCaseInput` - [Description]
- `invalidInput` - [Description]
---
## Mock Strategy
### Service: [Name]
**Mock File**: `test/mocks/service-mock.ts`
**Mocked Methods**:
- `method1()` - [Returns what]
- `method2()` - [Returns what]
**Why Mocked**: [Rationale]
---
## Performance Tests
### Load Test: [Scenario]
**Tool**: [k6, Jest, etc.]
**Scenario**: [What's being tested]
**Acceptance Criteria**:
- Response time: [< X ms]
- Throughput: [X requests/sec]
- Error rate: [< X%]
---
## Manual Testing Checklist
For each phase deployment:
- [ ] [Test scenario 1]
- [ ] [Test scenario 2]
- [ ] [Test scenario 3]
- [ ] Verify backward compatibility
- [ ] Test rollback procedure
---
## Regression Testing
**Existing Features to Verify**:
- [Feature 1] - [What to test]
- [Feature 2] - [What to test]
**Why These**: [Explain why these features might be affected]
Invoke this skill when:
Start with Discovery
Create Directory Structure
cd ~/.ai/plans
mkdir -p feature-name/{phase-01-foundation,phase-02-core,phase-03-polish,shared}
Write Overview First
Create Implementation Guide
Detail Each Phase
Keep It Updated
Use numbered prefixes for clear ordering:
phase-01-foundation - Foundational changes, often database/APIphase-02-core-features - Main functionalityphase-03-integration - Connecting systemsphase-04-polish - UX improvements, edge casesphase-05-optimization - Performance, cleanup (if needed)Level 1 - Quick Context (2 minutes):
overview.md onlyLevel 2 - Implementation Strategy (10 minutes):
implementation-guide.mdLevel 3 - Phase Implementation (30+ minutes):
Level 4 - Deep Context (as needed):
Always use this format when referencing code:
path/to/file.ts:123 - Single linepath/to/file.ts:123-145 - Range of linespath/to/file.ts - Entire fileThis allows quick navigation with editor commands.
Be Specific: Vague plans lead to confusion. Include code examples.
Document Rationale: Future you won't remember why decision was made.
Update as You Go: Plans are living documents. Update when reality diverges.
Link to Code: Use file:line references everywhere. Makes context gathering fast.
Capture Gotchas: Document anything that took >30 min to debug.
Think in PRs: Each phase should produce reviewable, shippable PRs.
Consider Rollback: Document how to undo changes if needed.
Plan for Monitoring: Include what metrics to watch after deployment.
โ Don't: Create massive 5000-line single-document plans โ Do: Break into focused, navigable documents
โ Don't: Write implementation details in overview.md โ Do: Keep overview high-level, details in phase directories
โ Don't: Skip rationale and just list tasks โ Do: Explain "why" for every major decision
โ Don't: Create phases that can't be independently shipped โ Do: Ensure each phase is a complete, shippable unit
โ Don't: Forget about backward compatibility โ Do: Document compatibility strategy for each phase
โ Don't: Mix multiple concerns in one phase โ Do: Keep phases focused on single concern when possible
See ~/.ai/plans/calendar-prep-events/ for a real-world example of this structure in action.
This skill supplements the simple planning guidance in your base instructions. Use:
When using this skill, you should:
Confirm Understanding
Propose Structure
Create Documents
Summarize
A good feature plan should:
Remember: These plans are "mini-skills" that make future implementation faster and more confident. Invest time upfront to save time later.