Can anyone share some prompts for code review?
I'm having Claude do PR reviews, but all I keep getting back is 'Looks good.' Could you give me some tips on how to structure the prompt?
8 answers
This is true lol — if you don’t explicitly specify the “reviewer” role in the prompt, it just turns into a praise machine.
Well, honestly, delegating code review to an LLM is kind of... wouldn't it be better to just ask a colleague instead? Of course, if you're developing on your own, that's a different story.
Here’s how I write it. 1) You are a senior backend engineer with 10 years of experience. 2) In the diff below, point out issues in this order: bugs/security/performance/readability. 3) No praise—just identify at least 3 problems. 4) Attach the supporting line number to each point. Just including these four things makes a huge difference.
Got a source? If you just wrote it based on gut feeling, it probably won’t be very helpful.
"Looks good" lollll I got the same treatment, but it was solved with one line: "Find at least 5 issues."
I disagree. No matter how carefully you craft the prompt, what the LLM ends up missing is things like architectural context, and it's unreasonable to expect a review tool to handle that. Use it only as a supplementary aid.
Isn’t that outdated? These days, models do just fine even when you simply ask them to review. Before blaming the prompt, try checking the model version or the diff size first.
What matters more than assigning a role is fixing the output format. If you specify severity/line/reason/suggested fix columns as a Markdown table, it will try to fill them in on its own. Also, don't feed in the entire diff—split it by file. As context gets longer, review quality drops sharply.