3 Code Plan
DDD Phase 3 - Plan code implementation
---
name: ddd:3-code-plan
version: 1.0.0
description: DDD Phase 3 - Plan code implementation
argument-hint: [optional override instructions]
allowed-tools: TodoWrite, Read, Grep, Glob, Task, Bash(git diff:*), Bash(make check:*)
triggers:
- "Plan code implementation for DDD"
- "Create code plan from DDD specs"
- "Phase 3 implementation planning"
invokes:
- type: workflow
path: .claude/workflow/DDD_WORKFLOW.md
---
# DDD Phase 3: Code Planning
Loading context:
@docs/document_driven_development/phases/03_implementation_planning.md
@~/.amplihack/.claude/context/PHILOSOPHY.md
@~/.amplihack/.claude/context/PHILOSOPHY.md
@ai_working/ddd/plan.md
**CRITICAL**: Read ALL updated documentation - these are now the specifications
Override instructions: $ARGUMENTS
---
## Your Task: Plan Complete Code Implementation
**Goal**: Assess current code, plan all changes to match new documentation
**Output**: `ai_working/ddd/code_plan.md` - Detailed implementation specification
---
## Phase 3 Steps
### 1. Read Updated Documentation (The Specifications)
**The docs you updated in Phase 2 are now the SPEC**:
Read ALL documentation that describes what the code should do:
- User-facing docs (how it works)
- API documentation (interfaces)
- Configuration docs (settings)
- Architecture docs (design)
This is what the code MUST implement.
### 2. Code Reconnaissance
For each code file in the plan (Phase 1):
**Understand current state**:
- Read the existing code
- Understand current architecture
- Identify current behavior
- Note existing tests
**Gap analysis**:
- What does code do now?
- What should code do (per docs)?
- What's missing?
- What needs to change?
- What needs to be removed?
Use Grep and Glob to explore related code:
```bash
# Find all references to a module
grep -r "import module_name"
# Find all files in a package
glob "src/package/**/*.py"
3. Create Implementation Specification
Write ai_working/ddd/code_plan.md:
# Code Implementation Plan
Generated: [timestamp]
Based on: Phase 1 plan + Phase 2 documentation
## Summary
[High-level description of what needs to be implemented]
## Files to Change
### File: src/module1.py
**Current State**:
[What the code does now]
**Required Changes**:
[What needs to change to match documentation]
**Specific Modifications**:
- Add function `do_something()` - [description]
- Modify function `existing_func()` - [changes needed]
- Remove deprecated code - [what to remove]
**Dependencies**:
[Other files this depends on, if any]
**Agent Suggestion**: modular-builder
---
### File: src/module2.py
[... repeat for EVERY code file]
## Implementation Chunks
Break implementation into logical, testable chunks:
### Chunk 1: Core Interfaces / Data Models
**Files**: [list]
**Description**: [what this chunk does]
**Why first**: [usually: other chunks depend on these]
**Test strategy**: [how to verify]
**Dependencies**: None
**Commit point**: After unit tests pass
### Chunk 2: Business Logic
**Files**: [list]
**Description**: [what this chunk does]
**Why second**: [dependency reasoning]
**Test strategy**: [how to verify]
**Dependencies**: Chunk 1
**Commit point**: After integration tests pass
### Chunk 3: [Continue...]
[... continue until all changes covered]
## New Files to Create
If any new files needed:
### File: src/new_module.py
**Purpose**: [why needed]
**Exports**: [public interface]
**Dependencies**: [what it imports]
**Tests**: tests/test_new_module.py
## Files to Delete
If any files should be removed:
### File: src/deprecated.py
**Reason**: [why removing]
**Migration**: [how existing users migrate, if applicable]
## Agent Orchestration Strategy
### Primary Agents
**modular-builder** - For module implementation:
Task modular-builder: "Implement [module] according to spec in code_plan.md and updated documentation"
**bug-hunter** - If issues arise:
Task bug-hunter: "Debug issue with [specific problem]"
**test-coverage** - For test planning:
Task test-coverage: "Suggest comprehensive tests for [module]"
### Sequential vs Parallel
**Sequential** (dependencies between chunks):
Chunk 1 → Chunk 2 → Chunk 3
**Parallel** (independent chunks):
Chunk 1 ⎤ Chunk 2 ⎥ → Merge Chunk 3 ⎦
Use sequential for this project: [reason]
## Testing Strategy
### Unit Tests to Add
**File: tests/test_module1.py**
- Test `function_a()` - [what to verify]
- Test `function_b()` - [what to verify]
[... for each module]
### Integration Tests to Add
**File: tests/integration/test_feature.py**
- Test end-to-end flow - [description]
- Test error handling - [cases]
### User Testing Plan
How will we actually test as a user?
**Commands to run**:
```bash
# Test basic functionality
command --flag value
# Test error handling
command --invalid
# Test integration
command1 && command2
Expected behavior: [What user should see]
Philosophy Compliance
Ruthless Simplicity
- [How this implementation stays simple]
- [What we're NOT doing (YAGNI)]
- [Where we're removing complexity]
Modular Design
- [Clear module boundaries]
- [Well-defined interfaces (studs)]
- [Self-contained components (bricks)]
Commit Strategy
Detailed commit plan:
Commit 1: [Chunk 1] - [description]
feat: Add core interfaces for [feature]
- Add Module1 with interface X
- Add Module2 with interface Y
- Tests passing
Commit 2: [Chunk 2] - [description]
feat: Implement [feature] business logic
- Implement Module1.method()
- Wire up Module2 integration
- All tests passing
[... continue for all commits]
Risk Assessment
High Risk Changes:
- [Change that might break things] - [mitigation]
Dependencies to Watch:
- [External library] - [version constraints]
Breaking Changes:
- [If any] - [how to handle]
Success Criteria
Code is ready when:
- All documented behavior implemented
- All tests passing (make check)
- User
Maintain 3 Code Plan?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[3 Code Plan on getagentictools](https://getagentictools.com/loops/rysweet-ddd-phase-3-code-planning?ref=badge)