Coding

Bug Debugger

Describe the expected vs actual output and paste your code. Get a root cause analysis with a fix you can apply immediately.

By Arshad Hossain

Copy the prompt, fill in what the code should do, what it actually does, and paste your code snippet.

I need help debugging this code. It is supposed to do [EXPECTED OUTPUT], but instead it produces [ACTUAL OUTPUT].

Please:
1. Identify the root cause of the bug
2. Explain step-by-step why the current code produces the wrong output
3. Provide the corrected code with comments explaining each change
4. List any other potential issues you notice
5. Suggest a test case that would have caught this bug

Here is the code:
[paste your code here]

Why "Bug Debugger" Works

"Bug Debugger" eliminates the most common reason AI output disappoints - vague instructions. This prompt uses reasoning elicitation and sequential task breakdown to define both what the output should include and how it should be structured. The end result is production-quality code that handles edge cases and follows your stack conventions, delivered on the first try rather than after multiple failed attempts.

These coding tips will help you get stronger results when using "Bug Debugger" and similar prompts in this category.

When to Use "Bug Debugger"

"Bug Debugger" is particularly useful in these situations. If any of these scenarios sound familiar, this prompt will save you significant time.

What You Will Get from "Bug Debugger"

When you use "Bug Debugger" with ChatGPT, Claude, or Gemini, here is what to expect in the AI output.

How to Customize "Bug Debugger"

Adapt "Bug Debugger" to your specific situation by modifying these key areas. The more context you add, the better the results.