AI assistants are becoming pretty normal in development, but I’m curious whether they have actually changed how people debug problems.
For me, there’s a big difference between asking an AI to explain an error and asking it to fix the entire problem. The first can be useful for understanding what is happening, while the second can sometimes produce a solution that works without really explaining why.
How are other developers using AI when debugging?
Do you:
paste the complete error and ask for an explanation?
ask for possible causes first?
use AI to generate test cases?
still prefer debugging manually before asking for help?
use AI mainly after you’ve already identified the problem?
I’m particularly interested in whether experienced developers have found a workflow that makes AI genuinely useful without becoming dependent on it.
For a straightforward error, my first reaction is to paste the error message into ChatGPT and ask what’s going on. Sometimes the answer is obvious, the suggested fix makes sense, I try it, it works, and that’s that. There’s not much point spending half an hour tracking down something AI can spot in seconds.
It’s when things get more complicated that I tend to fall back on the old-fashioned way of doing things. In this case, I’ll reproduce the problem, narrow down where it is happening, look at what changed, inspect the relevant code and come up with a theory. Then I’ll use AI as a second pair of eyes, showing it what I’ve found and seeing what it makes of my reasoning or whether there’s something I’ve missed.
One area where I find AI particularly useful is error logs. Not strictly code, but give it a gnarly Rails stack trace, Apache log etc and it is remarkably good at picking the important bits out of all the noise. That has saved me a lot of time.
What I don’t do is ask AI to rewrite large chunks of code until the problem goes away. I also use Cursor and Claude Code, so while I would have the tools to do that, if a fix is anything beyond trivial, I want to understand what was actually wrong and why the fix works.
So yes, AI has definitely changed how I debug. For simple problems it can effectively be the first port of call. For harder problems I’m still debugging much as I always did, but now I’ve got a very capable second pair of eyes to help out.
Absolutely, and I have to say I think it works well in that regard, especially with breaking things down and explaining it’s reasoning. Personally I will go away and explore, come back with hopefully a better understanding and then enter a discussion with AI on the finer points. Sometimes through a bit of digging you are able to come back with an improvement or spot a hole in the proposed fix.
I think whilst AI has come on leaps and bounds, you still need to do your own research. And plus I don’t know about others, but it’s quite nice to learn!!.
AI is good and all, but as long as we have to read or debug code, then we should follow what is called “Kernighan Laws”, that come from his and P.J. Plauger 1974 book: "The Elements of Programming Style"
“Everyone knows that debugging is twice as hard as writing a program in the first place. So if you are as clever as you can be when you write it, how will you ever debug it?”
Reject “clever” code: Complex workarounds and flashy hacks might save a microsecond of processing power, but they make tracking logic flaws nearly impossible
Simplicity minimizes mistakes: If the code structure is simple and transparent, bugs have nowhere to hide, and the cause of a failure will reveal itself much faster.
It’s certainly changed the way I debug. Whenever I have an issue in the code I can’t readily see a solution to I’ll give it to Claude Code to figure out. That can either be the error message, or a prompt like XYZ is failing. Please run 'whatever command' to see it fail and fix it. The last one of course obviously only works if there is a command to run, like some linter or unit test. In those cases it’s really effective. I usually do it for nitty gritty stuff where I can’t be bothered to figure out what’s going on. Like @James_Hibbard says, why spend half an hour on something AI can do for you in seconds?
Another thing I’ve been doing which has worked amazingly is install GCP observability in Claude Code and ask it about things going on in the infrastructure. Things like certain apps getting a lot of requests or going down for a few minutes. It’s amazing how fast Claude can pinpoint the problem down to a consistent timeline of what happened. I could have constructed that myself, but it would have taken hours, not minutes, and wouldn’t be nearly as concise.