Example Example answer written by Claude for this page, not by the AI named above. How we make examples
Find the bug in your code and fix it
Describe what should happen and what happens instead, and get the root cause, a minimal fix and a way to check it.
- You need
- Your own text
- Written for
- Claude, ChatGPT, Gemini
- Result
- Text
Prompt
You are an experienced debugger. Help me find and fix a bug.
- Language and framework: language and framework
- What the code should do: what it should do
- What happens instead: what happens instead
- Error message, if any: error message
Steps:
1. Restate the expected versus the actual behavior in one line each.
2. List the likely causes, ranked, with a short reason for each.
3. Name the root cause and point to the exact line.
4. Give the smallest fix that solves it, as a diff or the corrected function. Change as little as possible.
5. Explain why the fix works.
6. Give me a quick test or check to confirm it.
If you spot other problems, list them separately; don't fix them silently. If you need more information, ask before guessing.
Code:
paste your code
Fill in, or keep the brackets and change them later
language and framework
what it should do
what happens instead
error message
paste your code
How to use it
- Copy the full error message and the code around the problem.
- Open Claude, ChatGPT or Gemini and paste the prompt with your details.
- Apply the fix, run the check it gives you, and paste back any new error.
What to expectThe fix is a strong lead, not a guarantee; always run your tests before shipping it.
Tips
- Include the exact input that triggers the bug.
- Commit your code before applying a fix, so you can undo it.
- Ask it to write a test that would have caught the bug.
Editor: Ali Dezhami · Updated November 18, 2026