Implement Plan
Follow the phases below to implement the Plan, then Report the completed work.
IMPORTANT: If no plan is provided (i.e., $ARGUMENTS is empty or blank), STOP immediately and ask the user to provide one. Example usage: /implement-plan specs/new-feature.md
Plan
$ARGUMENTS
Phase 1: Parse Deliverables
Before writing any code, extract ALL deliverables from the plan:
- •
Read the ENTIRE plan from start to finish
- •
Find the "Files to Deliver" section (or extract from "Step by Step Tasks" if not present)
- •
Create a structured inventory using TodoWrite:
Test Files (will be implemented first):
- •Create a todo for each test file with format: "Create test:
path/to/file.spec.ts" - •Under each test file, note the test cases it must contain
Production Files (will be implemented after tests):
- •Create a todo for each new file: "Create:
path/to/file.ts" - •Create a todo for each modification: "Modify:
path/to/file.ts- <what to change>"
Validation:
- •Create a todo for each validation command from the plan
- •Create a todo for each test file with format: "Create test:
- •
Review the inventory: Does it capture EVERYTHING from the plan? If not, add missing items.
Phase 2: Implement Tests First
For each test file in your inventory:
- •Mark the test todo as
in_progress - •Create the test file with ALL test cases described in the plan
- •Tests should initially fail (production code doesn't exist yet) - this is expected
- •Mark the test todo as
completed
WHY TESTS FIRST:
- •Tests act as a contract that forces production code to exist
- •Forgotten tests = forgotten functionality (caught immediately)
- •Provides deterministic verification that all production code is generated
Phase 3: Implement Production Code
For each production file in your inventory:
- •Mark the file todo as
in_progress - •Implement the code following the plan's specifications
- •Run related tests to verify the implementation
- •Tests should now pass - if they don't, fix the implementation
- •Mark the file todo as
completed
Continue until all production todos are complete AND all tests pass.
Phase 4: Final Verification
Before reporting:
- •Re-read the plan's "Files to Deliver" or "Step by Step Tasks" section
- •Cross-check: Does every listed file exist?
- •Cross-check: Does every listed test case exist and pass?
- •Run ALL validation commands from the plan
- •If anything is missing, go back and complete it
Report
Only after Phase 4 is complete:
- •Summarize the work in a concise bullet point list
- •Show files and lines changed:
git diff --stat - •Confirm: "All tests pass" and "All validation commands pass"