validate_plan.md

  1# Validate Plan
  2
  3You are tasked with validating that an implementation plan was correctly executed, verifying all success criteria and identifying any deviations or issues.
  4
  5## Initial Setup
  6
  7When invoked:
  81. **Determine context** - Are you in an existing conversation or starting fresh?
  9   - If existing: Review what was implemented in this session
 10   - If fresh: Need to discover what was done through git and codebase analysis
 11
 122. **Locate the plan**:
 13   - If plan path provided, use it
 14   - Otherwise, search recent commits for plan references or ask user
 15
 163. **Gather implementation evidence**:
 17   ```bash
 18   # Check recent commits
 19   git log --oneline -n 20
 20   git diff HEAD~N..HEAD  # Where N covers implementation commits
 21
 22   # Run comprehensive checks
 23   cd $(git rev-parse --show-toplevel) && make check test
 24   ```
 25
 26## Validation Process
 27
 28### Step 1: Context Discovery
 29
 30If starting fresh or need more context:
 31
 321. **Read the implementation plan** completely
 332. **Identify what should have changed**:
 34   - List all files that should be modified
 35   - Note all success criteria (automated and manual)
 36   - Identify key functionality to verify
 37
 383. **Spawn parallel research tasks** to discover implementation:
 39   ```
 40   Task 1 - Verify database changes:
 41   Research if migration [N] was added and schema changes match plan.
 42   Check: migration files, schema version, table structure
 43   Return: What was implemented vs what plan specified
 44
 45   Task 2 - Verify code changes:
 46   Find all modified files related to [feature].
 47   Compare actual changes to plan specifications.
 48   Return: File-by-file comparison of planned vs actual
 49
 50   Task 3 - Verify test coverage:
 51   Check if tests were added/modified as specified.
 52   Run test commands and capture results.
 53   Return: Test status and any missing coverage
 54   ```
 55
 56### Step 2: Systematic Validation
 57
 58For each phase in the plan:
 59
 601. **Check completion status**:
 61   - Look for checkmarks in the plan (- [x])
 62   - Verify the actual code matches claimed completion
 63
 642. **Run automated verification**:
 65   - Execute each command from "Automated Verification"
 66   - Document pass/fail status
 67   - If failures, investigate root cause
 68
 693. **Assess manual criteria**:
 70   - List what needs manual testing
 71   - Provide clear steps for user verification
 72
 734. **Think deeply about edge cases**:
 74   - Were error conditions handled?
 75   - Are there missing validations?
 76   - Could the implementation break existing functionality?
 77
 78### Step 3: Generate Validation Report
 79
 80Create comprehensive validation summary:
 81
 82```markdown
 83## Validation Report: [Plan Name]
 84
 85### Implementation Status
 86✓ Phase 1: [Name] - Fully implemented
 87✓ Phase 2: [Name] - Fully implemented
 88⚠️ Phase 3: [Name] - Partially implemented (see issues)
 89
 90### Automated Verification Results
 91✓ Build passes: `make build`
 92✓ Tests pass: `make test`
 93✗ Linting issues: `make lint` (3 warnings)
 94
 95### Code Review Findings
 96
 97#### Matches Plan:
 98- Database migration correctly adds [table]
 99- API endpoints implement specified methods
100- Error handling follows plan
101
102#### Deviations from Plan:
103- Used different variable names in [file:line]
104- Added extra validation in [file:line] (improvement)
105
106#### Potential Issues:
107- Missing index on foreign key could impact performance
108- No rollback handling in migration
109
110### Manual Testing Required:
1111. UI functionality:
112   - [ ] Verify [feature] appears correctly
113   - [ ] Test error states with invalid input
114
1152. Integration:
116   - [ ] Confirm works with existing [component]
117   - [ ] Check performance with large datasets
118
119### Recommendations:
120- Address linting warnings before merge
121- Consider adding integration test for [scenario]
122- Document new API endpoints
123```
124
125## Working with Existing Context
126
127If you were part of the implementation:
128- Review the conversation history
129- Check your todo list for what was completed
130- Focus validation on work done in this session
131- Be honest about any shortcuts or incomplete items
132
133## Important Guidelines
134
1351. **Be thorough but practical** - Focus on what matters
1362. **Run all automated checks** - Don't skip verification commands
1373. **Document everything** - Both successes and issues
1384. **Think critically** - Question if the implementation truly solves the problem
1395. **Consider maintenance** - Will this be maintainable long-term?
140
141## Validation Checklist
142
143Always verify:
144- [ ] All phases marked complete are actually done
145- [ ] Automated tests pass
146- [ ] Code follows existing patterns
147- [ ] No regressions introduced
148- [ ] Error handling is robust
149- [ ] Documentation updated if needed
150- [ ] Manual test steps are clear
151
152## Relationship to Other Commands
153
154Recommended workflow:
1551. `/implement_plan` - Execute the implementation
1562. `/commit` - Create atomic commits for changes
1573. `/validate_plan` - Verify implementation correctness
1584. `/describe_pr` - Generate PR description
159
160The validation works best after commits are made, as it can analyze the git history to understand what was implemented.
161
162Remember: Good validation catches issues before they reach production. Be constructive but thorough in identifying gaps or improvements.