Essay
Building Debugging Intuition
Experienced engineers debug fast because they store patterns. Build yours sooner with a repeatable loop, a failure catalog, and doubt about your first guess.
TL;DR: Debugging intuition is accumulated experience, organized. Run the same loop every time: reproduce, isolate, compare with known good, form a hypothesis, test it. Record each failure in a catalog, try to disprove your first guess, follow the data, and compare broken with working. Deliberate practice makes the patterns arrive sooner.

Experienced engineers aren't magically better at debugging. They've seen more bugs. They recognize patterns. A slow database query reminds them of that time the index was missing. A memory leak looks like that time the cache wasn't bounded.
Intuition is accumulated experience, organized. The question is: how do you accumulate it faster?
When I first started debugging, every bug felt unique. I'd spend hours exploring, trying random things, hoping something would work. Two years later, I see a symptom and immediately know where to look. Not because I'm smarter—because I've seen it before.
This essay covers the method: a loop you run every time, a catalog that stores what you learn, and the habits that keep your intuition honest. For the other half, how to stay calm and observe in the first ten minutes of an incident, read On Cultivating Debugging Sense.
Systematize your approach
Don't debug randomly. Have a process:
- Reproduce consistently: Can you make it fail on demand?
- Isolate the scope: Is it one service, one function, one request?
- Compare with known good: What changed? What's different?
- Form a hypothesis: What do you think is wrong? Why?
- Test the hypothesis: What would prove you wrong?
A process makes intuition reliable. It also teaches you what questions to ask.
Picture a checkout that fails for about 1 in 50 customers. No pattern in the logs. Step one is to find what those customers share. Maybe it is a payment method, a region, or a cart with more than ten items. Once you can trigger the failure with a test request, the rest gets easier. Step two narrows it: is it the cart service, the payment call, or the database write? Each step cuts the search space in half.
I once spent three hours debugging a race condition. I tried random fixes, hoping something would work. Nothing did. Then I stepped back and asked: "Can I reproduce this consistently?" I couldn't. That told me it was timing-related. Once I knew it was a race condition, I knew where to look. The process guided me to the right question.
That is why "I can't reproduce it" is useful. It rules out most logic bugs. What remains is timing, load, ordering, or data you do not have locally. The Race Condition That Only Happened in Production is a good example of that class.
Build a catalog of failures
Every bug you fix is a new pattern. Document it:
- What was the symptom? (user-reported, metrics, logs)
- What was the root cause? (the actual problem, not just the fix)
- How did you find it? (what investigation steps worked)
- How did you verify the fix? (tests, monitoring, validation)
Your catalog becomes your intuition. Next time you see similar symptoms, you'll know where to look.
One entry can be this short:
Symptom: /feed p99 100ms -> 4s after a Friday release.
Root cause: N+1 query, one extra query per feed item.
How found: query count per request in tracing, 1 vs 200+.
Verified: query count back to 3, p99 back under 150ms.
The third line is the one you will reuse. "Check query count per request" is a move you can repeat on the next slow endpoint. The N+1 Query Problem story shows what that looks like at full scale.
I keep a "debugging journal" for every significant bug I fix. It's a simple document: symptom, root cause, investigation steps, solution. I review it monthly. Patterns emerge. "Slow queries usually mean missing indexes." "Memory leaks usually mean unbounded collections." "Race conditions usually mean shared state." Those patterns become intuition.
Question your assumptions
Intuition can mislead. You've seen this pattern before, so you assume it's the same problem. But assumptions block discovery.
Start each bug by asking: "What do I believe is true?" Then ask: "What if I'm wrong?" Actively try to disprove your first hypothesis. The bug is often in the assumption, not the code.
I once debugged a slow API endpoint. My intuition said: database query. I checked the queries—they were fast. My assumption was wrong. I checked logs—the endpoint was waiting for an external service. The bug wasn't where I expected it. Questioning my assumption led me to the real problem.
A useful trick: write your guess in one line before you test it, such as "I think the cache is cold." Then write what result would prove you wrong. If you cannot name one, the guess is too vague to test. Sharpen it first.
Use tools, don't rely on them
Logs, metrics, traces—they're all signals. But signals need interpretation. Don't trust a dashboard blindly. Don't assume logs tell the whole story. Learn what the tools show and what they hide. The monitoring and observability guide is a good place to see what each signal type can and cannot tell you.
A slow API might show up in response time metrics. But if the slow part is in a background job, those metrics won't show it. Understanding your tools' blind spots is crucial.
I once debugged a "slow" endpoint that showed normal response times in metrics. Users were complaining, but metrics said everything was fine. I added custom logging and discovered the endpoint was returning immediately, but a background job was slow. The metrics didn't show that. Understanding tool limitations is part of building intuition.
Debug with purpose
Don't just add logging everywhere. Ask: "What question am I trying to answer?" Then log only what answers it.
# Vague: log everything
logger.info(f"Processing request: {request}")
# Purposeful: answer "Is the cache hit rate what we expect?"
logger.debug(f"Cache lookup: key={key}, hit={hit}, ttl={ttl}")
Targeted debugging teaches you what signals matter. It also makes your logs useful instead of noisy. A log line that exists to answer a question tells you what to look for the next time the same symptom shows up. If you want to design logs that survive an incident, read error handling and logging. For logs that span many services, see distributed logging.
Follow the data, compare broken with working
Two moves do most of the work in day-to-day debugging. Both replace guessing with evidence.
Follow the data
When debugging, follow the data. Where does it come from? Where does it go? How does it get transformed? Data flow is easier to follow than code flow.
I once debugged a bug where user data was getting corrupted. I followed the data: it came from the API, went through validation, got stored in the database, then got retrieved and transformed. At each step, I checked: is the data correct here? I found the bug in the transformation step. Following the data led me directly to it.
The trick is to check at each boundary, not at the end. Halve the path: if the data is right in the database, the bug is after storage. If it is wrong, the bug is before. Repeat.
Use differential debugging
Compare broken with working. What's different? What changed? Differences point at causes.
I once debugged a feature that worked in staging but failed in production. I compared staging and production: same code, different data. The production database had records that staging didn't. That difference was the clue. Differential debugging helps you isolate the variable that matters.
Other pairs worth comparing: the last good release and the first bad one, one host and its neighbors, a request that failed and a request that passed with the same input. List every difference, then remove them one at a time until the failure moves.
Learn from production
The best debugging practice is real debugging. Take on-call shifts. Respond to alerts. Read postmortems. Every production incident is a lesson in how systems actually fail.
Production bugs are different from development bugs. They're harder to reproduce. They involve multiple systems. They happen under load. Production is where intuition gets sharp.
I learned more about debugging in my first on-call rotation than in two years of development. Production failures teach you that:
- Systems fail in ways you didn't expect
- Metrics can lie
- Logs can be overwhelming
- Time pressure changes everything
Those lessons don't come from tutorials. They come from experience.
You do not have to wait for your own outages to collect them. Read someone else's and stop halfway. Take the Cache Stampede Outage or the Memory Leak That Caused Gradual Degradation and read only the symptoms. Write down your top two guesses and the test you would run. Then read on and compare. You are borrowing the catalog entries of the people who lived it.
Build mental models
As you debug, build mental models. How does the system work? Where are the boundaries? Where are the failure points? Mental models guide your investigation.
When a bug appears, your mental model should tell you where to look first. "If this is a performance issue, it's probably in the database." "If this is a correctness issue, it's probably in the business logic." Those mental models come from understanding how the system works.
Make them sharper over time. "If p99 jumps but CPU is flat, something is waiting" is a better model than "it's probably the database." Waiting points to locks, connection pools, and calls with no timeout. Each time reality corrects you, update the model.
I make it a habit to understand one system deeply each quarter. I read the code, trace the flows, understand the patterns. That deep understanding builds mental models that guide my debugging intuition. The Art of Reading Production Code goes deeper on how to do that quickly.
Share your process and practice on purpose
When you debug something, explain how you found it. Write a brief note. Share it in team chat. Not the solution—the process. How did you know where to look? What signals pointed the way?
Teaching your process clarifies it for yourself. It also helps others build their intuition faster.
I write a brief "debugging story" for every significant bug I fix. It's not documentation—it's narrative. "The user reported X. I checked Y. That led me to Z. I investigated further and found..." Those stories help me remember the process, and they help others learn it. Good reviewers do the same thing in pull requests, which is the core idea of Code Review as Teaching.
Don't just debug when bugs appear. Practice debugging on purpose. Find an open-source project with known bugs. Debug them. Read the solutions. Compare your approach with others'. When someone fixes a bug, ask them how they found it. Learn their process. Adopt what works.
Try this week
Pick two small habits and keep them for five working days:
- One catalog entry a day. After any bug, even a small one, write four lines: symptom, root cause, how you found it, how you verified it.
- One disproof test. Before you act on your next hypothesis, name a test that could prove it wrong, and run that test first.
Debugging intuition is not magic. It's deliberate practice. Systematize your approach. Build your catalog. Question assumptions. Learn from production. The more bugs you debug, the faster you'll debug them.
But more importantly, the more patterns you recognize, the better your intuition becomes. Intuition is pattern recognition. Recognize more patterns, and your intuition gets sharper.
Frequently asked questions
- How do I get better at debugging?
- Use a process: reproduce consistently, isolate scope, compare with known good, form a hypothesis, test it. Build a catalog of past failures—symptom, root cause, how you found it. Your catalog becomes intuition. Question your assumptions; the bug is often in what you believed was true.
- What is differential debugging?
- Compare broken with working. What's different? Differences point at causes. The two can be staging and production, one host and its neighbors, or the release before and the release after. Change one difference at a time until the failure moves.
- Why do experienced engineers debug faster?
- They've seen more bugs and recognize patterns. Intuition is accumulated experience, organized. A process makes intuition reliable and teaches you what questions to ask. Document your debugging sessions so patterns emerge over time.
- What if I cannot reproduce the bug?
- That is information. Bugs that vanish on your laptop but appear in production often depend on timing, load, or data you do not have locally. Think race conditions, pool limits, and unusual records. The race condition story is a bug that only showed up under flash-sale concurrency.
- When should I trust my gut and when should I check?
- Trust it to pick where to look first. Do not trust it to declare the answer. Write your guess down, then run one test that could prove it wrong. If the test passes, you gain confidence. If it fails, you just avoided a long detour.
- How is this different from the essay on debugging sense?
- This essay is about the method you use over months: a loop, a catalog, and deliberate practice. On Cultivating Debugging Sense is about how you behave in the first ten minutes of an incident, such as capturing evidence before you restart.
- Where can I practice debugging without waiting for an outage?
- Read incident write-ups and stop halfway to guess the cause. The real engineering stories are written for this. You can also fix bugs in open-source projects, or ask a teammate how they found their last bug. Reading another person's debugging path is cheap practice.
- Does AI-generated code change how I should debug?
- It makes the loop more important. You did not write the code, so you have fewer instincts about where it breaks. Reproduce first, compare with a known good version, and verify the AI's explanation with evidence. See When AI Codes For You.
What's next?