Lesson 8 15 min

Your Debugging Playbook

Build your personal debugging playbook — combine the 5-step process, bug patterns, tools, and AI prompts into a reusable system for solving any bug efficiently.

🔄 Recall Bridge: Over the past 7 lessons, you’ve learned the debugging mindset, error message reading, the 5-step process, debugging tools, bug patterns, production debugging, and root cause analysis. Now let’s combine everything into your personal debugging playbook.

A debugging playbook is your systematic approach to any bug — a decision tree built from everything you’ve learned. Instead of starting from scratch each time, you follow a proven process that gets faster with every bug you solve.

Your Complete Debugging Playbook

Phase 1: Triage (2 minutes)

Before investigating, assess the situation:

QuestionAction Based on Answer
Is production affected RIGHT NOW?Yes → symptom fix first, root cause later
Can I reproduce it?No → gather more context (user environment, logs, timing)
Have I seen this pattern before?Yes → jump to the matching bug pattern
Is the error message clear?Yes → follow the error directly to the source

Phase 2: Investigate (5-30 minutes)

StepActionTool
1. Read the errorExtract type, description, location, data stateError message anatomy (Lesson 2)
2. ReproduceFind the exact trigger conditionsReproduction checklist (Lesson 3)
3. Pattern matchMatch symptoms to known bug patternsBug pattern library (Lesson 5)
4. IsolateBinary search to find exact failure pointBinary search debugging (Lesson 3)
5. IdentifyUnderstand WHY the code failsDebugger or strategic logging (Lesson 4)

Phase 3: Fix (15-60 minutes)

ActionCheck
Write failing test firstTest fails with current code?
Fix the root causeDoes the 5 Whys analysis point here?
Run the testTest passes with fix?
Run full test suiteNothing else broke?
Add preventionMonitoring, linting rule, or documentation?

Bug Pattern Quick Reference

Use this table when you encounter a bug — match the symptoms to find the likely pattern:

SymptomLikely PatternFirst Check
“Cannot read property of null/undefined”Null referenceTrace backward to find where the value became null
Index out of bounds / missing last elementOff-by-oneCheck loop boundaries: < vs <=, 0 vs 1
Works locally, fails in production intermittentlyRace conditionCheck async operation ordering, add Promise.all()
Returns [object Promise]Missing awaitFind the async call without await
"5" + 3 = "53"Type mismatchCheck type coercion, use strict equality ===
Value changed “mysteriously”State mutationCheck if objects/arrays are mutated instead of copied
Works fine, then breaks after deployRegressionUse git bisect to find the breaking commit
Fails only with specific inputEdge caseTest empty strings, 0, null, special characters

AI Debugging Prompts Library

When you’re stuck (general):

I’ve been debugging for [TIME] and I’m stuck. Bug: [DESCRIBE]. What I’ve tried: [LIST]. My assumptions: [LIST]. Challenge my assumptions — which one is most likely wrong? Suggest 3 hypotheses I haven’t considered.

When you need pattern matching:

My bug has these symptoms: [LIST SYMPTOMS]. Which common bug pattern does this match: off-by-one, null reference, race condition, async error, type mismatch, state mutation, stale closure? Explain why and suggest the first thing to check.

When you need root cause analysis:

The immediate cause of my bug is [CAUSE]. Help me do a 5 Whys analysis to find the root cause. After each “why,” suggest what evidence I should look for. Stop when we reach a process or design fix.

When you need a fix reviewed:

Here’s my bug fix: [PASTE DIFF]. The bug was: [DESCRIBE]. Review my fix: (1) Does it address the root cause or just the symptom? (2) Could it break anything else? (3) What test should I write to prevent regression? (4) Is there a simpler fix?

Self-Assessment: Debugging Skills

Rate yourself honestly on each skill (1 = beginner, 5 = confident):

SkillKey Question
Error message readingCan I extract type, cause, location, and data state from any error?
Systematic reproductionCan I find exact trigger conditions for intermittent bugs?
Binary search debuggingDo I halve the problem space with each test?
Bug pattern recognitionCan I match symptoms to common patterns in under 30 seconds?
Tool selectionDo I choose the right tool (print, debugger, DevTools) for each situation?
Production debuggingCan I diagnose bugs using only logs and error tracking?
Root cause analysisDo I fix root causes or just symptoms?

Your weakest skill is your best learning opportunity. Focus practice there.

Common Debugging Mistakes

MistakeWhy It HurtsBetter Approach
Fixing without reproducingCan’t verify the fix worksAlways reproduce first
Changing multiple things at onceCan’t tell which change fixed itOne change per test
Assuming “it works on my machine”Ignoring environment differencesMatch the failing environment
Skipping the testBug returns weeks laterWrite the regression test before fixing
Stopping at the symptom fixBug returns in a different formDo the 5 Whys to find the root cause
Debugging alone for hoursTunnel vision on wrong hypothesisAfter 30 minutes stuck, get a fresh perspective
Not documenting what you triedRepeat failed approaches after a breakKeep a debugging log during investigation

30-Day Debugging Practice Plan

WeekFocusPractice
Week 1Error messagesFor every error you see, extract all 5 pieces (type, cause, location, data state, root question) BEFORE googling
Week 2Systematic processUse the 5-step process (reproduce → isolate → identify → fix → verify) on every bug, even simple ones
Week 3Pattern recognitionWhen you find a bug, name the pattern before fixing it. Keep a log of which patterns you see most
Week 4Root cause analysisFor every bug fix, ask “why” at least 3 times. Document one root cause analysis fully using the 5 Whys

Key Takeaways

  • Your debugging playbook is a three-phase system: triage (2 minutes — assess severity and check patterns), investigate (5-30 minutes — read error, reproduce, pattern match, isolate, identify), and fix (15-60 minutes — write failing test, fix root cause, verify, add prevention)
  • Pattern recognition is the highest-leverage debugging skill: matching symptoms to known bug patterns (null reference, off-by-one, race condition, type mismatch, state mutation) turns 30-minute investigations into 30-second diagnoses — build your pattern library by naming every bug you fix
  • The debugging meta-skill is knowing when to change approach: if you’ve been stuck for 30+ minutes, document what you’ve tried, challenge your assumptions (one of them is probably wrong), get fresh perspective from AI or a colleague, and take a break — persistence on the wrong path is not productive debugging

Course Complete

Congratulations — you now have a complete debugging toolkit. From reading error messages to root cause analysis, you can approach any bug systematically. The key is practice: use the playbook on every bug, even small ones, until the process becomes automatic. Happy debugging.

Knowledge Check

1. You encounter a bug you've never seen before. Your app shows correct data on page load but after 30 seconds, some numbers change to wrong values. No user interaction triggers it. How do you approach this using your debugging playbook?

2. You've been debugging for 2 hours and you're stuck. You've tried 8 different hypotheses and none of them were correct. What does your playbook say to do?

3. Your team has fixed 12 bugs this month. You notice that 5 of them were null reference errors in API response handling. What should you do beyond fixing each individual bug?

Answer all questions to check

Complete the quiz above first

Related Skills