Coding prompt · Built for Ragnarök

Review a diff for production risks

Reviews a change for the failures that only appear under real traffic and real data, and separately lists which of the new behaviour has no test.

The prompt

Review this change for what breaks in production. Ignore style.

Diff:
[PASTE THE DIFF]

What this change is meant to do: [ONE OR TWO SENTENCES]
Where it runs: [SERVICE, AND WHETHER IT IS A REQUEST PATH, JOB, MIGRATION, OR STARTUP]
Scale it sees: [REQUESTS OR ROWS, ROUGHLY]
What it talks to: [DATABASE, QUEUES, EXTERNAL APIS, CACHES]
How it gets deployed: [ROLLING, ALL AT ONCE, BEHIND A FLAG]

Produce four sections.

1. WILL BREAK — things that fail under conditions this code will actually meet: empty and enormous inputs, concurrent execution, partial failure of something it calls, retries, a request arriving mid-deploy while old and new code both run. For each: the condition, what happens, and how bad.

2. WILL DEGRADE — no error, worse behaviour. Queries whose cost grows with data, work added to a hot path, a lock or transaction held longer, unbounded memory, a new synchronous call to something that can be slow.

3. NOT COVERED BY TESTS — go through the behaviour this diff introduces or changes and say which parts no test in the diff exercises. Name the specific case, not "add more tests". Include error paths and the boundaries of any new condition.

4. IRREVERSIBLE — anything that cannot be undone by rolling back the code: schema changes, data written in a new shape, messages published, external calls with side effects.

Rank sections 1 and 2 by expected damage. If the diff is missing context you need, say which file. Do not comment on formatting or naming.
Try in Rekdan

Replace the outlined parts before running

  • [PASTE THE DIFF]
  • [ONE OR TWO SENTENCES]
  • [SERVICE, AND WHETHER IT IS A REQUEST PATH, JOB, MIGRATION, OR STARTUP]
  • [REQUESTS OR ROWS, ROUGHLY]
  • [DATABASE, QUEUES, EXTERNAL APIS, CACHES]
  • [ROLLING, ALL AT ONCE, BEHIND A FLAG]

When to use this

The reason a passing review does not prevent an incident is that reviewing reads the code, and production runs it — against data nobody wrote a fixture for, at a concurrency nobody simulated, while a deploy is halfway through and two versions of the code are live at once. Asking plainly for a review gets you a competent read of the code as written: naming, structure, an off-by-one. Useful, and not the thing that pages you at night.

This prompt names the production conditions explicitly, which is the whole trick — the model is entirely capable of spotting the query that gets slow at a million rows or the migration that breaks the old code still serving traffic, but only if it is asked about that rather than about the diff in the abstract. That is also why the context questions matter: a change to a request path and the same change in a nightly job have different failure modes, and without knowing which one it is the review defaults to generic.

Section three is the second output. Naming which specific new behaviour has no test is more useful than any coverage number, and it is the section people find uncomfortable, which is a reasonable sign it is working.

How to use it

  1. Give it the deploy model

    Rolling deploys mean old and new code run simultaneously for minutes. A large share of real incidents live in that window, and it is invisible from the diff alone.

  2. Be honest about scale

    'A few thousand rows' and 'forty million rows' produce completely different section-two findings. If you do not know the number, say the order of magnitude.

  3. Include the tests in the diff

    Section three needs to see what you tested. Without the test files it will list everything as uncovered, which is noise you will learn to skip past.

  4. Push back on findings that do not apply

    Tell it which constraint makes a finding impossible — 'this only ever runs single-threaded' — and ask it to redo the ranking. That is faster than re-reading the diff yourself, and it usually surfaces something adjacent.

Variations

For a database migration

Review this migration for what happens when it runs against the real table.

Migration: [PASTE]
Table size and write rate: [ROWS, AND WRITES PER SECOND]
Database and version: [DETAIL]
Deploy order: [DOES THE MIGRATION RUN BEFORE OR AFTER THE CODE THAT USES IT]
Downtime allowed: [NONE, OR A WINDOW]

Produce:
1. LOCKS — what this takes, for how long, and what is blocked meanwhile at the stated size.
2. THE WINDOW — what breaks while old code and the new schema coexist, in both orders.
3. ROLLBACK — whether this can be reversed, and what is lost if it cannot.
4. AT SCALE — what changes about the answers above at ten times the row count.
5. A SAFER SEQUENCE, if this needs to be split into multiple deploys — write out the steps.

For a change to an API other people call

Review this change for whether it breaks existing callers.

Diff: [PASTE]
Who calls this: [INTERNAL SERVICES, PUBLIC CLIENTS, MOBILE APPS THAT DO NOT UPDATE]
Versioning: [HOW, OR "NONE"]

Produce:
1. BREAKING CHANGES — including the quiet ones: a field that is now absent instead of null, a stricter validation, a changed error code, a new required parameter, altered ordering.
2. WHAT A CLIENT ON OLD CODE DOES when it meets the new response — specifically, not "it may fail".
3. UNDOCUMENTED BEHAVIOUR THIS CHANGES that callers have probably come to depend on.
4. WHAT WOULD MAKE IT COMPATIBLE, if there is a version worth having.

Treat any client that cannot be updated on demand as the constraint.

Where it falls short

  • On a diff that touches many files at onceIt sees the changed lines, not the system. Cross-file interactions and callers outside the diff are where it is weakest — review large changes in coherent pieces.
  • For security review specificallyIt will notice obvious injection and missing authorisation. It will not reason reliably about your threat model or your auth architecture, and a clean answer here is not a security sign-off.
  • When the risk is in the design rather than the codeA well-implemented wrong approach reviews cleanly. This finds failures within the chosen approach; it will not tell you the approach was the mistake.