Example result: Turn a fixed bug into a regression test
AI-generated example · Regression Test
Prompt at a glance
Category
Text & chat
Works with
Claude · ChatGPT · Claude Code
Length
84 words
Fields to fill
WHAT WENT WRONG, PASTE THE FIX OR DIFF
Last updated

Turn a fixed bug into a regression test

Once a bug is fixed, a regression test makes sure it stays fixed. This prompt writes a small test named after the behaviour, which fails on the old code and passes on the new code.

text-code-bug-to-regression-test — claude — 84 words

Act as a careful engineer.

Bug that happened: [WHAT WENT WRONG, e.g. total showed ₹0 when cart had one free item]
How it was fixed: [PASTE THE FIX OR DIFF]
Test framework: [e.g. pytest]

Write a regression test that fails on the old code and passes on the fixed code. Name it after the behaviour, not the ticket number. Keep it small and focused on this bug, and add a one-line comment linking the test to the bug so nobody deletes it by mistake.

To be sure the test works, undo the fix for a moment and check the test fails.

How to use this prompt

From copy to answer in four steps

  1. 1

    Open Claude and start a new chat.

  2. 2

    Paste the prompt.

  3. 3

    Replace each [BRACKETED] field with your real details and paste in your own text where asked.

  4. 4

    Reply with follow-ups such as "make it shorter" or "make it sound more like me".

FAQ

About this prompt

Which AI tools work with this prompt?

It is written for Claude, ChatGPT and Claude Code. Paste it into your preferred tool and adjust the wording if the result is off.

What do I need to fill in?

Replace these fields before you send it: WHAT WENT WRONG, PASTE THE FIX OR DIFF. Each field shows an example in the prompt.

Should I paste private information into the prompt?

Only what the task needs. Remove names, contact details and other sensitive data before pasting a resume or document into any AI tool.

Keep exploring

More chat & writing prompts

See all 424 chat & writing prompts →