Code Review Best Practices

Chapter 1 · Practice 4 of 4

Teach through reviews, but mark lessons as optional

From The standard for approving a change

Why it matters

Reviews are one of the best ways to share knowledge: a language feature, a better library function, a pattern used elsewhere in the codebase. Google's guide encourages these comments, with one condition: if the point is not required for the change to be approved, say so.

Prefix teaching comments clearly:

  • Nit: a small polish point the author can choose to skip
  • Optional: or Consider: an idea that is not required
  • FYI: something useful to know for next time, no action needed

Without labels, authors often treat every comment as mandatory, and a review full of helpful tips turns into an exhausting list of required work.

Example

Code
Nit: `items.length === 0` reads a little clearer than `!items.length` here.

FYI: there is a `formatMoney` helper in `lib/currency.ts` you can use next time.
No change needed in this PR.