| name | my-code-review |
| description | Code review principles and checklist for reviewing any codebase regardless of language. Use when the user asks to review code, perform a code review, assess a pull request, or evaluate code quality across design, tests, performance, security, and correctness. |
Code Review
Based on "What to look for in a code review" by Trisha Gee (Java Champion, JetBrains) and personal notes
When to use
- User asks to review code or a pull request
- User asks for a code review checklist
- User wants to assess the quality of a change
- User mentions design, readability, test coverage, security, or correctness concerns
Overview
A structured, language-agnostic checklist to guide thorough code reviews. Reviews should reduce cognitive load, catch correctness issues, and share knowledge โ not just find bugs.
Rules
Design
- Architecture fit โ Does the change align with the overall architecture and existing conventions?
- SOLID โ Are Single Responsibility, Open/Closed, Liskov, Interface Segregation, and Dependency Inversion respected?
- DDD โ Are domain concepts clearly named and properly modelled?
- YAGNI / KISS โ No speculative generality; prefer the simplest solution that works
- Code reuse โ Is there a refactoring or extraction opportunity to avoid duplication?
Readability & Maintainability
- Understandability โ Can a new reader understand the intent without context?
- Naming โ Are names precise, consistent, and self-documenting?
- Happy path vs exceptional cases โ Are both paths handled explicitly and clearly?
- Configuration vs hard-coded values โ No magic constants; prefer named config
Tests
- Coverage of new code โ Are all new branches and edge cases covered?
- Test intent โ Does each test name and assertion communicate why, not just what?
- Tests are code โ Apply the same quality rules (naming, readability, no duplication)
- Granularity โ Right level: unit > integration > end-to-end; avoid testing implementation details
- Edge cases โ Cardinality (empty, single, many), nullability, boundary values, error paths
- Limitations โ Are test limitations intentional and documented, or accidental gaps?
- Performance & security tests โ Are they needed? Are they present?
- Pair review option โ Reviewers can write missing tests as part of the review
Performance
- Requirements โ Does the implementation meet the stated performance requirements?
- Readability vs performance trade-off โ Only optimise when measurements justify it
- Network cost โ Are batching and call counts considered?
- Resource management โ Are connections, streams, and handles properly closed?
- Memory leaks โ Are data lifecycle and collection bounds controlled?
- Locks & race conditions โ Are shared resources properly protected?
- Concurrency vs parallelism โ Is the right model applied?
- Pool configuration โ Use safe defaults; only tune with evidence
Data Structures
- Right choice โ Is the data structure appropriate for the access pattern and complexity (Big-O)?
- Pitfalls โ Watch for lazy evaluation traps, infinite streams, or iterator invalidation
- Optionality โ Is absence of a value modelled explicitly (Option/Maybe/Optional) rather than null?
Security
- Automated checks โ Are dependency scanners (e.g. Dependabot) and SAST tools in CI?
- Dependency surface โ Are new dependencies justified and minimal?
- Regulatory requirements โ Does the change touch data subject to compliance rules (GDPR, PCI, โฆ)?
Correctness
- Wrong data structure โ Could the structure cause subtle bugs (e.g. set vs list, map ordering)?
- Race conditions โ Is concurrent access safe?
- Caching โ Are cache invalidation and staleness handled correctly?
Cross-cutting Concerns
- Documentation impact โ Does the change require updating docs, ADRs, or READMEs?
- UI / error messages โ Are user-visible messages clear, actionable, and tested?
- Automated vs human review split โ Delegate formatting/style to linters; focus human review on design and logic
Culture
- Share tooling: IDE configs, linter rules, and CI checks should be committed and consistent
- Reviewers should ask "Have you thought aboutโฆ?" for security, edge cases, and docs โ not just critique
- Prefer collaborative tone; a review is a knowledge-sharing session, not an audit