Skip to content
Log in

Failing Test First

Takes a bug report and writes the smallest test that fails for the right reason, before anything is fixed.

0

Share this prompt

Free — no card needed

Create a free account

to open Failing Test First — and the other 364 prompts across 21 categories.

We store your email address to send these. We never sell it or pass it to advertisers. Withdraw at any time. Privacy Policy.

Already have an account?

CategoryCodingForDevelopersTested onClaudeChatGPTGemini

Running it, start to finish

  1. Paste the bug report, the code and a sample of your existing tests.
  2. Run the generated test and compare against the section 4 prediction.
  3. Only apply the fix once the failure matches.

What you get back

The output this produces, every time.

  • Writes the test before the fix, and predicts the exact failure so a wrong diagnosis is caught immediately.
  • Reduces the reported case to the smallest input that still reproduces it.
  • Suggests neighbouring cases likely broken by the same root cause.

Getting better results

Where this usually goes wrong, and how to avoid it.

  • Run the test before reading section 5. That is the whole point of the ordering. If the failure does not match the prediction, stop and re-diagnose rather than applying the fix.
  • Paste real test files. as the framework context, not just the framework name. Conventions matter more than syntax for whether the test fits the suite.
  • Take the scaffolding complaint seriously. If it says the test needs heavy setup, that is usually a real finding about coupling, not a limitation of the test.

More Coding prompts

All Coding

Written for The AI University. Every prompt in this library is original work — authored, tested and revised here, not collected from elsewhere. 365 of them, free with an account.