Kavvo Prompts

Bug Fixer Prompt

November 29, 2026 · 3 min read · By the Kavvo Prompts team

What this prompt does

This prompt helps you find and fix a bug in your code — and understand why it happened, so you can avoid it next time. It is designed for the bugs that are hardest to fix alone: the code runs, but the result is wrong, or it crashes only sometimes.

The prompt

Act as a careful debugging partner. Help me find and fix this bug. Explain the cause, not just the fix.

Programming language: [LANGUAGE, e.g. "Python"]
What the code should do: [ONE OR TWO SENTENCES]
What it actually does: [WHAT HAPPENS INSTEAD, e.g. "it crashes with an error" or "it returns the wrong number"]
Error message (if there is one):
```
[PASTE THE FULL ERROR MESSAGE HERE]
```

Code:
```
[PASTE THE CODE HERE, or the smallest part that shows the bug]
```

What I have already tried: [WHAT YOU TRIED, or "nothing yet"]

Help me in this structure:
1. What I think is happening: 2-3 sentences on the most likely cause, based on the code and the error.
2. How to check: one or two quick checks I can do to confirm the cause, such as printing a value or testing with a simple input.
3. The fix: show the corrected code, with the changed lines clearly marked or explained.
4. Why it went wrong: one or two sentences explaining the mistake in plain English, so I can avoid it next time.
5. How to test the fix: one or two test cases I can run to check the fix worked.

Rules:
- Do not rewrite my whole file. Fix the bug and explain it.
- If there could be more than one cause, list them in order of likelihood and say how to tell them apart.
- If you are not sure, say so, and say what information would help you be sure.

Which model

Written for both ChatGPT and Claude. Paste it as one message, including the code and the error message.

How to use it

  1. Copy the prompt into ChatGPT or Claude as one message.
  2. Paste the smallest piece of code that shows the bug. A short, focused snippet gets a better answer than a whole file.
  3. Paste the full error message if there is one, and say what the code should do and what it actually does. Those three facts are the bug report.
  4. Add what you have already tried, then send it.
  5. Run the checks the model suggests first, then apply the fix, then run the test cases it gives you. If the fix does not work, tell the model what happened and try the next likely cause.

Example

Input: A Python function that should return the average of a list of numbers, but crashes when the list is empty. Error: a division-by-zero error. Tried: nothing yet.

Tips

    • Shrink the bug first. If you can reproduce it in ten lines, the model — and you — will find it far faster than in a whole file.
  • Read the error message before you run the prompt. The error usually names the line where the problem shows, even if the cause is elsewhere.