Review code against spec compliance - checks implementation matches spec requirements, identifies deviations, reports compliance score, triggers evolution if needed
Reviews implementation against specification to ensure compliance. Triggers after code completion or before merging, comparing functional requirements, error handling, and edge cases to identify deviations and calculate compliance scores.
/plugin marketplace add rhuss/cc-superpowers-sdd/plugin install sdd@sdd-plugin-developmentThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Review code implementation against specification to ensure compliance.
Key Difference from Standard Code Review:
sdd:implement)Read specification:
cat specs/features/[feature-name].md
Identify implementation files:
# From implementation plan or code exploration
ls -la [implementation-files]
For each functional requirement in spec:
Create compliance matrix:
Requirement 1: [Spec text]
Implementation: [file:line]
Status: ✓ Compliant | ✗ Deviation | ? Missing
Notes: [If deviation, explain]
Requirement 2: [Spec text]
...
For each error case in spec:
Error handling compliance:
Error Case 1: [From spec]
Implemented: Yes/No
Location: [file:line]
Response: [What code returns]
Spec Expected: [What spec says]
Status: ✓ / ✗
For each edge case in spec:
Identify code features NOT in spec:
For each extra feature:
Formula:
Compliance % = (Compliant Requirements / Total Requirements) × 100
Include:
Example:
Functional: 8/8 = 100%
Error Cases: 3/4 = 75%
Edge Cases: 2/3 = 67%
Non-Functional: 3/3 = 100%
Overall: 16/18 = 89%
Report structure:
# Code Review: [Feature Name]
**Spec:** specs/features/[feature].md
**Date:** YYYY-MM-DD
**Reviewer:** Claude (sdd:review-code)
## Compliance Summary
**Overall Score: XX%**
- Functional Requirements: X/X (XX%)
- Error Handling: X/X (XX%)
- Edge Cases: X/X (XX%)
- Non-Functional: X/X (XX%)
## Detailed Review
### Functional Requirements
#### ✓ Requirement 1: [Spec text]
**Implementation:** src/[file]:line
**Status:** Compliant
**Notes:** Correctly implemented as specified
#### ✗ Requirement 2: [Spec text]
**Implementation:** src/[file]:line
**Status:** Deviation
**Issue:** [What differs from spec]
**Impact:** [Minor/Major]
**Recommendation:** [Update spec / Fix code]
### Error Handling
[Similar format for each error case]
### Edge Cases
[Similar format for each edge case]
### Extra Features (Not in Spec)
#### [Feature name]
**Location:** src/[file]:line
**Description:** [What it does]
**Assessment:** [Helpful / Scope creep]
**Recommendation:** [Add to spec / Remove]
## Code Quality Notes
[Secondary observations about code quality, patterns, etc.]
## Recommendations
### Critical (Must Fix)
- [ ] [Issue requiring immediate attention]
### Spec Evolution Candidates
- [ ] [Deviation that might warrant spec update]
### Optional Improvements
- [ ] [Nice-to-have suggestions]
## Conclusion
[Overall assessment]
**Next Steps:**
- If compliance < 100%: Use `sdd:evolve` to reconcile deviations
- If compliance = 100%: Proceed to verification
If deviations found:
sdd:evolveIf 100% compliant:
sdd:verification-before-completionUse TodoWrite to track:
# Code Review: User Profile Update API
**Spec:** specs/features/user-profile-api.md
**Date:** 2025-11-10
**Reviewer:** Claude (sdd:review-code)
## Compliance Summary
**Overall Score: 94%**
- Functional Requirements: 6/6 (100%)
- Error Handling: 4/4 (100%)
- Edge Cases: 3/3 (100%)
- Non-Functional: 2/3 (67%)
## Detailed Review
### Functional Requirements
#### ✓ Requirement 1: PUT endpoint accepts requests
**Implementation:** src/api/users/profile.ts:12
**Status:** Compliant
**Notes:** Route correctly configured at PUT /api/users/:id/profile
#### ✓ Requirement 2: Validates request body
**Implementation:** src/middleware/validation/profile.ts:5
**Status:** Compliant
**Notes:** All validations match spec (name 2-50, bio max 500, avatar_url URL)
[... all ✓ ...]
### Error Handling
#### ✓ Error: Missing/Invalid JWT
**Implementation:** src/middleware/auth.ts:22
**Status:** Compliant
**Spec Expected:** 401 with "Authentication required"
**Actual:** 401 with "Authentication required" ✓
[... all ✓ ...]
### Non-Functional Requirements
#### ✗ Performance: Response time < 200ms
**Status:** Not Verified
**Issue:** No performance testing implemented
**Impact:** Minor (likely meets requirement but unverified)
**Recommendation:** Add performance test or update spec to remove specific timing
### Extra Features (Not in Spec)
#### Updated timestamp in response
**Location:** src/api/users/profile.ts:45
**Description:** Adds `updated_at` timestamp to response object
**Assessment:** Helpful - standard practice for update endpoints
**Recommendation:** Add to spec (minor addition)
## Recommendations
### Spec Evolution Candidates
- [ ] Add `updated_at` field to response spec (minor addition)
- [ ] Remove specific performance timing or add perf tests
## Conclusion
Code implementation is 94% compliant with spec. All functional requirements and error handling correctly implemented. One non-functional requirement unverified and one helpful feature added beyond spec.
**Next Steps:**
Use `sdd:evolve` to update spec with:
1. `updated_at` field (minor addition)
2. Clarify performance requirement (remove specific timing or add test)
After spec evolution, compliance will be 100%.
Spec compliance is primary concern.
This is not just code quality review - it's spec validation.
100% compliance is the goal.
Deviations trigger evolution.
sdd:evolve to reconcileThe code and spec must tell the same story.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.