Skip to content

Self‐Review Checklist for Code Commits

ANDREW W TAYLOR edited this page Sep 20, 2025 · 2 revisions

Deep Pre-Commit / Pre-PR Self-Review Checklist

Use this before every commit or PR. It combines IDE checks, GitHub checks, and ChatGPT prompts that surface bugs and improvements you would likely miss. If any of this is unfamiliar ask ChatGPT to explain. You can also paste in this checklist and have it guide you through.

With ChatGPT Connectors or Claude Code, you can give it access to the repo and just run the checklist for you (fastest). If you haven't learned about this, and "agentic swarm coding", you should get up to speed FAST if you plan to work in software development (as of 2025).


0) Prep

  • Sync with main: git fetch origin && git rebase origin/main
  • Stage intentionally: git add -p
  • Review staged changes: git diff --staged

1) Correctness & Contracts

  • Commit does one coherent thing
  • Inputs validated at boundaries; defaults explicit
  • Edge cases considered: empty/None/null, 0/1, large N, unicode/emoji, timezones/DST
  • Idempotency where relevant
  • Randomness/time/network calls controllable in tests

2) Errors & Logging

  • No swallowed exceptions
  • Context-rich error messages
  • Structured logs where appropriate

3) Tests

  • Unit tests: positive, negative, boundary, regression
  • Touched lines covered (aim ≥80% coverage locally)
  • Tests isolated from wall-clock, network, global state
  • Fixtures representative of real data

Run common stacks:

  • Python: pytest -q
  • JS/TS: npm test -- --watchAll=false
  • Go: go test ./...

4) Style & Structure

  • Names descriptive and consistent
  • Functions < 50 lines; helpers extracted
  • Comments/docstrings explain why
  • Type hints / TS types up to date
  • Formatters and linters run (black, ruff, eslint, prettier)

5) Performance

  • Big-O unchanged in hot paths
  • No unnecessary memory copies
  • Batch DB/Network operations
  • Timeouts & retries bounded

6) Security & Secrets

  • No secrets in code or diffs (.env, keys, dumps ignored)
  • Inputs sanitized; no unsafe eval/exec
  • SQL parameterized; file paths validated
  • Dependencies scanned (pip-audit, npm audit, go list -m -u all)

7) Concurrency & Async

  • Locks/awaits correct; shared state safe
  • Timeouts on I/O
  • Retries bounded with jitter

8) Data & IO

  • Schema validated (pydantic/dataclasses/TS types)
  • File readers robust to BOMs, CRLF, missing headers
  • Time stored in UTC; conversions explicit

9) API/CLI/UX

  • CLI flags documented; --help updated
  • HTTP APIs: pagination, 429/5xx handling
  • UI: error/loading/empty states, accessibility basics

10) Observability

  • Logs/metrics/traces for new failure modes
  • Feature flags scoped
  • Rollback plan if migration involved

11) IDE Sweep

  • Remove TODO|FIXME|HACK|XXX
  • Strip print/console.log/debuggers
  • Normalize whitespace/line endings
  • Exclude large/unwanted files (git diff --staged --stat)

12) GitHub Flow

  • Commit message follows Conventional Commits
  • git range-diff origin/main...HEAD clean
  • PR self-reviewed in split view
  • PR description includes risk + rollback notes

Final Gate

  • All checks green
  • Tests pass locally
  • Risk and rollback noted in PR
  • Ready for teammate review

ChatGPT Prompt Pack for Code Review

Use these prompts with your staged diff (git diff --staged) or PR content. They speed up reviews and find issues you’d likely miss.


1) Diff Review + Test Gaps

Act as a strict reviewer. Identify logic bugs, edge cases, race conditions, and missing tests. Return concrete patch diffs and name specific tests to add.

[paste git diff --staged]

2) Adversarial Inputs & Property Tests

List adversarial inputs for each public function in this diff and write minimal failing tests (pytest/Jest) that would catch them. Prefer property/metamorphic tests.


3) Complexity & Performance

Estimate time/space complexity changes in this diff. Identify O(n²) or memory hotspots and suggest low-risk speedups.


4) Security Pass

Perform a security review of this diff: injection, deserialization, path traversal, secrets. For each risk, propose exact patches and tests.


5) API Contracts & Failure Modes

Enumerate assumptions in this code (inputs, services, files). For each, provide a failure test and an improved error message.


6) Refactor Roadmap

Propose a 3-commit refactor plan with no behavior changes to improve readability and maintainability. Provide tiny diffs for each step.


7) Commit Message + PR Description

Suggest a high-quality Conventional Commit message and PR description with:

  • Why the change
  • What changed
  • Risks & rollback plan
  • Test plan

8) Red-Team Review

Act as my adversarial reviewer. Attack assumptions in this diff. Where could it fail in production? Provide repro steps and fixes.


9) Observability Hooks

Propose observability hooks (logs, metrics, traces) for these functions. Give copy-paste snippets in the project’s style.


10) Fast Scan

List quick wins from this diff: dead code removal, unused imports, better error messages, improved variable names. Output as a checklist.

Clone this wiki locally