For developers
How to do a good code review, and how to receive one
Good code reviews catch bugs and spread knowledge without slowing the team. Learn what to look for, how to word comments, and how to make your own changes easy to review.

A good code review checks that a change works, is safe and can be maintained, and does it in a way that helps the author rather than blocking them. Done well, code review is one of the most effective ways a team has to catch bugs early and share knowledge. Done badly, it becomes a slow, frustrating gate.
This guide covers what code review is for, what to look at and in which order, how to write comments that land well, and how to prepare and receive a review as an author.
What is code review for?
Catching bugs is the obvious goal, but it is not the only one. Reviews spread knowledge, so more than one person understands each part of the system. They keep the codebase consistent, so newcomers can find their way. They also give junior and senior developers a regular, practical way to learn from each other.
Keeping these goals in mind changes how you review. The question is not 'is this exactly how I would have written it?' but 'does this change make the codebase better, and is it safe to ship?' A change that improves things and has no real problems should be approved, even if it is not perfect.
What should you look at, and in what order?
Start broad and narrow down. There is no point polishing variable names in code that is solving the wrong problem. A practical order:
- Purpose: read the description. Is the problem clear, and is this the right approach?
- Design: does the change fit the existing structure, or does it add unnecessary complexity?
- Correctness: does it do what it claims, including edge cases, empty inputs and errors?
- Security: is user input validated, are secrets kept out, are permissions checked?
- Tests: are the important behaviours tested, and would the tests fail if the code broke?
- Readability: will someone understand this in six months? Are names clear?
- Details: style, small simplifications and typos, ideally handled by automated tools.
The question is not whether this is how you would have written it, but whether it makes the codebase better and is safe to ship.
How do you write review comments that help?
Review comments are read without your tone of voice, so they can easily sound harsher than you meant. Comment on the code, not the person: 'this function could return early' rather than 'you made this too complicated'. Explain why something matters, so the author learns the principle rather than just the fix.
Make the weight of each comment clear. Many teams use prefixes such as 'nit:' for small optional suggestions, 'question:' when you genuinely want to understand, and 'blocking:' for problems that must be fixed before merging. Asking a question, such as 'what happens if the list is empty here?', often works better than a demand.
Say what is good, too. Pointing out a clever simplification or a well-written test reinforces good habits and makes critical comments easier to hear.
How big should a change be for review?
Small changes get better reviews. A reviewer can hold a few hundred lines in their head and think carefully about each one. Faced with thousands of lines, most people skim and approve, which defeats the purpose.
If a feature is large, split it into a series of smaller changes that each make sense on their own: first a refactor with no behaviour change, then the new data model, then the interface. Separate formatting or renaming changes from logic changes, so reviewers are not hunting for the one real edit among hundreds of cosmetic ones.
How should you prepare your own code for review?
As the author, you can make the reviewer's job much easier, and you will get faster, more useful feedback in return.
- Review your own diff first and remove debugging code, commented-out blocks and unrelated changes.
- Write a description: what problem this solves, how, and anything you are unsure about.
- Explain how to test it, and include screenshots for visual changes.
- Make sure automated tests, linters and formatters pass before asking for review.
- Point reviewers to the most important or riskiest parts.
- Keep commits focused, with clear messages.
How do you receive feedback well?
Treat comments as feedback on the code, not on you. Assume good intent, even when a comment is blunt. If you disagree, explain your reasoning; reviewers are sometimes missing context that you have. If a discussion goes back and forth more than a couple of times, switch to a short call. It is usually faster and friendlier.
Respond to every comment, either by making the change or by explaining why not, so the reviewer knows nothing was missed. When feedback reveals a gap in your knowledge, that is the review working as intended.
Teams also benefit from agreeing on turnaround times. A review that sits untouched for days blocks the author and leads to bigger, riskier changes. Many teams aim to give at least a first response within a working day.
What should automated tools handle instead?
People are poor at spotting missing semicolons and inconsistent indentation, and arguing about them wastes goodwill. Formatters, linters, type checkers and automated tests should run on every change, so human reviewers can spend their attention on logic, design and risk.
If the same style comment keeps coming up in reviews, turn it into a linter rule or a line in the team's style guide. That ends the debate once and for all, instead of repeating it in every review.
Frequently asked questions
How long should a code review take?
+
For a small, focused change, often between a few minutes and an hour of careful reading. If a review takes much longer, the change is probably too big and should be split.
What is a nit in code review?
+
A nit is a minor, optional suggestion, such as a slightly better variable name. Marking it as a nit tells the author it should not block merging.
Should junior developers review senior developers' code?
+
Yes. Juniors learn a lot from reading experienced colleagues' code, and their questions often reveal unclear code or missing documentation. Everyone's code benefits from a second pair of eyes.
What is the difference between a pull request and a code review?
+
A pull request, or merge request, is a proposal to merge a branch, usually on a code hosting platform. Code review is the process of reading and commenting on that proposed change.
How many reviewers does a change need?
+
Many teams require one approval for normal changes and two for risky areas such as security or payments. More reviewers is not always better, because each may assume another checked closely.
Can AI tools do code review?
+
Automated assistants can flag possible bugs and style issues. They are a useful extra check, but a human who understands the system and its goals should still approve changes.
Review the purpose first, the details last, and write comments you would be happy to receive. Keep your own changes small and well described, and reviews become something the team looks forward to rather than waits on.
How we research: Guides are written from established sources and checked for accuracy. They are general information, not professional advice.
Written by
Cursorlane Editorial Team
Software & tools
Our writers are developers and heavy software users who test what they write about and update guides when the tools change.


