Writing Pull Requests Senior Engineers Actually Want to Review
From Mid-Level to Senior · Part 3 of 18
- #pull-requests
- #code-review
- #senior-engineer
- #engineering-practices
Every team has that one pull request sitting in the queue. It's been open for four days. It has 47 changed files, a title like "Refactor + fixes", and an empty description. Everyone has looked at it at least once, scrolled for a bit, and quietly closed the tab.
Nobody is being lazy there. The PR is just expensive to review. The reviewer has to figure out what the change is for, where to start reading, which parts matter and which are noise, and how to know if it actually works. All of that is work the author could have done in ten minutes, and didn't.
In Part 2 we talked about keeping branches short. This part is about what happens when that branch is ready: turning it into a pull request that someone can review properly, quickly, and without having to guess.
A PR is a request for someone's attention
It helps to be honest about what a pull request is. It's you asking a teammate to stop what they're doing, load your problem into their head, and take shared responsibility for your code. That's a real cost, and it's paid by someone else.
Mid-level engineers tend to think of the PR as the last step of their task. Senior engineers think of it as the first step of someone else's. The code might be the same in both cases. The PR around it is very different.
There's also a selfish reason to care. Six months from now, somebody will run
git blame on a line that's causing an incident and land on your PR. Quite
often that somebody is you. A PR with a clear description is the best
documentation of why the code looks the way it does, and it's the only kind
that's attached to the exact lines it explains.
Size: the thing that matters most
If you only change one habit, make it this one. Small PRs get better reviews. Not a little better. Much better.
Anyone who has reviewed code for a while knows the pattern. Send a 20-line diff and you get three sharp comments. Send a 900-line diff and you get "LGTM" an hour later. Studies of code review (the often-quoted one is the SmartBear/Cisco study) point the same way: reviewers find fewer problems per line once a review goes past a few hundred lines. The exact number isn't the point. The shape of the curve is.
Some practical rules that help:
- One PR, one purpose. A bug fix, a refactor and a new feature are three PRs, even if you did them in the same afternoon. If the title needs the word "and", it's probably two PRs.
- Move and change separately. If you're moving a class to a new package and changing its logic, do the move first. A pure move is trivial to review. A move with edits hidden inside it is almost impossible.
- Keep formatting out. Reformatting a file inside a feature PR buries the three lines that matter under three hundred that don't. If a file needs reformatting, do it in its own PR and say so in the title.
- Generated code gets a warning. Lock files, snapshots and generated clients inflate the diff. Mention them in the description so the reviewer knows to skip them.
A rough target I'd use for backend work: under 400 changed lines of real code, reviewable in about 20 minutes. Some changes can't get that small, and that's fine. They're the exception, and they should come with a better description, not a worse one.
The description: why, what, and how to verify
Most PR templates ask for a "summary". That usually produces a list of files that changed, which the reviewer can already see in the diff. What they can't see is the context in your head. That's what the description is for.
A good description answers four questions:
- Why does this change exist? The problem, in one or two sentences. Link the ticket, but don't make the ticket the only explanation. Tickets get moved, closed and deleted. The PR stays in the history.
- What did you change? The approach, not a file list. "Added a retry table and a scheduled job that retries failed webhooks with backoff" tells the reviewer what to look for. If you considered another approach and dropped it, say so in one line. That saves a whole comment thread.
- How can someone verify it? Tests you added, and the steps to check it by hand if that matters. This is the part most people skip, and it's the part that turns "looks fine" into "I checked it".
- What should the reviewer focus on? Where to start reading, which part you're unsure about, what's safe to skim. This is a map, and reviewers love a map.
For anything visible (UI changes, API responses, log output, a dashboard) add a screenshot or a before/after example. A picture of the new error message is faster to review than the code that builds it, and it catches problems code review never will, like text that's cut off or a JSON field with the wrong casing.
It doesn't have to be long. Five good sentences beat three paragraphs of filler. The test is simple: could someone who wasn't in your standup understand this PR without asking you anything?
Review your own PR first
This is the cheapest habit on the list, and it catches a surprising amount. Before you request a review, open the PR in the browser and read the diff top to bottom as if someone else wrote it.
It's different from reading your code in the editor. In the diff view you see only what changed, and you see it the way the reviewer will. Things jump out:
- A
System.out.printlnor commented-out block you forgot to remove. - A file you changed by accident while debugging.
- A method name that made sense at 4pm and makes no sense now.
- The spot where you'll obviously get the question "why is this here?"
For that last one, you have two options. Either change the code so the question doesn't come up, or leave a comment on your own PR answering it before anyone asks. Both are fine. Leaving it for the reviewer to find is not.
Also make sure CI is green before you ask anyone to look. Asking for a review on a red build tells people you haven't finished yet, and they'll treat your next request that way too.
Stacked PRs for work that can't be small
Sometimes a feature really is big. A new payment flow might need a migration, a new service, changes to two existing services, an API endpoint and some config. You can't make that a 200-line PR. But you also don't have to make it one 2,000-line PR.
Stacked PRs split the work into a chain, where each PR builds on the one before it:
- The database migration, on its own. Additive, easy to review, safe to merge early.
- The service logic, behind a feature flag, with its tests. It ships to production turned off.
- The API endpoint or UI that uses it, and the change that turns the flag on.
Each PR is small enough to review properly, and each one can merge as soon as it's approved. Nobody waits two weeks for one giant review. This connects directly to what we covered in Part 2: stacked PRs are how you keep branches short even when the feature isn't.
The mechanics take a bit of care. Each branch starts from the previous one,
and when the base PR changes you rebase the ones above it. git rebase --update-refs helps a lot here, since it moves every branch in the stack in
one go. Tools like Graphite or ghstack automate more of it, but plain Git
is enough to start. Put "Part 2 of 3, depends on #123" at the top of each
description so reviewers know where they are in the stack.
If the stack feels like too much overhead, even a simpler version helps: merge the migration and the refactoring first, then open the feature PR on top of a clean base.
Make it easy to say yes
A few smaller things that add up:
- Write a title that works in a changelog. "Retry failed payment webhooks with backoff" beats "Fix webhooks" and "PAY-1234".
- Open it as a draft early if you want feedback on direction. Say clearly what kind of feedback you want: "Is this approach OK? Don't review the details yet."
- Pick the right reviewer. Someone who knows that part of the code, plus someone who doesn't if you want to spread context. Say why you tagged each one.
- Keep commits readable if your team merges without squashing. As we saw
in Part 2,
git rebase -iturns "wip" and "fix again" into steps a reviewer can follow. - Answer every comment, even if the answer is "done" or "good point, I'll do it in a follow-up (#456)". An unanswered comment makes the reviewer check again.
What to try this week
- Before your next PR, review your own diff in the browser and fix what you find.
- Split your next big change into at least two PRs, even if it's only "refactor first, feature second".
- Add a "How to verify" section to your team's PR template if it doesn't have one. It's a small change that raises the bar for everyone.
- Look at your last five merged PRs. Would they make sense to someone
running
git blamea year from now? If not, you know what to fix.
The short version
- A PR is a request for someone else's time. Make it cheap to spend.
- Small PRs get real reviews. Big PRs get skimmed. Aim for one purpose and a few hundred lines.
- A good description covers why, what, how to verify, and where to focus. Add screenshots for anything visible.
- Review your own diff before anyone else does, and ask for review only when CI is green.
- When a change can't be small, stack it: migration, then logic behind a flag, then the part that switches it on.
Writing the PR is half of the job. Next up, in Part 4, we'll look at the other half: reviewing someone else's code in a way that improves it without wrecking anyone's morale.
This is Part 3 of 18 in the series. The Senior Engineer Roadmap maps the whole series, with a short self-assessment and four reading orders.