Tests that would have caught the last bug

Not 100% coverage. The five tests that protect what actually matters.

Any project you've fixed the same bug in twice.testingqualityregressions
ChatGPT Claude
Write the small set of tests that would protect this code from the bugs it has actually had.

The code: <paste the module or functions>
What it's supposed to do: <one paragraph>
Bugs it has had, or nearly had: <describe each in a line>
Testing setup: <framework, where tests live, an example existing test if you have one>

Produce:
1. The 5–8 behaviours most worth protecting, ranked. For each: why it matters, and which past bug it relates to, if any.
2. One test per behaviour, in my framework and style, each with a name that reads as a sentence ("rejects an order with the wrong email").
3. For each test: the setup, the action, the assertion, and nothing else. No shared magic; readable on its own.
4. Edge cases you deliberately chose not to test yet, and why.
5. One test that would currently FAIL if I'm right about a bug that still exists. Say which line of code you think is wrong.

Do not aim for coverage. Aim for the tests I'd be grateful for at 2 a.m.

Replace every <placeholder> with your own details before you send it.

How to use it

  1. 1Describe the bugs you've actually had. Tests aimed at real failures are worth ten aimed at hypotheticals.
  2. 2Ask for the tests in your existing framework and folder. Consistency beats cleverness.
  3. 3Run them before asking for more. A failing test is information.

Reviewed 2026-09-20

Share this prompt

WhatsApp

Sharing a prompt is the easiest way to help another builder today.

Good prompts are a skill. Proof of what you build is a career.

Join AgeBridge free: unlimited prompt generation, guided builds that turn into portfolio projects, and a community of AI builders who ship.

  • Unlimited prompt generator
  • Guided builds that become proof on your profile
  • A public profile businesses can find

Prompt text is written by AgeBridge and free to use. Results depend on the model and on the details you provide.