Stripe Checkout that actually checks payment
A success URL is not proof of payment. Fulfil only after a verified webhook, and test the cheats that usually slip through.
If the agent has already “fixed” the bug twice and the file no longer looks like yours, the next edit is the problem, not the solution.
24 November 2026 · About an 8 minute read
Most of the debug loops I see start the same way. You paste an error. The agent rewrites a function. The error is still there, or a new one appears in the same place. You say “still broken.” It rewrites a bit more, or it replaces the whole file “to make debugging easier.” Ten minutes later you cannot tell what changed, and you still cannot reproduce a passing result.
The routine below is the one I use to stop that spiral. It works in Cursor and in Claude Code. You do not have to understand the whole file. You do have to stop the agent editing before it has reproduced the bug.
Here is a small example I used when I tested this playbook. An endpoint /api/total?a=2&b=3 was supposed to return 5. It returned "23". That looks like a weird framework issue until you actually call it. Run the same request twice with no edits and the answer is stable: the handler is concatenating strings, not adding numbers.
If you skip that step, an agent will often “fix” it by reshaping the route, adding a library, or rewriting the file. The concatenation is still there, now harder to see. The first prompt exists to prevent that.
Old chats are already in the loop. They contain the failed edits, the half-theories, and the urge to keep going. Start a new agent chat for this bug, keep a short rule in .cursor/rules/ that forbids refactors while debugging, and paste Prompt 1.
This is the prompt that does most of the work. Copy it, fill in the brackets, and do not give permission to edit until you like the hypothesis.
We are debugging. Do not edit any files yet.
Bug: [one sentence]. Steps I take: [1, 2, 3]. Expected: [what should happen]. Actual: [what happens].
Here is the error or log output, pasted in full:
[paste]
Read the code on the path that would run for those steps. Then tell me: (a) the files and functions involved, in order, (b) one hypothesis for the cause, (c) the single smallest check or edit that would prove or disprove it. Wait for my yes before editing.
A good reply names a path through the code, one cause, and one small check. A bad reply starts editing, offers three theories at once, or proposes a rewrite “so we can see what is going on.” Send it back if it does any of those.
Hypothesis we agreed: [quote it]. Make only the smallest change that tests it. Do not refactor. Then run or re-state the exact reproduction steps, and report what happened. If you cannot run it yourself, give me the exact steps to run and wait.
Re-run the same steps you wrote in Prompt 1. If the agent “also cleaned up” a second file, that is already two changes, and you will not know which one mattered. Revert the extra work.
A second attempt is allowed. A third silent rewrite is how the hole gets deeper.
The bug is still there. This is attempt two, not a rewrite. Say what the first attempt taught us, name a different hypothesis, and propose one change. Wait for my yes.
Stop editing. Do not try a third fix. Write a short brief I can reuse: steps, expected, actual, the two hypotheses we tested, the exact diffs, and what evidence is missing. List two things I could collect (a log line, a screenshot, a network trace, a value you cannot see). Then wait.
If the agent offers to “rewrite this module so debugging is easier,” treat that as a third attempt in disguise. Do not let it. The brief from Prompt 4 is the useful output now.
Summarise the root cause in five lines or fewer, in plain English. List the files that should stay changed. Confirm there are no leftover debug hacks, extra console logs with secrets, or commented-out blocks from the failed attempts. If there are, remove only those leftovers.
git diff (or the agent’s file list) shows a small, relevant change, not a rewritten module.You may be changing two things at once, code and data, or two files. Go back to one. The reproduction may be wrong: a cached build, an old env, a different port. Confirm you are hitting the code you think you are hitting. If the real problem is “I have no idea what this repo does,” write a short project brief first, then come back to Prompt 1.
If the bug is in production only, you still start with Prompt 1. Add the log lines you have. Do not “fix production” by rewriting local files you have not evidenced.
The free Debug Loop Breaker sample on GitHub has the Cursor rule, the AGENTS.md section, and the full prompt sequence you can paste into a new chat. The Vibe Launch Pack (£12) adds 15 more playbooks, including the Stripe and secrets checks described in these guides.
A success URL is not proof of payment. Fulfil only after a verified webhook, and test the cheats that usually slip through.
Public-prefixed env vars are baked into the JavaScript users download. Here is how that happens, and how to search the bundle before you deploy.