{"id":104,"date":"2026-06-23T09:15:00","date_gmt":"2026-06-23T09:15:00","guid":{"rendered":"https:\/\/np.themestate.com\/promptpress\/?p=104"},"modified":"2026-10-24T15:18:55","modified_gmt":"2026-10-24T15:18:55","slug":"code-review-prompts-diff-not-lecture","status":"publish","type":"post","link":"https:\/\/demo.themnific.com\/promptpress\/code-review-prompts-diff-not-lecture\/","title":{"rendered":"Code Review Prompts: Getting a Diff, Not a Lecture"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Ask an AI to &#8220;review this code&#8221; and you usually get an essay: naming tips, a reminder about tests and a refactor nobody asked for. <strong>A good review prompt narrows the job down<\/strong> to what you actually need right now. The prompts in our <a href=\"\/prompts\/kind\/code\/\">code collection<\/a> all start from that idea.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The two changes that make the biggest difference are <strong>ranking issues by severity<\/strong> and <strong>asking for a diff instead of a rewrite<\/strong>. Both are easy to add to any prompt, and they pair well with the <a href=\"\/codebase-context-without-pasting-everything\/\">context brief<\/a> we described earlier.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The default prompt and its problem<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">Review this code and suggest improvements.<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This gives the model no priorities and no stopping point. It will happily comment on everything, and the one real bug ends up as point seven of twelve.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">A review prompt that stays focused<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>Review the code below for a pull request.\n\nFocus only on:\n1. Bugs and incorrect behaviour\n2. Security issues (input validation, escaping, permissions)\n3. Performance problems that matter at {{expected_scale}}\n\nIgnore style and naming unless they hide a bug.\n\nFor each issue give: severity (high \/ medium \/ low), the line,\none sentence explaining the problem, and the fix.\nThen output a unified diff with only the high-severity fixes.<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Why a diff beats a rewrite<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">A full rewritten file hides what changed. A diff shows it at a glance, and you can apply it with <code>git apply<\/code> or copy only the lines you agree with. It also stops the model from &#8220;improving&#8221; unrelated code along the way.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>--- a\/src\/Export.php\n+++ b\/src\/Export.php\n@@ -42,7 +42,7 @@\n-    $file = $_GET['file'];\n+    $file = sanitize_file_name( wp_unslash( $_GET['file'] ?? '' ) );\n     if ( ! current_user_can( 'export' ) ) {<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Severity levels keep the review honest<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n\n<li><strong>High:<\/strong> wrong results, data loss or a security hole. Fix before merging.<\/li>\n\n\n<li><strong>Medium:<\/strong> works now but will break under real load or edge cases.<\/li>\n\n\n<li><strong>Low:<\/strong> worth a note, not worth blocking the merge.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If everything comes back as high, the model is padding. Add one line to the prompt: <em>&#8220;If there are no high-severity issues, say so.&#8221;<\/em><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n\n<p class=\"wp-block-paragraph\">The best AI review is the one that tells you there&#8217;s nothing serious, and means it.<\/p>\n\n<cite>Lead developer, after three months of AI-assisted reviews<\/cite><\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\">Still review the review<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">AI reviewers miss things and sometimes invent problems that don&#8217;t exist. Treat the output as a second pair of eyes, not a gate. Run the tests and read the diff before you apply it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ask an AI to review your code and you often get an essay about best practices. A few constraints turn that into a ranked list of real issues and a diff you can apply.<\/p>\n","protected":false},"author":2,"featured_media":8145,"comment_status":"open","ping_status":"closed","sticky":false,"template":"template-fullwidth-narrow.php","format":"standard","meta":{"footnotes":""},"categories":[55],"tags":[],"class_list":["post-104","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding-with-ai"],"_links":{"self":[{"href":"https:\/\/demo.themnific.com\/promptpress\/wp-json\/wp\/v2\/posts\/104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demo.themnific.com\/promptpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demo.themnific.com\/promptpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demo.themnific.com\/promptpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/demo.themnific.com\/promptpress\/wp-json\/wp\/v2\/comments?post=104"}],"version-history":[{"count":1,"href":"https:\/\/demo.themnific.com\/promptpress\/wp-json\/wp\/v2\/posts\/104\/revisions"}],"predecessor-version":[{"id":8146,"href":"https:\/\/demo.themnific.com\/promptpress\/wp-json\/wp\/v2\/posts\/104\/revisions\/8146"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/demo.themnific.com\/promptpress\/wp-json\/wp\/v2\/media\/8145"}],"wp:attachment":[{"href":"https:\/\/demo.themnific.com\/promptpress\/wp-json\/wp\/v2\/media?parent=104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demo.themnific.com\/promptpress\/wp-json\/wp\/v2\/categories?post=104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demo.themnific.com\/promptpress\/wp-json\/wp\/v2\/tags?post=104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}