Generates implementation plans with code reuse analysis, architecture design, and complexity estimation during the /plan phase. Use when planning feature implementation, analyzing code reuse opportunities, or designing system architecture after specification phase completes. Integrates with 8 project documentation files for constraint extraction. (project)
インストール
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
Generates implementation plans with code reuse analysis, architecture design, and complexity estimation during the /plan phase. Use when planning feature implementation, analyzing code reuse opportunities, or designing system architecture after specification phase completes. Integrates with 8 project documentation files for constraint extraction. (project)
Generate implementation plan with code reuse analysis from spec.md, ensuring alignment with project documentation and maximizing component reuse during the /plan workflow phase.
This skill orchestrates the /plan phase, which runs after /spec (or /clarify) and before /tasks in the feature workflow.
Core responsibilities:
Load all 8 project documentation files from docs/project/ for constraint extraction
Search codebase for similar features and reusable components (expect 5-15 opportunities)
Design architecture with components, layers, and design patterns
Plan data model with entities, relationships, and migrations
Define API contracts in OpenAPI format (if applicable)
Plan Data Model - Entities, relationships, ERD diagram, migrations
Define API Contracts - Endpoints, schemas, validation (OpenAPI format if applicable)
Plan Testing Strategy - Unit, integration, E2E coverage with specific test types
Estimate Complexity - Predict 20-30 tasks based on feature scope
Key principle: Research before designing. Maximize code reuse. Align with project documentation.
See resources/ directory for detailed workflows on each step.
</quick_start>
Before beginning planning phase:
- Specification phase completed (spec.md exists in specs/NNN-slug/)
- Feature requirements understood (success criteria, user stories, edge cases)
- Project documentation available (docs/project/*.md) OR brownfield codebase exists
- Git working tree clean (no uncommitted changes)
If specification incomplete, return to /spec or /clarify phase.
**Load Project Documentation**
Read all 8 project documentation files for constraint extraction.
Response (200 OK): Updated profile object
Errors: 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found
**OpenAPI specification** (if applicable):
- Generate OpenAPI 3.0 spec for all endpoints
- Include request/response schemas, validation rules, error codes
- Save to docs/api/openapi.yaml
**Validation**: API design follows api-strategy.md REST patterns, error handling (RFC 7807), and auth requirements
See resources/api-contracts.md for OpenAPI generation and contract-first development.
</step>
<step number="6">
**Plan Testing Strategy**
Define test coverage plan with specific test types.
**Testing layers** (from development-workflow.md):
```markdown
## Testing Strategy (plan.md)
### Unit Tests (80% coverage target)
**Backend**:
- UserService.ts - Business logic validation
- test: updateProfile validates bio length (max 500 chars)
- test: updateProfile validates avatar URL format
- test: updateProfile preserves existing preferences when partial update
- UserRepository.ts - Database queries
- test: findByUserId returns profile or null
- test: updateProfile updates only provided fields
**Frontend**:
- ProfileForm.tsx - UI component behavior
- test: validates bio length before submission
- test: shows error message for invalid avatar URL
- test: preserves unsaved changes on navigation away
### Integration Tests
**API Endpoints**:
- PUT /api/users/:id/profile
- test: authenticated user can update own profile
- test: user cannot update other user's profile (403)
- test: invalid bio length returns 400 with error details
**Database**:
- User + UserProfile relationship
- test: deleting user cascades to user_profiles
- test: user can have only one profile (UNIQUE constraint)
### E2E Tests (Critical paths only)
- User updates profile bio and sees changes reflected
- User uploads avatar image and sees preview
- User changes theme preference and UI updates
Coverage targets:
Unit tests: 80% coverage (business logic + UI components)
Integration tests: All API endpoints + critical database operations
E2E tests: 3-5 critical user journeys
Validation: Testing strategy aligns with development-workflow.md Definition of Done
See resources/testing-strategy.md for test type selection and coverage planning.
**Estimate Complexity**
Predict task count based on feature scope (20-30 tasks expected).
Validation: Both files created in specs/NNN-slug/ directory
See reference.md for complete artifact generation workflow.
After planning phase, verify:
plan.md created with architecture, components, API contracts, testing strategy
research.md created with project context, reuse findings (5-15 opportunities), complexity estimate
All 8 project docs read (or brownfield research complete if docs missing)
Code reuse opportunities identified and documented
Testing strategy defined (unit, integration, E2E with specific tests)
Complexity estimated (20-30 tasks predicted)
API contracts specified in OpenAPI format (if applicable)
Data model ERD created with Mermaid diagram (if database changes)
Planning phase complete when all validation criteria met. Ready to proceed to /tasks phase.
<anti_patterns>
❌ Don't: Start designing architecture without searching for reusable code
✅ Do: Always search codebase first (Step 2), then design with reuse in mind
Why: Wastes time rebuilding existing components. Creates code duplication.
Impact:
Duplicate code (DRY violations)
Longer implementation time (build what exists)
Inconsistent patterns (different auth flows, different validation)
Example (bad):
/plan starts immediately with architecture design
Designs new AuthService from scratch
Reality: src/services/AuthService.ts already exists (reusable)
Result: Duplicate AuthService, 4 hours wasted
Example (good):
/plan starts with code reuse search (Step 2)
Finds: src/services/AuthService.ts (reusable)
Designs: Extend AuthService with new method (not rebuild)
Result: 30 minutes work (vs 4 hours)
**❌ Don't**: Skip reading docs/project/*.md files (assume you know constraints)
**✅ Do**: Always load all 8 project docs first (Step 1)
Wrong architecture (plan microservices, project is monolith)
Example (bad):
/plan skips project docs loading
Plans: GraphQL API with MongoDB
Reality: tech-stack.md specifies REST + PostgreSQL
Result: Entire plan must be redone (2-3 hours wasted)
Example (good):
/plan loads tech-stack.md first (Step 1)
Reads: Database = PostgreSQL, API = REST
Plans: REST API with PostgreSQL (aligned)
Result: Plan approved on first review
**❌ Don't**: "Write tests" without specific test types and coverage targets
**✅ Do**: Define specific unit, integration, E2E tests with coverage targets (Step 6)
Why: No clear Definition of Done. Implementation phase lacks test guidance.
Impact:
Low test coverage (<50% vs 80% target)
Missing integration tests (only unit tests)
No E2E tests for critical user journeys
Example (bad):
Testing Strategy: "Write unit tests for all components"
Implementation phase: Unclear what to test, how much coverage needed
Result: 45% coverage, missing integration tests
Example (good):
Testing Strategy:
- Unit: UserService.updateProfile validates bio length (80% coverage)
- Integration: PUT /api/users/:id/profile with auth
- E2E: User updates profile and sees changes
Implementation phase: Clear guidance, all tests implemented
Result: 85% coverage, all test types covered
**❌ Don't**: Skip task count prediction (proceed to /tasks without estimate)
**✅ Do**: Predict 20-30 tasks based on feature scope (Step 7)
Why: No velocity tracking. Can't detect scope creep.
Impact:
Scope creep undetected (planned 20 tasks, actual 60 tasks)
/plan: No complexity estimate
/tasks: Generates 45 tasks
Question: "Is 45 tasks reasonable for this feature?"
Answer: Unknown (no baseline estimate)
Example (good):
/plan: Estimates 20-30 tasks (Step 7)
/tasks: Generates 45 tasks
Red flag: 45 > 30 (scope creep detected)
Action: Review tasks, remove unnecessary work
Result: 28 tasks (aligned with estimate)
**❌ Don't**: "Design API endpoints" without request/response schemas
**✅ Do**: Specify complete API contracts with schemas, validation, errors (Step 5)
Why: Frontend/backend integration bugs. No clear contract to test against.
Impact:
Integration bugs (frontend expects field A, backend returns field B)
Ambiguous validation (is bio max 500 or 1000 chars?)
API Endpoints:
GET /api/users/:id/profile
Response: { "bio": string, "avatar_url": string, "preferences": object }
Validation: bio max 500 chars, avatar_url must be valid URL
Implementation: Frontend and backend aligned on contract
Result: Zero integration bugs
<best_practices>
Always search for reusable code before designing:
Search codebase for similar features (Step 2)
Identify 5-15 reuse opportunities
Design with reuse in mind (extend, not rebuild)
Result: Faster implementation, less duplication, consistent patterns
Load all 8 project documentation files first:
Read docs/project/*.md for constraints (Step 1)
Extract tech stack, architecture, API patterns
Align plan with documented standards
Result: No hallucinated tech choices, compliant architecture
Define specific tests with coverage targets:
Unit tests: 80% coverage with specific test cases
Integration tests: All API endpoints + critical database operations
E2E tests: 3-5 critical user journeys
Result: Clear Definition of Done, comprehensive test coverage
Issue: Complexity estimate >50 tasks (expected 20-30)
Solution: Feature too large - split into multiple features, remove nice-to-have requirements, simplify scope
Issue: API contract doesn't match existing patterns
Solution: Review api-strategy.md and existing endpoints for consistent patterns, align with project standards
Issue: ERD too complex (>10 entities for single feature)
Solution: Scope too large - split into multiple features, or some entities already exist (check data-architecture.md)