Evaluate the commits you make.
Do this as you code and commit. Paying attention here, spending an extra 5 minutes to deeply understand the changes you made - and refreshing your mind on previous commits - will save time and potential headache ten-fold later down the line.
Questions to ask yourself
- Does each commit make sense where it is?
- Are the names of functions and variables correct?
- Are the diffs in the right place and in the correct order?
- Does each commit compile and pass the tests?
- What impact does each commit have?
Review your own code
This should be done in a separate environment to the one you code in. For me, this could be GitHub (or any other online PR viewer), or in a local diff view.
Questions to ask yourself
- Does each commit still make sense?
- High level overview: Does it actually work? Are you wiring the correct functions to the correct place? We often miss the bigger picture when we’re down in the code.
- Does the architecture make sense? Are the functions you choose and the abstraction you made worth it?
- Does it work E2E?
- Nits. Do the names make sense, is the spacing correct. Less important, but still very important. If you can’t understand your own code, how can others?
Optional: Have AI review your code
You can use a good agent, with a good prompt, and access to your code base (it must be aware of coding style and general abstractions), to review your code. The agent should have some understand of the code base. Otherwise it might have to go and find it each time.
It will catch things you didn’t think of, and act as a barrier between you and the reviewer, so that the reviewer has less to catch.
Review from a reviewer
Hand the PR to another engineer in your team, who has an understand of the areas you’ve changed. This process is last, and takes the longest, so you want to arrive at this step having made sure that lower level errors have been corrected, and let the reviewer worry about higher level reviewing (although the reviewer should still pick things apart and comments their nit picks).