Debug prompts
Ask AI to find and fix problems
Every app has bugs. Even professional developers hit them every day. The good news: AI is great at fixing bugs, if you describe them well.
What is debugging?
A bug is when your app does something you didn't expect. Debugging means finding the cause and fixing it.
Think of visiting a doctor. "I feel bad" doesn't help much. "I've had a headache for 3 days, mostly in the morning, since I started new medicine" helps a lot. Bug reports work the same way.
The five things to include
A good bug report answers five questions:
- What did you do? The exact steps. "I clicked Add habit, typed 'Read', pressed Save."
- What did you expect? "The habit should appear in my list."
- What actually happened? "Nothing appeared. The form stayed open."
- Is there an error message? Copy and paste the exact text.
- A screenshot, if the problem is visual.
Weak vs strong bug reports
It's broken. Fix it.My habit tracker has a bug.
What I did: Clicked "Add habit", typed "Read 10 pages", clicked Save.
What I expected: The new habit appears at the top of my list.
What happened: The form closes, but the habit doesn't appear.
If I refresh the page, it shows up.
Error message (from the browser console):
"Warning: Each child in a list should have a unique key prop."
Screenshot attached.The strong version gives the AI clues. "It shows up after refresh" tells it the habit is saved, but the screen doesn't update. That narrows the search a lot.
Ask AI to explain before fixing
If you say "fix it", the AI may change lots of code at once. You won't know what happened, and it might break something else. Ask for an explanation first.
Before changing any code, explain in simple words:
1. What do you think is causing this bug?
2. Which file or part of the app is involved?
3. What change do you plan to make?
Wait for me to say "go ahead" before you fix it.Let's break this down:
- You learn what went wrong, so you understand your app better.
- You can spot a bad plan before it touches your code.
- "Wait for me" is a guardrail. It keeps you in control.
A copyable bug-report template
Save this in your prompt library. Fill it in every time something breaks.
I found a bug in my [app name].
What I did (step by step):
1.
2.
3.
What I expected to happen:
What actually happened:
Error message (copied exactly):
When it started (what changed just before):
Screenshot: [attached / none]
Please explain the likely cause and your plan before changing anything.
Only change what is needed to fix this bug.When the fix doesn't work
Sometimes the first fix fails. That's normal. Tell the AI what happened after the fix, using the same format.
I tried your fix. The habit now appears, but it shows up twice.
No new error message. What do you think is causing this?Common mistakes
- Saying "it doesn't work" without saying what you did or what you saw.
- Retyping an error message from memory instead of copying it.
- Reporting five bugs in one message. Fix them one at a time.
- Letting the AI change lots of files without explaining why.
- Not testing after the fix, then finding the bug again later.
Practice
Try these exercises to lock in what you just learned.
What's next?
You've finished the prompting skills. Next, let's learn how to plan and document your app before you build it, starting with why writing for AI matters.