Code Review Philosophy
TL;DR
Systematic code review across 4 layers with severity classification. Only report findings with ≥80% confidence. Include file:line references for all issues.
When to Use This Skill
- Before reporting implementation completion
- When explicitly asked to review code
- When using the
/review command
- As an independent audit after code changes
The 4 Review Layers
Layer 1: Correctness
- Logic errors and edge cases
- Error handling completeness
- Type safety and null checks
- Algorithm correctness
- Off-by-one errors
Layer 2: Security
- No hardcoded secrets or API keys
- Input validation and sanitization
- Injection vulnerability prevention (SQL, XSS, command)
- Authentication and authorization checks
- Sensitive data not logged
- OWASP Top 10 awareness
Layer 3: Performance
- No N+1 query patterns
- Appropriate caching strategies
- No unnecessary re-renders (React/frontend)
- Lazy loading where appropriate
- Memory leak prevention
- Algorithmic complexity concerns
Layer 4: Style & Maintainability
- Adherence to project conventions (check AGENTS.md)
- Code duplication (DRY violations)
- Complexity management (cyclomatic complexity)
- Documentation completeness
- Test coverage gaps
Severity Classification
| Severity |
Icon |
Criteria |
Action Required |
| Critical |
🔴 |
Security vulnerabilities, crashes, data loss, corruption |
Must fix before merge |
| Major |
🟠 |
Bugs, performance issues, missing error handling |
Should fix |
| Minor |
🟡 |
Code smells, maintainability issues, test gaps |
Nice to fix |
| Nitpick |
🟢 |
Style preferences, naming suggestions, documentation |
Optional |
Confidence Threshold
Only report findings with ≥80% confidence.
If uncertain about an issue:
- State the uncertainty explicitly: "Potential issue (70% confidence): ..."
- Suggest investigation rather than assert a problem
- Prefer false negatives over false positives (reduce noise)
Review Process
- Initial Scan - Identify all files in scope, understand the change
- Deep Analysis - Apply all 4 layers systematically to each file
- Context Evaluation - Consider surrounding code, project patterns, existing conventions
- Philosophy Check - Verify against code-philosophy (5 Laws) if applicable
- Synthesize Findings - Group by severity, deduplicate, prioritize
Output Format
Structure your review as:
- Files Reviewed - List all files analyzed
- Overall Assessment - APPROVE | REQUEST_CHANGES | NEEDS_DISCUSSION
- Summary - 2-3 sentence overview
- Critical Issues (🔴) - With file:line references
- Major Issues (🟠) - With file:line references
- Minor Issues (🟡) - With file:line references
- Positive Observations (🟢) - What's done well (always include at least one)
- Philosophy Compliance - Checklist results if applicable
What NOT to Do
- Do NOT report low-confidence findings as definite issues
- Do NOT provide vague feedback without file:line references
- Do NOT skip any of the 4 layers
- Do NOT forget to note positive observations
- Do NOT modify any files during review
- Do NOT approve without completing the full review process
Adherence Checklist
Before completing a review, verify:
1---2name: code-review3description: Comprehensive code review methodology with severity classification and confidence thresholds4---56# Code Review Philosophy78## TL;DR9Systematic code review across 4 layers with severity classification. Only report findings with ≥80% confidence. Include file:line references for all issues.1011## When to Use This Skill12- Before reporting implementation completion13- When explicitly asked to review code14- When using the `/review` command15- As an independent audit after code changes1617## The 4 Review Layers1819### Layer 1: Correctness20- Logic errors and edge cases21- Error handling completeness22- Type safety and null checks23- Algorithm correctness24- Off-by-one errors2526### Layer 2: Security27- No hardcoded secrets or API keys28- Input validation and sanitization29- Injection vulnerability prevention (SQL, XSS, command)30- Authentication and authorization checks31- Sensitive data not logged32- OWASP Top 10 awareness3334### Layer 3: Performance35- No N+1 query patterns36- Appropriate caching strategies37- No unnecessary re-renders (React/frontend)38- Lazy loading where appropriate39- Memory leak prevention40- Algorithmic complexity concerns4142### Layer 4: Style & Maintainability43- Adherence to project conventions (check AGENTS.md)44- Code duplication (DRY violations)45- Complexity management (cyclomatic complexity)46- Documentation completeness47- Test coverage gaps4849## Severity Classification5051| Severity | Icon | Criteria | Action Required |52|----------|------|----------|-----------------|53| Critical | 🔴 | Security vulnerabilities, crashes, data loss, corruption | Must fix before merge |54| Major | 🟠 | Bugs, performance issues, missing error handling | Should fix |55| Minor | 🟡 | Code smells, maintainability issues, test gaps | Nice to fix |56| Nitpick | 🟢 | Style preferences, naming suggestions, documentation | Optional |5758## Confidence Threshold5960**Only report findings with ≥80% confidence.**6162If uncertain about an issue:63- State the uncertainty explicitly: "Potential issue (70% confidence): ..."64- Suggest investigation rather than assert a problem65- Prefer false negatives over false positives (reduce noise)6667## Review Process68691. **Initial Scan** - Identify all files in scope, understand the change702. **Deep Analysis** - Apply all 4 layers systematically to each file713. **Context Evaluation** - Consider surrounding code, project patterns, existing conventions724. **Philosophy Check** - Verify against code-philosophy (5 Laws) if applicable735. **Synthesize Findings** - Group by severity, deduplicate, prioritize7475## Output Format7677Structure your review as:78791. **Files Reviewed** - List all files analyzed802. **Overall Assessment** - APPROVE | REQUEST_CHANGES | NEEDS_DISCUSSION813. **Summary** - 2-3 sentence overview824. **Critical Issues** (🔴) - With file:line references835. **Major Issues** (🟠) - With file:line references846. **Minor Issues** (🟡) - With file:line references857. **Positive Observations** (🟢) - What's done well (always include at least one)868. **Philosophy Compliance** - Checklist results if applicable8788## What NOT to Do8990- Do NOT report low-confidence findings as definite issues91- Do NOT provide vague feedback without file:line references92- Do NOT skip any of the 4 layers93- Do NOT forget to note positive observations94- Do NOT modify any files during review95- Do NOT approve without completing the full review process9697## Adherence Checklist9899Before completing a review, verify:100- [ ] All 4 layers analyzed (Correctness, Security, Performance, Style)101- [ ] Severity assigned to each finding102- [ ] Confidence ≥80% for all reported issues (or uncertainty stated)103- [ ] File names and line numbers included for all findings104- [ ] Positive observations noted105- [ ] Output follows the standard format