Skip to content
AI Skill Index

Review a diff like a senior engineer

Looks for defects and consequences, not style opinions a linter already covers.

Author: Editorial
Sign in to save
Review this change the way someone accountable for it in production would.

```diff
[PASTE DIFF]
```

Context: [WHAT THIS CHANGE IS MEANT TO DO]

Report only things that would change my decision to merge:

- **Correctness** — inputs where this produces a wrong result or throws. Give the input.
- **Consequences** — what else depends on the behaviour being changed here.
- **Missing cases** — the error path, the empty case, the concurrent case.
- **Tests** — what is now untested that matters. Not coverage percentages.

Rules: no style comments — formatting and naming conventions are a linter's job. No praise. If a finding is a guess because you cannot see the rest of the codebase, mark it as a guess. If the change is fine, say it is fine and stop; padding a review with minor observations to look thorough is worse than a short review.

Highlighted parts are placeholders. Replace them before you send.

Worked example

The input is invented for this page. The output shows what the prompt asks for with that input.

Example input (invented)

Diff

--- a/pricing.py
+++ b/pricing.py
@@ -1,4 +1,9 @@
-def apply_discount(total, code):
-    if code == "WELCOME10":
-        return round(total * 0.9, 2)
-    return total
+CODES = {"WELCOME10": 10, "SPRING25": 25}
+
+
+def apply_discount(total, code, used_codes=[]):
+    percent = CODES[code.upper()]
+    if code in used_codes:
+        return total
+    used_codes.append(code)
+    return round(total * (1 - percent / 100), 2)

Context: Add a second discount code, SPRING25, and stop a code from being used twice.

Example output

Correctness

  • apply_discount(50, "TYPO") raises KeyError. Before this change an unknown code returned 50.
  • apply_discount(50, None) raises AttributeError on code.upper(). Before, it returned 50.
  • Without used_codes, every call shares the one default list. apply_discount(100, "WELCOME10") returns 90.0 once and 100 on every later call, for any customer, until the process restarts.
  • The lookup upper-cases the code and the reuse check does not. With one list, "welcome10" and then "WELCOME10" both return 90.0. The code is used twice, which is what this change is meant to stop.

Consequences

  • A guess, because I cannot see the callers: a checkout that passes on what the customer typed now fails on a typo, where it used to charge the full price.
  • "welcome10" in lower case used to get no discount and now gets 10%. That looks intended. Confirm it.

Missing cases

  • The error path. An unknown code, None and an empty string all throw.
  • The concurrent case. Two requests that rely on the default list block each other's codes. A guess about your deployment: with several worker processes each has its own list, so the same code is refused in one and accepted in the next.

Tests

  • An unknown code and a missing code return the total unchanged.
  • Two calls without used_codes both get the discount.
  • One code typed in two cases, with one list, is discounted once.
  • apply_discount(100, "SPRING25", []) returns 75.0. Nothing covers the new code.
ShareXLinkedIn

3 of the 7 other prompts filed under Coding.

Coding tools and skills

3 of the 9 tools and 3 of the 7 skills filed under Coding, the same category as this prompt.

Tool

Aider

Pair programming with an LLM in the terminal, wired directly to git.

Open source
Tool

Claude Code

Anthropic's agentic coding tool for the terminal and IDE.

Paid
Tool

Cline

An open-source coding agent that runs inside VS Code with your own API key.

Open source
Skill

Code reviewer

Reviews a diff for defects, and refuses to pad the list with style opinions.

Claude Code, Cursor, Any agent
Skill

Commit message writer

Writes commit messages that explain why, from the staged diff.

Claude Code, Cursor, Any agent

Guides that use this prompt

3 guides list this prompt under "Used in this tutorial".

Coding

Reviewing code an AI wrote

It compiles, the tests pass, and it reads well. That combination is exactly why it needs a different kind of review.

Intermediate·2 min read

Cookies

We use only the cookies this site needs to work. Optional analytics helps us see which content is worth writing more of — nothing loads until you say yes.

Read the privacy policy