---
name: review-before-commit
description: "Review a diff against Selwyn's engineering standards before it is committed. Use after writing or changing code and before staging it. Checks for the things that pass a build but fail the bar: broad rewrites where a surgical edit would do, new dependencies or patterns added without justification, any on non-trivial data, dead code, leftover console logs or debug strings, and business logic that drifted into client components. Pairs with verify-before-ship, which checks the rendered page; this checks the code."
---

# Review Before Commit

The review I would give the diff before it goes in: smallest change that works, no new deps or patterns for no reason, no any on real data, no dead code, logic on the right side of the server boundary.

## Phases

Work through these in order.

### 1. Diff

Read the actual diff (git diff), not the intent. Confirm the change is the smallest edit that solves the problem and did not rewrite or reformat code it did not need to touch.

Read: [working-with-me](https://selwynuy.dev/d/working-with-me.md)

### 2. Standards

Check against the standing rules: no new dependency or pattern without a clear reason, no any for non-trivial data, no dead code or leftover console logs, no business logic pushed into client components, secure-by-default wiring kept intact.

Read: [working-with-me](https://selwynuy.dev/d/working-with-me.md), [system-architecture](https://selwynuy.dev/d/system-architecture.md), [type-system](https://selwynuy.dev/d/type-system.md)

### 3. Report

List what must change before commit and what is optional, plainly. Do not commit on the author's behalf; the review ends at a clear verdict, the human decides.

Read: [security-by-design](https://selwynuy.dev/d/security-by-design.md)

## Bundled files

- `references/review-checklist.md` (reference): The standards a diff is held to, grouped by scope, correctness, types, and architecture, each with what a violation looks like.

---

Part of Review Before Commit from Selwyn Uy's Next.js Handbook. Full page: https://selwynuy.dev/skills/review-before-commit
