| name | wf-phase4-implement |
| description | Phase 4 implementation (Opus) - thorough implementation with detailed analysis. Use /wf-phase4-implement-sonnet for faster implementation. |
| argument-hint | ["spec-file-path"] |
| allowed-tools | Read, Glob, Grep, Write, Edit, Bash, Task, AskUserQuestion |
| model | opus |
Phase 4: Implementation (Opus - Thorough)
Implement a feature according to its specification and Phase 3 consolidation decisions.
For faster implementation: Use /wf-phase4-implement-sonnet instead.
Spec to Implement
$ARGUMENTS
Instructions
Step 0: Read Project Config
- Try to read
.claude/workflow/project-config.json
- Extract values (defaults if absent):
specDir = docs/specs
archiveDir = docs/specs/archive
- Use
{specDir} and {archiveDir} throughout this skill
Step 1: Handle Missing Arguments / Auto-Detect Spec
If no spec path was provided:
- Check
.claude/workflow/phase-context.json for recent context (within 24 hours, lastPhase=wf-phase3-consolidate)
- If valid context found, ask user if they want to continue with it
- Otherwise, use Glob to find specs:
{specDir}/*/*.md
- Filter for
*_SPEC.md files with Phase 3 consolidation but no Phase 5 verification
- If multiple eligible specs, use AskUserQuestion to select one
Step 2: Validate Phase
Verify:
{archiveDir}/{feature-dir}/{FEATURE-ID}_PHASE3_CONSOLIDATION.md exists
{archiveDir}/{feature-dir}/{FEATURE-ID}_PHASE5_VERIFICATION.md does NOT exist
If Phase 3 not complete:
⚠️ This spec has not completed Phase 3 consolidation.
Run /wf-phase3-consolidate first to address Phase 2 feedback.
Step 3: Read Required Documents
Read thoroughly:
- Main Spec:
{specDir}/{feature-dir}/{FEATURE-ID}_*_SPEC.md
- Phase 3 Consolidation:
{archiveDir}/{feature-dir}/{FEATURE-ID}_PHASE3_CONSOLIDATION.md
- CLAUDE.md: For project patterns and conventions
- Related existing code: Based on "Files Modified" section of spec
Step 4: Create Implementation Plan
Before writing code, outline:
- Files to create (from spec "Files Added" section)
- Files to modify (from spec "Files Modified" section)
- Dependencies between changes
- Implementation order: typically model/data types → core logic → integration → tests
Step 5: Implement the Feature
Follow the spec precisely:
- Create new files as specified, following existing code patterns
- Modify existing files — read each before editing, make minimal focused changes
- Add configuration/constants if specified
- Update integration points as specified (processing pipelines, factories, etc.)
- Create HTTP endpoint if specified
- Write tests as specified in Test Strategy
Step 6: Run Tests
Run the project's test suite (see CLAUDE.md or project docs for specific commands):
Fix any failures, re-run until passing.
Step 7: Verify Completeness
Check off each item from the spec:
Step 8: Output Summary
## Phase 4 Implementation Complete
**Feature**: {FEATURE-ID} - {Feature Name}
**Spec**: {spec path}
### Files Created
- {file1}
- {file2}
### Files Modified
- {file1} - {what changed}
### Tests
- {X} test classes created
- {Y} tests total
- All passing ✅
### Notes
{Any deviations from spec or issues encountered}
Step 9: Prompt for Next Step
- Read
.claude/templates/context-reminder.md if it exists and display it; otherwise display: "Context Management: Consider starting a new conversation before the next phase to free up context window for better performance."
- Use AskUserQuestion:
- header: "Next step"
- option1: label="/wf-phase5-verify (Recommended)", description="Verify implementation matches spec and all tests pass"
- option2: label="Run tests manually", description="Test the implementation yourself before verification"
- option3: label="Continue coding", description="Make additional changes before verification"