Free playbook
The AI Debugging Playbook
How to find and fix bugs with Claude, Codex or any AI. Stop describing the bug. Show it.
01
Backend bugs
Logs show AI what your code actually did.
The problem
“It’s broken, fix it” makes AI guess. The guesses that seem to work often hide the bug.
A guess. The real bug is still there.
The fix
Remember this
Ask for logs, not a fix.
- Paste the exact error
- AI adds temporary logs
- Run it again
- AI reads them and fixes the cause
Done right
Terminalafter adding 2 logs
- POST /api/checkout
- [debug] session → expired
- [debug] user → undefined
- TypeError: Cannot read properties of undefined (reading 'id')
- at checkout (src/lib/checkout.ts:44:19)
The crash is on user.id. The logs show why: the session expired, so there’s no user.
Two failed fixes in a row? Start a fresh chat with what you’ve learned. A chat full of wrong attempts makes the next one worse.
Copy this prompt
Something on my backend is broken. Don't fix anything yet. How to make it happen: [what you ran or clicked] The exact error: [paste the full error and stack trace] Add temporary logs that start with [debug] where the data comes in, where it's loaded, and right before the line that fails. Log types and keys only: never passwords, tokens or whole user records. Run it, show me the [debug] lines and tell me which value is wrong first. Then explain the root cause, make the smallest fix, and remove the logs.
Free playbook
Where should I send it?
The rest opens right here, and I’ll email you the link and the PDF for your computer.
- Frontend bugs
- Production bugs
- The bug report builder
No spam. You’ll get the playbook now, then new guides and the occasional offer from Nuhu Ventures Inc. Unsubscribe any time. Privacy and contact details
02
Frontend bugs
A screenshot shows AI in a second what a paragraph can’t.
The problem
AI can’t see your screen, so “it looks off” could mean anything.
AI has to guess what “off” means.
The fix
Remember this
Show it two pictures.
- 1What you seeA screenshot of the bug. If it moves or flickers, a screen recording, or a screenshot of each step.
- 2What you wantA screenshot of how it should look: a design you like, another app, a sketch.
Done right
Checkout
- Linen shirtSize M$48.00
- Canvas toteNatural$30.00
- Subtotal
- $78.00
- Shipping
- Total
- $NaN
Checkout
- Linen shirtSize M$48.00
- Canvas toteNatural$30.00
- Subtotal
- $78.00
- Shipping
- $6.00
- Total
- $84.00
The second picture is the best way to nail your frontend. AI matches a screenshot far better than words like “clean and modern”.
Copy these prompts
Image 1 is what I see. Image 2 is how it should look. Page: [which page, and how to get there] Look at: [the part that's wrong] 1. List every visible difference between the two images. 2. Check the console and network first. Tell me if a difference is really a data problem. 3. Fix only what causes the differences. Don't restyle anything else. 4. Open the page, take a new screenshot and compare it with image 2.
The image I've attached is how I want [which screen] to look. Keep my own: [logo, colours, copy] 1. Describe the reference first: layout, spacing, type, colours, corners and shadows. 2. List what's different on my screen today. 3. Change only what's needed to match. Reuse my existing components. 4. If you can open the page, screenshot it, compare it with the reference and fix what's still off.
03
Production bugs
Let your users send crash reports, and let AI read them.
The problem
Real users don’t send you stack traces. They close the app, and you never find out.
- Your app crashes
- The user closes it
- You never hear about it
The fix
Remember this
Ask for a crash report, right when it happens.
- An error tracker like Sentry, or your own handler
- A one-tap prompt after a crash. Nothing is sent without a yes
- The reports stored in your backend
- Your AI reading them, through MCP or an export
Done right
- 1 · The app asks
Something went wrong
Send a crash report to help fix it?
- 2 · The report lands
Crash report
TypeError: Cannot read 'id'
checkout.ts:42
- 3 · AI drafts the fix
AI
37 reports, 4 people, one cause: expired sessions. Draft fix and test ready for review.
It’s how I run my own apps: users tap send, AI reads the reports and drafts the fixes, and I review them.
Copy this prompt
Here are the latest crash reports from my app: [paste them, or say where they are] 1. Group them by root cause, not by error message. 2. Rank the groups by how many people each one hits. 3. For the top one, show me the error, the first line in my code (file:line) and what users did just before. 4. Write a test that fails because of it, then make the smallest fix. 5. Run the tests and show me the output. Don't merge anything: I review first.
Tools
Use these when something breaks.
For any bug. Fill in what you know and copy it into your AI. Anything you skip becomes a question it asks you first.
BUG REPORT
It knows what’s wrong.
It can make it happen.
It knows if it’s flaky.
It knows what right looks like.
It can tell right from wrong.
It goes straight to the line.
It sees the real values.
It sees what users see.
It starts with what changed.
It can rule out your setup.
It skips the hunt.
It can prove the fix.
Rules: Reproduce first. Explain the root cause before editing. Don’t edit or delete existing tests. Don’t hide the error with try/catch. Keep the diff small. Show the commands you ran and their output.
Still guessing: what’s wrong, how to make it happen, how often it happens, what should happen, what happens instead, where it crashed, what changed, your setup and what fixed means.
Practice
Find the bug with logs
Tap + next to a line to log it, then press Run.
src/lib/checkout.tsNo logs yet
- 36
export async function checkout(req: Request) { - 37
const session = await getSession(req); - 38
const user = await findUser(session); - 39
const cart = await getCart(req); - 40
const total = priceCart(cart); - 41
// charge the customer - 42
const id = user.id; - 43
return charge(id, total); - 44
}
- $ npm run dev · ready
Tap + next to a line to log a value after it. Then press Run.
Spot the difference
Drag to compare the screenshots, then ask the AI what’s different.
Checkout
- Linen shirtSize M$48.00
- Canvas toteNatural$30.00
- Subtotal
- $78.00
- Shipping
- $6.00
- Total
- $84.00
What the AI sees
Drag the divider to compare them yourself. Then ask the AI to list every difference.
1:1 debugging call with Nuhu Shaik
Stuck on a bug? Let’s work through it.
We’ll trace it together, and I’ll show you how to find the next one yourself.
- One hour, live
- On your own project
- CAD 200
- Where your bug comes from, and how to fix it
- How to set up crash reporting for your app
- How to get your AI to debug your stack
Stuck on a bug? Request a 1:1 call at nuhushaik.com/resources/debug#call

Saves me hours every day. You help me a lot.
- 3,200
- monthly active users on Ayah
- 700
- paid users on Drum Breaker
- Caterpillar
- web HMI for power systems