Skip to content
PromptIntermediateCoding

Code Review: Bug Hunt

Review a diff for correctness, security and missing tests before style feedback, with quoted evidence for each finding.

Reviewed May 16, 2026 · Claude · ChatGPT · Cursor · GitHub Copilot

Prompt workbench

Your variables

Remove secrets and production data first.

Works with: Claude, ChatGPT, Cursor, GitHub Copilot

Generated prompt
Review the following code change as a senior engineer.

Context: [Context]
Language / framework: [Stack]
What the change is supposed to do: [Change intent]
Known constraints: [Constraints]

Diff or code:
```
[Code or diff]
```

Review in this order:
1. Blocking correctness bugs, with the exact line and a minimal reproduction scenario.
2. Security issues (authorization, injection, secrets, unsafe deserialization).
3. Data-loss or concurrency risks.
4. Missing tests and edge cases.
5. Non-blocking maintainability suggestions.

For every finding, state severity (blocker / should-fix / nit), quote the relevant line, explain the impact and suggest a specific fix. If you are unsure, say so. Do not invent APIs or assume files that were not provided. If the diff is insufficient for a conclusion, list what you need.

What this prompt is for

Catch the issues that break production, not the ones that merely offend taste.

How to get a better result

  • Give the reviewer the intent and constraints; without them it will guess.
  • Ask for severity levels so you can ignore style noise.
  • Follow up with “write the smallest failing test for each blocker”.

Example input

A Next.js server action that deletes a bookmark after checking the user is signed in but not checking that the bookmark belongs to them.

Example output

Blocker: the delete uses the supplied bookmark ID without scoping the query to the current user. Any signed-in user who knows another user's bookmark ID can delete it. Fix: delete with a compound condition on userId and id, then verify the affected row count. Add a test where user B attempts to delete user A's bookmark and receives 404.

Example outputs are illustrative. Model behaviour varies; check the result before using it.

Limitations

  • • The model cannot run the code or see runtime state unless you provide it.
  • • It may miss business-logic bugs that depend on unstated requirements.
  • • Automated review does not replace human approval or security testing.

Related resources