Coding / Review a small change

Focused code review prompt

Review a supplied diff for concrete defects with reproduction steps and uncertainty.

The prompt

Context
Language/runtime: [versions]. Expected behavior: [requirements]. Diff and relevant surrounding code: [code].

Audience
[developer maintaining this project]

Goal
Find actionable defects introduced by this change.

Constraints
Base findings only on supplied code. Do not claim tests were run. Separate confirmed issues from assumptions. Ignore style preferences unless they violate a supplied rule. Never request secrets.

Output
For each finding: severity, location, triggering input, expected vs actual behavior, and a minimal suggested fix. If no concrete issue is found, say so and list verification gaps.

Copy the prompt, then open your preferred tool and paste it. These links do not send your prompt or run a model.

How to use

  1. Replace every bracketed field with relevant, non-sensitive context.
  2. Paste your own source material and specify the audience.
  3. Copy the prompt into your preferred assistant and review its response.
  4. Include the relevant caller and expected edge-case behavior.

Example input

Function: average(xs) { return xs.reduce((a,b)=>a+b,0)/xs.length; } Requirement: empty lists must return null.

Example output

Illustrative example written for this guide—not a recorded model result.

Finding: Empty input produces NaN rather than null. Trigger: average([]). Suggested fix: return null when xs.length is 0. Verification: execute empty, one-element, and multi-element cases. No tests were run.

Tips

Include the relevant caller and expected edge-case behavior. Ask for one targeted revision at a time and keep track of which instruction improved the draft.

Common mistakes

Accepting a speculative bug report without reproducing it. Missing source material cannot be repaired by confident wording.