Code Review Mode
Perform a comprehensive code review with structured analysis across multiple dimensions.
When to Use This Skill
- When reviewing pull requests or merge requests
- Before merging feature branches into main/trunk
- When asked to review specific files or changes
- During pair programming review sessions
- For post-implementation quality checks
Workflow
Phase 1: Context Gathering
Identify the scope:
- Determine which files/commits to review (diff, specific files, or branch comparison)
- Get the diff:
git diff for the relevant range
Understand the change:
- Review commit messages and PR description (if available)
- Check git history for related recent changes
- Identify the purpose and expected behavior of the change
Map dependencies:
- Identify what other code depends on the changed files
- Check for related test files
- Note any configuration or schema changes
Phase 2: Multi-Dimensional Review
Evaluate the code against each dimension in the Review Dimensions section below. For each dimension:
- Walk through the relevant checklist
- Note any issues with severity (Critical/High/Medium/Low)
- Record the specific location (file:line)
- Document suggested fixes
Phase 3: Synthesis
Produce a structured review following the template in references/code-review-template.md.
Determine verdict:
- APPROVE - No critical/high issues, code is ready to merge
- NEEDS WORK - Has issues that must be addressed before merge
- BLOCK - Has critical issues, security vulnerabilities, or fundamental design problems
Organize findings by severity
Acknowledge strengths - what's done well
Provide actionable fixes - not just problems, but solutions
Review Dimensions
Correctness
Security
Performance
Reliability
Maintainability
Testing
Escalation Criteria
Flag for additional human review when:
| Concern |
Escalation Trigger |
| Security |
Any auth changes, crypto usage, user data handling, or potential vulnerabilities |
| Reliability |
Changes to error handling, retry logic, or failure recovery paths |
| Performance |
Changes to hot paths, database queries, or algorithms with scale concerns |
| Architecture |
New patterns, significant structural changes, or cross-cutting concerns |
| Testing |
Reduced coverage, disabled tests, or changes to test infrastructure |
Constraints
- Review only what's in scope - don't expand to unrelated code unless it's directly affected
- Be specific - reference exact file:line locations for all findings
- Provide fixes, not just criticisms - every issue should have a suggested resolution
- Calibrate severity appropriately - not everything is critical
- Acknowledge good work - positive feedback matters too
Examples
Example: Reviewing a New API Endpoint
Scope: PR adds POST /api/users endpoint in internal/api/users.go
Phase 1 output:
Files changed:
- internal/api/users.go (new handler)
- internal/api/routes.go (route registration)
- internal/db/users.go (new repository method)
Related tests: internal/api/users_test.go (new)
Purpose: Add user creation endpoint for onboarding flow
Phase 2 findings:
| Severity |
Issue |
Location |
Fix |
| High |
SQL injection via unsanitized email |
db/users.go:45 |
Use parameterized query |
| Medium |
Missing rate limiting |
api/users.go:23 |
Add rate limiter middleware |
| Low |
Error message exposes internal details |
api/users.go:67 |
Return generic error to client |
Phase 3 verdict:
Verdict: NEEDS WORK
Critical/High Issues:
- SQL injection vulnerability must be fixed before merge
What's Done Well:
- Clean separation between handler and repository
- Comprehensive input validation struct
- Good test coverage for happy path
Action Items:
1. [High] Fix SQL injection in db/users.go:45
2. [Medium] Add rate limiting to endpoint
3. [Low] Sanitize error messages returned to client
Begin by gathering context on the target files/commits before conducting the multi-dimensional review.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: code-review-1263description: Comprehensive code review with security, performance, and maintainability focus. Produces structured review with APPROVE, NEEDS WORK, or BLOCK verdict. Use when this capability is needed.4---56# Code Review Mode78Perform a comprehensive code review with structured analysis across multiple dimensions.910## When to Use This Skill1112- When reviewing pull requests or merge requests13- Before merging feature branches into main/trunk14- When asked to review specific files or changes15- During pair programming review sessions16- For post-implementation quality checks1718## Workflow1920### Phase 1: Context Gathering21221. **Identify the scope:**23 - Determine which files/commits to review (diff, specific files, or branch comparison)24 - Get the diff: `git diff` for the relevant range25262. **Understand the change:**27 - Review commit messages and PR description (if available)28 - Check git history for related recent changes29 - Identify the purpose and expected behavior of the change30313. **Map dependencies:**32 - Identify what other code depends on the changed files33 - Check for related test files34 - Note any configuration or schema changes3536### Phase 2: Multi-Dimensional Review3738Evaluate the code against each dimension in the Review Dimensions section below. For each dimension:39401. Walk through the relevant checklist412. Note any issues with severity (Critical/High/Medium/Low)423. Record the specific location (file:line)434. Document suggested fixes4445### Phase 3: Synthesis4647Produce a structured review following the template in `references/code-review-template.md`.48491. **Determine verdict:**50 - **APPROVE** - No critical/high issues, code is ready to merge51 - **NEEDS WORK** - Has issues that must be addressed before merge52 - **BLOCK** - Has critical issues, security vulnerabilities, or fundamental design problems53542. **Organize findings** by severity553. **Acknowledge strengths** - what's done well564. **Provide actionable fixes** - not just problems, but solutions5758## Review Dimensions5960### Correctness6162- [ ] Logic is correct and handles all expected cases63- [ ] Edge cases are handled (null, empty, boundary values)64- [ ] Assumptions are documented or validated65- [ ] Error states are handled appropriately66- [ ] Types are correct and conversions are safe6768### Security6970- [ ] No injection vulnerabilities (SQL, command, XSS)71- [ ] Input is validated and sanitized72- [ ] No secrets, credentials, or keys in code73- [ ] Authentication/authorization checks are correct74- [ ] Dependencies are secure and up-to-date7576### Performance7778- [ ] No unnecessary loops or redundant operations79- [ ] Algorithms are appropriate for the data size80- [ ] Memory usage is reasonable81- [ ] No N+1 queries or unbounded fetches82- [ ] Caching is used appropriately8384### Reliability8586- [ ] Errors are caught and handled gracefully87- [ ] Failures don't leave system in bad state88- [ ] Retry logic has backoff and limits89- [ ] Resources are properly cleaned up (connections, files, etc.)90- [ ] Timeouts are set for external calls9192### Maintainability9394- [ ] Code is readable and self-documenting95- [ ] Functions/methods have single responsibility96- [ ] Naming is clear and consistent97- [ ] No unnecessary duplication98- [ ] Follows project conventions and patterns99100### Testing101102- [ ] Tests exist for new/changed behavior103- [ ] Edge cases and error paths are tested104- [ ] Tests are deterministic (not flaky)105- [ ] Test names clearly describe what they verify106- [ ] Mocks/stubs are appropriate and not excessive107108## Escalation Criteria109110Flag for additional human review when:111112| Concern | Escalation Trigger |113| ---------------- | -------------------------------------------------------------------------------- |114| **Security** | Any auth changes, crypto usage, user data handling, or potential vulnerabilities |115| **Reliability** | Changes to error handling, retry logic, or failure recovery paths |116| **Performance** | Changes to hot paths, database queries, or algorithms with scale concerns |117| **Architecture** | New patterns, significant structural changes, or cross-cutting concerns |118| **Testing** | Reduced coverage, disabled tests, or changes to test infrastructure |119120## Constraints121122- **Review only what's in scope** - don't expand to unrelated code unless it's directly affected123- **Be specific** - reference exact file:line locations for all findings124- **Provide fixes, not just criticisms** - every issue should have a suggested resolution125- **Calibrate severity appropriately** - not everything is critical126- **Acknowledge good work** - positive feedback matters too127128## Examples129130### Example: Reviewing a New API Endpoint131132**Scope:** PR adds `POST /api/users` endpoint in `internal/api/users.go`133134**Phase 1 output:**135```136Files changed:137- internal/api/users.go (new handler)138- internal/api/routes.go (route registration)139- internal/db/users.go (new repository method)140141Related tests: internal/api/users_test.go (new)142Purpose: Add user creation endpoint for onboarding flow143```144145**Phase 2 findings:**146147| Severity | Issue | Location | Fix |148| -------- | -------------------------------------- | --------------- | ------------------------------ |149| High | SQL injection via unsanitized email | db/users.go:45 | Use parameterized query |150| Medium | Missing rate limiting | api/users.go:23 | Add rate limiter middleware |151| Low | Error message exposes internal details | api/users.go:67 | Return generic error to client |152153**Phase 3 verdict:**154```155Verdict: NEEDS WORK156157Critical/High Issues:158- SQL injection vulnerability must be fixed before merge159160What's Done Well:161- Clean separation between handler and repository162- Comprehensive input validation struct163- Good test coverage for happy path164165Action Items:1661. [High] Fix SQL injection in db/users.go:451672. [Medium] Add rate limiting to endpoint1683. [Low] Sanitize error messages returned to client169```170171---172173Begin by gathering context on the target files/commits before conducting the multi-dimensional review.174175---176> Converted and distributed by [TomeVault](https://tomevault.io/claim/thoreinstein) — claim your Tome and manage your conversions.177<!-- tomevault:4.0:skill_md:2026-04-13 -->