Skip to content

Fix Bug

Fix a Bug With a Failing Test First

AI Tool: CursorCategory: Cursor & AI Coding

Force the agent to reproduce the bug, write or run a failing test, then apply a minimal fix.

The Prompt

Debug this repository like a careful teammate. Do not shotgun-rewrite.

Bug: {{bug}}
Expected: {{expected}}
Actual: {{actual}}
How to reproduce:
{{repro}}
Suspect area (if any): {{suspect}}

Process:
1. Reproduce from the description. If you cannot, stop and say what is missing.
2. Write or identify a test that fails because of this bug.
3. Apply the smallest fix. No unrelated cleanup.
4. Show the test passing.
5. Note any other call sites with the same bug.

If the bug is a misunderstanding of intended behaviour, say so instead of "fixing" it.

Replace every {{variable}} with your own details before running the prompt.

Variables to fill in

5 variables

{{bug}}required
What is wrong.
{{expected}}required
What should happen.
{{actual}}required
What happens instead.
{{repro}}required
Steps, URL, or test command.
{{suspect}}
Files or features you already blame.

Scroll to see every variable.

Best for

  • Engineers
  • Cursor users
  • Maintainers