| name | validate-plan |
| description | Validates implemented code against technical specifications, runs comprehensive tests, and ensures alignment before merge. Third prong of the development workflow after planning and orchestration. |
Validate Skill
Comprehensive validation of implemented features against their technical specifications. Ensures code quality, test coverage, and spec compliance before final merge.
Prerequisites
- Completed orchestration: Feature implementation finished via
/skill:swarm
- Feature branch: Code exists in
feat/{feature-name} branch
- Spec file:
docs/specs/{feature-name}-spec.md exists
- Test infrastructure: Testing tools configured (Vitest, Playwright, etc.)
Usage
/skill:validate <feature-name>
/skill:validate <feature-name> --tests-only
/skill:validate <feature-name> --spec-only
/skill:validate <feature-name> --coverage-only
/skill:validate <feature-name> --fix
Workflow
Phase 1: Environment Setup
- Switch to feature branch
feat/{feature-name}
- Ensure clean working directory
- Install/update dependencies
- Verify test infrastructure is working
Phase 2: Spec Alignment Analysis
-
Load Context
- Read spec from
docs/specs/{feature-name}-spec.md
- Extract acceptance criteria, API contracts, data models
- Identify all required components and behaviors
-
Code Analysis
- Scan implemented code in feature branch
- Map implemented components to spec requirements
- Identify API endpoints, data models, business logic
- Check for security considerations from spec
-
Alignment Verification
-
Generate Alignment Report
- ā
Implemented correctly
- ā ļø Partial implementation or deviations
- ā Missing or incorrect implementation
- š Recommendations for fixes
Phase 3: Test Execution
-
Unit Tests
- Run:
npm test or equivalent
- Check coverage: Minimum 80% required
- Validate: All business logic, utilities, pure functions tested
-
Integration Tests (for non-UI components)
- Run API endpoint tests
- Test database operations
- Test external service integrations
- Verify authentication/authorization flows
- Test error handling scenarios
-
End-to-End Tests
- Run critical user path tests
- Test complete feature workflows
- Verify UI components (if applicable)
-
Coverage Analysis
npm run test:coverage
Phase 4: Quality Gates
Validate against these criteria:
Code Quality
Spec Compliance
Documentation
Phase 5: Validation Report
Generate comprehensive report at docs/validation/{feature-name}-validation.md:
# Validation Report: {feature-name}
**Date**: {timestamp}
**Branch**: feat/{feature-name}
**Spec**: docs/specs/{feature-name}-spec.md
**Status**: ā
PASS | ā ļø PARTIAL | ā FAIL
## Summary
- Tests: {passed}/{total} passing
- Coverage: {percentage}% (target: 80%)
- Spec Alignment: {percentage}% complete
## Test Results
### Unit Tests
- Coverage: {percentage}%
- Passing: {count}
- Failing: {count}
### Integration Tests
- Endpoints tested: {count}
- Database ops: ā
/ā
- External services: ā
/ā
### E2E Tests
- Critical paths: {passed}/{total}
## Spec Alignment
### Implemented ā
- [List of correctly implemented features]
### Deviations ā ļø
- [List of partial/different implementations]
### Missing ā
- [List of missing implementations]
## Recommendations
- [Specific fixes needed]
- [Optional improvements]
## Approval Status
- [ ] Ready for merge
- [ ] Requires fixes (see recommendations)
Phase 6: Resolution (if --fix flag)
Attempt automatic fixes for common issues:
- Add missing test files
- Fix test coverage gaps for simple functions
- Add missing error handling
- Update documentation
- Generate missing type definitions
Quality Gate Outcomes
| Status | Criteria | Action |
|---|
| ā
PASS | All tests pass, 80%+ coverage, full spec alignment | Approve for merge |
| ā ļø PARTIAL | Tests pass, good coverage, minor spec gaps | Review recommendations, may proceed |
| ā FAIL | Test failures, low coverage, or major spec gaps | Block merge, remediation required |
Integration with Swarm Workflow
/skill:plan feature-name
/skill:swarm feature-name
/skill:validate feature-name
/skill:validate feature-name --fix
/skill:validate feature-name
Example
User: /skill:validate user-avatar
Pi: Starting validation for user-avatar...
## Environment Setup
ā
Switched to feat/user-avatar
ā
Dependencies up to date
ā
Test infrastructure ready
## Spec Alignment Analysis
š Loading spec: docs/specs/user-avatar-spec.md
š Analyzing implemented code...
### API Endpoints
ā
POST /api/avatar/upload - matches spec
ā
GET /api/avatar/{userId} - matches spec
ā ļø DELETE /api/avatar/{userId} - missing error handling for 404
### Data Models
ā
Avatar schema matches spec
ā
Database migrations present
### Security
ā
File type validation implemented
ā
Size limits enforced
ā Missing rate limiting (spec requirement)
## Test Execution
### Unit Tests
ā
127/127 tests passing
ā
Coverage: 85% (target: 80%)
### Integration Tests
ā
API endpoints: 12/12 passing
ā
Database operations: 5/5 passing
ā
File upload flow: 3/3 passing
### E2E Tests
ā
Avatar upload flow: 2/2 passing
ā ļø Avatar deletion flow: 1/1 passing (but missing rate limit test)
## Validation Summary
- **Status**: ā ļø PARTIAL
- **Tests**: 143/143 passing (100%)
- **Coverage**: 85%
- **Spec Alignment**: 90%
## Issues Found
ā Missing rate limiting implementation
ā ļø Incomplete error handling in delete endpoint
## Recommendations
1. Add rate limiting middleware to avatar endpoints
2. Improve error handling for 404 cases
3. Add integration test for rate limiting
Validation report saved: docs/validation/user-avatar-validation.md
Would you like me to attempt automatic fixes with /skill:validate user-avatar --fix?
Manual Remediation
When validation fails, use standard development workflow:
- Address issues in feature branch
- Run tests locally:
npm test
- Re-run validation:
/skill:validate feature-name
- Repeat until validation passes
Configuration
Optional validation config at .validate.json:
{
"coverage": {
"unit": 80,
"integration": 70,
"e2e": 50
},
"testCommand": "npm test",
"coverageCommand": "npm run test:coverage",
"e2eCommand": "npm run test:e2e",
"autoFix": ["coverage", "docs", "types"],
"strictMode": false
}
Related
/skill:swarm - Implementation planning and orchestration
/skill:plan - Planning workflow (PRD ā Spec ā Tasks)
/skill:feature - Single-branch feature implementation
docs/validation/ - Validation reports storage