Code review best practices for authors and reviewers
How to make code reviews fast, kind and genuinely useful, including reviews of AI-generated code.
Key takeaways
- Small PRs get better reviews, faster.
- Review for correctness, design and clarity. Let tools handle style.
- Be kind and specific, and distinguish "must fix" from "nit".
Code review is where quality, knowledge sharing and team culture meet. Done well, it's the best learning tool a team has. Done badly, it's a bottleneck and a source of friction.
#For authors
- Keep it small: under ~400 changed lines, one purpose.
- Write a good description: what, why, how to test, and screenshots for UI.
- Self-review first: read your own diff as if it were someone else's.
- Point reviewers to the tricky parts: "The retry logic in
queue.tsis the part I'm least sure about." - Don't take it personally. Feedback is about the code.
#For reviewers
Review in this order:
- Does it solve the right problem?
- Is it correct? Edge cases, errors, concurrency, security.
- Is the design reasonable? Fits the architecture? Duplicates something?
- Is it clear? Names, structure, tests that explain intent.
- Style: only if tooling doesn't already enforce it.
#Comment like a teammate
- Be specific: "This will run N+1 queries for each order; could we batch-load customers?"
- Ask, don't command: "What happens if
itemsis empty?" - Label severity:
blocking:,suggestion:,nit:,question:. - Praise good work. "Nice, this test makes the rule very clear."
#Speed matters
Aim to respond within one working day, ideally a few hours. Slow reviews create huge PRs, context switching and frustration. Many teams reserve two short daily review slots.
#Reviewing AI-generated code
- Hold it to the same standard as human code, or a higher one.
- Watch for plausible but wrong logic, invented APIs and silent error swallowing.
- Check for duplication of existing utilities, which AI often reinvents.
- The author must be able to explain every line. "The AI wrote it" isn't an answer.
Tip: Use AI as a first reviewer to catch obvious issues before a human looks. It doesn't replace the human review.
#Team agreements to write down
- Max PR size and review turnaround time.
- Who must approve what (e.g. security-sensitive code).
- When it's OK to merge with comments outstanding.
Keep reading
How many tests of which kind, how to write tests that catch real bugs, and how AI changes testing.
A practical, layered defense so that faster code generation doesn't mean more production incidents.
Five principles for code that is easy to change, each explained with a short example and a warning about overuse.