Template · Engineering Practice

Code Review Checklist

A review template that moves pull requests past style nitpicks to correctness, edge cases, and performance anti-patterns like N+1 queries and missing error handling.

Audience: Tech Leads, Developers
Engineering Focus: Performance
Format: Review Template

Problem Statement

Without a structured code review protocol, reviews often focus on stylistic issues (formatting, naming) rather than logical correctness, security, performance, and maintainability. This checklist provides developers and reviewers with a set of engineering criteria to ensure high codebase standards.

When to Use

Use this checklist as part of the pull request template, code review processes, or when teaching junior engineers about clean code principles.

Step-by-Step Guide

Step 1: Logical Correctness and Intent

  • Verify the code meets the business requirements and functions as expected under edge cases.
  • Look for off-by-one errors, infinite loops, and race conditions.
  • Ensure proper error handling is implemented with informative log messages.

Step 2: Performance and Resource Use

  • Check for performance bottlenecks (e.g., N+1 query patterns, excessive memory allocations).
  • Validate database queries use appropriate indexing.
  • Review resource utilization (e.g., closing file streams, network connections, database handles).

Step 3: Maintainability and Testability

  • Check for clean module boundaries and proper separation of concerns.
  • Ensure unit and integration tests cover the new code paths.
  • Avoid introducing unnecessary third-party dependencies.

Checklist Items

  • Code changes solve the original business problem without introducing regression defects.
  • New functionality is covered by automated unit or integration tests.
  • No database queries are executed inside loop bodies (N+1 query pattern is avoided).
  • Exceptions and errors are caught, handled gracefully, and logged with appropriate context.
  • No hardcoded configuration, secrets, API keys, or environment settings exist in the code.
  • Naming of classes, variables, and methods is clear and conforms to the codebase conventions.
  • Code complexity is kept low, splitting large methods into smaller, cohesive units.
  • Third-party dependencies are only introduced if they are necessary and actively maintained.

Key Takeaways

  • Verify code correctness and edge-case handling before merging.
  • Eliminate database performance anti-patterns like loop-nested queries.
  • Ensure robust error-handling, clean modular boundaries, and complete test coverage.

Frequently Asked Questions

Why avoid N+1 query patterns in reviews?

Executing database queries within loops causes high latency and database CPU exhaustion as user concurrency grows.

Continue Exploring