Debugging with AI is an A+ experience! Here is what I do, in very simple terms: 1. Ask the model to generate a few hypotheses Instead of asking directly for a fix, I ask the model to generate a few hypotheses of what could be happening and a proposed solution. Often, models attempt to fix the wrong thing or write excessive code that's unnecessary to solve the problem. Asking for hypotheses and potential solutions shows me what they are thinking and how they plan to solve it. 2. Ask for a reason, not a fix I'd rather ask, "What is causing this error?" than "What's the fix for this error." The former forces the model to provide a complete explanation I can review (and understand). The latter puts the model in "slop-code-generation" mode. 3. Always paste error logs I never say, "My code doesn't work." Instead, I drop the full traceback, test failures, or log output. The more, the merrier. Models are really good at parsing through all of this. 4. Explain what you've already tried This helps the model skip obvious dead ends. The more context you provide, the better the model suggestions will be. 5. Iterate, but be smart about it It's common to get stuck in a loop with a model that tries one solution, then another, and then back to the previous solution. The best way I've found to break out of these loops is to continually update the context and help the model with new clues. Another trick is to change models but share the entire context with the debugging session. Sometimes, one model can see what the other can't.
Debugging Tips for Software Engineers
Explore top LinkedIn content from expert professionals.
Summary
Debugging is the process of identifying and resolving errors in computer programs, and software engineers use a variety of methods to track down issues, often aided by tools like artificial intelligence. These posts highlight practical strategies for making debugging less stressful and more productive.
- Share detailed context: When seeking help from others or AI tools, always include error messages, relevant logs, and a clear explanation of what you expected versus what actually happened.
- Cut the problem in half: Simplify your investigation by pinpointing the midpoint in a failing system and checking each side to quickly narrow down where things are going wrong.
- Make errors visible: Insert logging statements or use debugging tools to shine a light on hidden issues, turning vague problems into clear, actionable information.
-
-
I wish more software engineers knew about my favorite debugging method, bisection. I usually call it the "cut it in half" approach. As an aside, I seem to recall learning it when in college and using it as a method to identify shorts in an electrical circuit. It's probably best understood by example: "The user says that the system doesn't save their new email address." What all is involved in this flow? - the UI - their browser - the networking (the Internet) between their client and our servers - the web server and its cache - the application itself and its cache - the database that's backing it - the email service where a confirmation gets sent That's potentially a lot of things where something can be broken. So where do you start looking? The "cut in half" method says find the midpoint and validate the system on either side of that midpoint. So start at the web server. Is the request coming in? It's not super flashy, and it works very, very well.
-
Debugging... The part of software engineering that nobody really warns you about. One minute you're feeling like a coding genius, the next - you’re in a staring contest with a stubborn error message. But over time, I’ve built a debugging process that helps me stay (mostly) sane: 1. Reproduce it. First step - make it happen again. Consistently. If I can’t reproduce the bug, it’s like chasing a ghost. 👻 2. Break it down. What’s working? What’s not? Narrow it down, line by line if needed, to the smallest piece of code that causes the issue. 3. Google like a pro. Yes, even experienced engineers google errors. The key? Be specific. Error message + tech stack + relevant keywords = faster answers. 4. Rubber duck it. 🦆 No rubber duck? No problem. Explain your problem out loud or write it down. You’d be amazed how often the solution pops up mid-explanation. 5. Ask for help. Stuck for hours? There’s no shame in reaching out. Sometimes a fresh set of eyes finds the answer in minutes. And when it’s finally fixed? Commit that code, celebrate, and add a note for your future self - because yes, bugs have a way of making encore appearances! 😂 What’s your go-to debugging trick? Share in the comments!
-
Last week I spent 6 hours debugging with AI. Then I tried this approach and fixed it in 10 minutes The Dark Room Problem: AI is like a person trying to find an exit in complete darkness. Without visibility, it's just guessing at solutions. Each failed attempt teaches us nothing new. The solution? Strategic debug statements. Here's exactly how: 1. The Visibility Approach - Insert logging checkpoints throughout the code - Illuminate exactly where things go wrong - Transform random guesses into guided solutions 2. Two Ways to Implement: Method #1: The Automated Fix - Open your Cursor AI's .cursorrules file - Add: "ALWAYS insert debug statements if an error keeps recurring" - Let the AI automatically illuminate the path Method #2: The Manual Approach - Explicitly request debug statements from AI - Guide it to critical failure points - Maintain precise control over the debugging process Pro tip: Combine both methods for best results. Why use both? Rules files lose effectiveness in longer conversations. The manual approach gives you backup when that happens. Double the visibility, double the success. Remember: You wouldn't search a dark room with your eyes closed. Don't let your AI debug that way either. — Enjoyed this? 2 quick things: - Follow along for more - Share with 2 teammates who need this P.S. The best insights go straight to your inbox (link in bio)
-
1/ The first time I saw a red error message, I thought I broke everything. Turns out — it was just the computer trying to help me. 2/ Starting out, I panicked at every error. Now I see them for what they are: computers trying to talk to us. And now, AI can translate that conversation. 3/ Most errors are simple to fix: Missing library? Install it. Version mismatch? Update. Syntax error? Fix the typo. These are mechanical. And this is exactly where AI agents shine. 4/ I use Claude Code daily now. When it hits a red error in the terminal, it reads the traceback, figures out what went wrong, and fixes it — often before I even finish reading the message. Missing dependency? Installed. Wrong argument? Corrected. It self-corrects faster than I can type. 5/ But here's the catch. Some errors don't scream. They whisper. Your script runs clean, no red text, exit code 0. But the output is wrong in ways only someone with domain knowledge would notice. AI won't flag those. You will. 6/ A VCF file with 10,000 "variants" that are all in homopolymer regions. A DESeq2 result with 8,000 DEGs from 3 replicates. Code ran perfectly. Results are garbage. No error message will save you here — only experience. 7/ So the new debugging workflow looks like this: Let the AI agent handle the mechanical errors — the typos, the missing packages, the version conflicts. Save your brain for the errors that don't throw exceptions. 8/ Pro tip still holds: Stop. Breathe. READ the error carefully. 90% of the time it tells you exactly what's wrong. And now you can paste it into Claude Code and watch it fix itself in real time. 9/ When asking for help (human or AI), include: OS, exact command, full error message, and what you expected to happen. Context is currency in debugging. Good questions get good answers — from people and from agents. 10/ Key takeaways: - Errors are maps, not walls. Read them. - AI agents fix mechanical errors faster than you can. Let them. - The dangerous errors are the ones that don't look like errors. - Domain knowledge catches what no agent can. - Learn to debug with AI, but never stop understanding why things break. I hope you've found this post helpful. Follow me for more. Subscribe to my FREE newsletter chatomics to learn bioinformatics https://lnkd.in/erw83Svn