So you've got a bug. Stack trace looks like alphabet soup. Your instinct: paste it into Claude/ChatGPT and wait for genius. Doesn't work. AI can't debug your code for you. It's terrible at understanding your actual problem. Here's the real move.
The Problem With "Fix My Bug"
When you dump 50 lines of context and ask "why is this broken?", the AI guesses. It can't run your code. Can't see your environment. Can't step through with actual values. So it generates plausible-sounding nonsense, you copy-paste it, and 20 minutes later you're down a rabbit hole.
What Actually Works
Narrow the scope first, yourself
Don't paste the whole function. Find the smallest piece that reproduces the issue. Two functions, maybe three. Test it in isolation. You'll catch 40% of bugs just doing this.Tell AI what you've already tried
"I added console.log at line 15 and the value is undefined. Expected a string from the API response." Now you're not asking AI to guess—you're asking it to explain your observation.Ask for the mechanism, not the fix
Instead of "fix this," ask "why would arr.length be undefined here?" Force the AI to explain what should happen, then you verify against what's actually happening.Use it for rubber-ducking, not magic
Explain your code to AI like you're teaching a friend. Half the time you'll find the bug while explaining. That's the real value.
Real Example
Bad: "Why doesn't my API call work? [pastes entire controller]"
Good: "My fetch returns status 200 but .json() throws. I know the response body exists (logged it). Why would parsing succeed in Postman but fail in my app?"
That's specific. That's actionable. AI can actually help.
The Workflow
- Understand the symptom
- Isolate the smallest reproducer
- State what you know to be true
- Ask what should happen instead
- Compare reality to expectation
- Fix it yourself (you'll learn more)
Yeah, it takes longer than pasting into AI. You'll also actually fix the bug and remember how next time.
Want to level up your dev skills faster? Check out LearnAI Weekly newsletter — practical AI tools, automation tips, and coding resources delivered every week.
Top comments (0)