| name | add-reviewer |
| description | [ADD v0.11.0] Review code for spec compliance and quality โ produces review report |
| argument-hint | specs/{feature}.md [--scope backend|frontend|full] |
ADD Reviewer Skill v0.11.0
Conduct a comprehensive code review focused on specification compliance, code quality, and ADD methodology adherence. This is a READ-ONLY skill that produces a detailed structured review report.
Overview
The Reviewer analyzes implementation against the spec and quality standards without modifying code. It checks:
- Spec Compliance: Every acceptance criterion has a corresponding passing test
- Code Quality: Readability, maintainability, style adherence
- Test Coverage: Edge cases, error conditions, user scenarios
- Architecture: Separation of concerns, dependency management
- Error Handling: Validation, exception handling, error messages
- Documentation: Comments, docstrings, API clarity
- ADD Adherence: Test coverage, traceability, naming conventions
Pre-Flight Checks
-
Verify spec file exists
- Read spec at provided path
- Extract feature name, acceptance criteria, user test cases
- Identify scope (backend, frontend, or full system)
-
Verify implementation exists
- Locate implementation files from spec or config
- Verify code files are readable
- Check for completeness (no placeholder files)
-
Verify tests exist and pass
- Locate test files (tests/ or tests/)
- Read test mapping file if available
- Run tests to confirm all passing:
npm test or python -m pytest
- Halt if tests not passing (code not GREEN)
-
Load configuration
- Read .add/config.json for:
- Code style rules
- Test coverage thresholds
- Quality standards
- Naming conventions
-
Determine review scope
- Use --scope flag or infer from config
- backend: Server, API, database code
- frontend: UI, components, client code
- full: Everything
-
Check for session handoff โ per the Session-Handoff Preflight in ~/.codex/add/references/skill-epilogue.md
Execution Steps
Step 1: Spec Compliance Check
For each acceptance criterion:
-
Find corresponding test(s)
- Search test files for test_AC_NNN_* pattern
- Verify test exists and has clear name mapping
- Check test mapping file for complete AC coverage
-
Verify test passes
- Run the specific test to confirm it passes
- Check no tests are skipped or marked as pending
-
Examine test quality
- Does it properly verify the AC requirement?
- Are assertions clear and specific?
- Does it test happy path AND error cases?
-
Find implementation code
- Trace from test to code being tested
- Verify implementation code exists and matches test expectations
- Check function/class names match test imports
-
Compare implementation to AC
- Does implementation fulfill the acceptance criterion?
- All requirements met?
- Behavior matches specification?
Document findings:
AC-001: User can submit form with valid data
โ Test exists: test_AC_001_submit_valid_data
โ Test passes
โ Implementation found: submitForm() in src/form.ts
โ Behavior matches specification
Note: Good error message when validation fails
Step 2: Code Quality Review
Examine code for quality across dimensions:
Readability
Maintainability
Style Adherence
Error Handling
Comments & Documentation
Step 3: Test Coverage Analysis
-
Coverage metrics
- Check line coverage (default min 80%)
- Check branch coverage
- Check function coverage
- Report any below-threshold areas
-
AC-to-Test mapping
- Verify every AC has at least one test
- Verify every UT is covered
- Identify orphaned test cases
-
Edge case coverage
-
Test quality
- Are tests independent (can run in any order)?
- Do tests have clear assertions?
- Are setup/teardown proper?
- Do tests test behavior, not implementation?
Step 4: Architecture & Design Review
-
Separation of concerns
- Is business logic separated from UI/API?
- Are cross-cutting concerns (logging, error handling) centralized?
- Are modules focused and single-purpose?
-
Dependency management
- Are dependencies injected or hard-coded?
- Is module coupling loose?
- Are circular dependencies avoided?
-
Data structures
- Are types/interfaces used properly?
- Is data validation centralized?
- Are models well-designed?
-
API design
- Are public interfaces clean and intuitive?
- Are parameters well-named?
- Are return types appropriate?
Step 5: ADD Methodology Adherence
-
Test naming
- Do tests follow
test_AC_NNN_description pattern?
- Are test names descriptive?
- Can ACs be traced from test names?
-
Implementation traceability
- Can tests be mapped to code?
- Can code be mapped back to ACs?
- Is traceability documented (mapping file)?
-
Spec-Test-Code alignment
- Does code match spec requirements?
- Do tests verify code against spec?
- Is the chain unbroken?
-
Minimal implementation
- Is code minimal (no over-engineering)?
- Are there unused code paths?
- Is there premature optimization?
Step 6: Security Review
Depth scales with maturity level (read from .add/config.json):
- Alpha: Spot-check โ scan for obvious issues only
- Beta: Systematic โ full review, findings are advisory
- GA: Comprehensive โ full review, findings are blocking
Checks:
-
Injection scanning
- Search for unsanitized user input in SQL queries, shell commands, template literals, HTML output
- Use Grep to find patterns:
exec(, eval(, raw SQL string concatenation, innerHTML =, dangerouslySetInnerHTML
- Check for parameterized queries / prepared statements
-
Auth pattern review (Beta+)
- Verify authentication checks on protected routes/endpoints
- Check for constant-time password/token comparison
- Verify session management (expiry, rotation, invalidation)
- Check JWT validation (signature, expiry, audience)
-
Data handling (Beta+)
- Scan for PII logged to console or files (emails, passwords, tokens, SSNs)
- Verify sensitive data encrypted at rest and in transit
- Check for hardcoded credentials, API keys, connection strings
- Verify input validation on all external-facing boundaries
-
Dependency review (Beta+)
- Check for known CVEs in dependencies (
npm audit / pip audit / cargo audit)
- Flag outdated packages with known security patches
- Review new dependency additions for trustworthiness
-
Infrastructure (GA)
- Verify rate limiting on public endpoints
- Check for secure headers (CORS, CSP, HSTS, X-Frame-Options)
- Verify HTTPS enforcement
- Check error responses don't leak internal details
Score: X/10 based on findings count and severity
## 6. SECURITY REVIEW ({maturity} depth)
Score: 8/10
### Injection Scanning
- โ No raw SQL concatenation found
- โ All user input sanitized before template usage
- โ src/api.ts:34 โ input used in template literal without escaping
### Auth Patterns (Beta+)
- โ Protected routes have auth middleware
- โ JWT validated with signature + expiry check
- โ src/auth.ts:89 โ password comparison not constant-time
### Data Handling (Beta+)
- โ No PII in log statements
- โ No hardcoded credentials
- โ Input validation on all API endpoints
### Dependencies (Beta+)
- โ No known CVEs (npm audit clean)
- โ All dependencies on latest patch versions
Step 7: Performance Review
Only executed at Beta and above. At Alpha, this step is skipped entirely.
- Beta: All checks advisory
- GA: All checks blocking, performance tests and response time baselines required
Checks:
-
N+1 query detection
- Search for database queries inside loops (e.g.,
for / forEach / map containing query calls)
- Use Grep to find patterns: ORM calls (
.find(, .query(, .get() inside loop bodies
- Flag any query-per-iteration patterns
-
Blocking async detection
- Search for synchronous I/O in async contexts (
readFileSync, execSync, blocking HTTP calls)
- Check for
await inside loops where Promise.all could be used
- Flag CPU-intensive operations on the main thread / event loop
-
Memory patterns
- Check for unbounded caches or collections (growing arrays/maps without eviction)
- Flag event listeners added without cleanup (missing
removeEventListener / unsubscribe)
- Check for closures holding large objects unnecessarily
-
Bundle size (if applicable)
- Run
npm run build or equivalent and check output size
- Flag unusually large bundles or missing tree-shaking
- Check for large dependencies that could be replaced with lighter alternatives
-
Performance tests (GA only)
- Verify performance test suite exists
- Check for response time baseline definitions
- Verify benchmarks run and pass within thresholds
Score: X/10 based on findings count and severity
## 7. PERFORMANCE REVIEW (Beta+ only)
Score: 9/10
### N+1 Detection
- โ No queries inside loops found
- โ Batch loading used for related entities
### Async Patterns
- โ No synchronous I/O in async contexts
- โ src/batch.ts:45 โ sequential await in loop, consider Promise.all
### Memory Patterns
- โ Event listeners cleaned up in teardown
- โ No unbounded collections detected
### Bundle Size
- โ Build output: 142KB gzipped (threshold: 500KB)
- โ Tree-shaking active, no dead code detected
Review Report Format
Generate a comprehensive structured report:
# Code Review Report
## Feature
{feature-name} v{spec-version}
## Review Scope
Backend [or Frontend or Full System]
## Executive Summary
Overall quality: {Excellent / Good / Fair / Needs Work}
Spec compliance: {percentage}%
Test coverage: {percentage}%
Code quality score: {N}/10
Security score: {N}/10
Performance score: {N}/10 (Beta+ only)
---
## 1. SPEC COMPLIANCE โ/{total}
### Acceptance Criteria Coverage
| AC ID | Description | Test | Status | Notes |
|-------|-------------|------|--------|-------|
| AC-001 | requirement | test_AC_001_* | โ Pass | Implementation aligns well |
| AC-002 | requirement | test_AC_002_* | โ Pass | Edge case handled properly |
### User Test Cases Coverage
| UT ID | Scenario | Test | Status | Notes |
|-------|----------|------|--------|-------|
| UT-001 | user scenario | test_UT_001_* | โ Pass | Clear test naming |
### Findings
- โ All acceptance criteria have passing tests
- โ All user test cases are covered
- โ [If any issues] AC-003 missing edge case test for empty input
---
## 2. CODE QUALITY
### Readability
- โ Function names are clear and descriptive
- โ Variables use meaningful names
- โ Code structure is logical
- โ [Issue] parseFormData() function is 120 lines, consider splitting
- โ [Issue] Magic string "/api/submit" appears 3 times
### Maintainability
- โ DRY principle followed (no significant duplication)
- โ Classes are focused and single-purpose
- โ [Issue] Email regex hard-coded in validator, should be constant
### Style Adherence
- โ Follows camelCase naming convention
- โ Consistent indentation (2 spaces)
- โ Imports alphabetically sorted
- โ [Issue] Missing trailing semicolons (config requires them)
### Error Handling
- โ Input validation on all entry points
- โ Network errors handled with retry
- โ [Issue] Error messages are generic ("Error") instead of specific
- โ [Issue] Missing validation for email format
### Documentation
- โ Public functions have JSDoc comments
- โ Complex logic commented
- โ [Issue] API endpoint contracts not documented
- โ [Issue] Missing README for module
---
## 3. TEST COVERAGE
### Coverage Metrics
- Line Coverage: 87% (target: 80%) โ
- Branch Coverage: 82% (target: 80%) โ
- Function Coverage: 100% โ
### Coverage Gaps
- [If any] Lines 45-52 in form.ts not covered (error path)
- [If any] Branch for IE11 workaround not tested
### Edge Cases
- โ Network timeout tested
- โ Invalid email tested
- โ [Issue] Empty string input not tested
- โ Maximum form size tested
- โ Concurrent submissions tested
### Test Quality
- โ Tests are independent (pass in any order)
- โ Setup/teardown properly isolated
- โ Assertions are specific and clear
- โ Tests verify behavior, not implementation
---
## 4. ARCHITECTURE & DESIGN
### Separation of Concerns
- โ Business logic separated from UI
- โ API layer distinct from business logic
- โ Validation centralized in one module
### Dependency Management
- โ Dependencies injected via constructors
- โ No circular dependencies detected
- โ Coupling is loose and appropriate
### Data Structures
- โ TypeScript interfaces used effectively
- โ Models are well-defined
- โ Type safety enforced
### API Design
- โ Public API is clean and intuitive
- โ Parameters well-named and documented
- โ Return types are appropriate
---
## 6. SECURITY REVIEW ({maturity} depth)
Score: {N}/10
### Injection Scanning
- {findings}
### Auth Patterns (Beta+)
- {findings}
### Data Handling (Beta+)
- {findings}
### Dependencies (Beta+)
- {findings}
---
## 7. PERFORMANCE REVIEW (Beta+ only)
Score: {N}/10
### N+1 Detection
- {findings}
### Async Patterns
- {findings}
### Memory Patterns
- {findings}
### Bundle Size
- {findings}
---
## 5. ADD METHODOLOGY
### Test Naming & Traceability
- โ Tests follow AC naming pattern (test_AC_NNN_*)
- โ Test mapping file exists and is accurate
- โ Can trace test โ code โ spec
### Implementation Quality
- โ Minimal viable implementation (no over-engineering)
- โ No unused code paths
- โ No premature optimization
### Documentation
- โ Test mapping file present and complete
- โ [If missing] No plan document (docs/plans/{feature}-plan.md)
---
## ISSUES & RECOMMENDATIONS
### Critical Issues (Must Fix)
1. [Issue description] - Severity: High
- Location: {file}:{line}
- Impact: {explanation}
- Recommendation: {fix}
### Major Issues (Should Fix)
2. [Issue description] - Severity: Medium
- Location: {file}:{line}
- Recommendation: {fix}
### Minor Issues (Nice to Have)
3. [Issue description] - Severity: Low
- Location: {file}:{line}
- Recommendation: {fix}
---
## APPROVAL STATUS
- [โ] Spec Compliance: All ACs implemented and tested
- [โ] Test Coverage: Above minimum threshold
- [โ] Code Quality: Acceptable for production
- [โ] Security Review: No blocking findings
- [โ] Performance Review: No blocking findings (Beta+ only)
- [โ ] Ready for Production: [Yes / Needs Fixes]
---
## Next Steps
1. [Fix critical issues if any]
2. Run /add-tdd-cycle REFACTOR phase to address findings
3. Re-review after fixes
4. Proceed to staging deployment
Notes on Review Approach
- READ-ONLY: This skill never modifies files
- Objective: Focus on facts (tests pass/fail, code exists/missing)
- Constructive: Frame issues as opportunities for improvement
- Actionable: Provide specific recommendations
- Evidence-based: Cite line numbers, file paths, test results
Progress Tracking
Tasks to create (mechanics per ~/.codex/add/references/skill-epilogue.md):
| Phase | Subject | activeForm |
|---|
| Load | Loading spec and config | Loading spec and config... |
| Spec compliance | Checking spec compliance | Checking spec compliance... |
| Code quality | Reviewing code quality | Reviewing code quality... |
| Test coverage | Analyzing test coverage | Analyzing test coverage... |
| Architecture | Reviewing architecture | Reviewing architecture... |
| Security | Running security review | Running security review... |
| Performance | Running performance review | Running performance review... |
| Report | Generating review report | Generating review report... |
Error Handling
Tests are not passing
- Halt review
- Report which tests fail
- Ask user to run /add-tdd-cycle GREEN phase first
Spec file is incomplete
- Halt review
- Report missing AC or UT definitions
- Ask user to complete spec
Implementation files missing
- Halt review
- Report which files are missing
- Ask user to generate implementation
Code cannot be parsed
- Report syntax error
- Provide file and line number
- Ask user to fix syntax
Integration with TDD Cycle
- This skill is invoked during REFACTOR phase of /add-tdd-cycle
- Input: Implementation files and passing tests
- Output: Review report (conversation output only)
- No file modifications
- Report guides REFACTOR improvements
End-of-skill epilogue: follow ~/.codex/add/references/skill-epilogue.md (observation + learning checkpoint + progress tracking). Note: this skill is READ-ONLY with respect to project code โ the epilogue's observation line and learning entry are the only writes it makes.