Debugging
Debugging provides a four-phase framework for investigating issues methodically rather than applying random fixes. It combines root cause tracing through call stacks, defense-in-depth validation across system layers, and verification protocols to confirm fixes work before claiming success.
Debugging teaches systematic investigation and root cause analysis to identify and fix runtime errors correctly.
AI-generated summary based on this skill's SKILL.md
Install
samhvw8/dot-claude/debugging · repository language: Python
git clone https://github.com/samhvw8/dot-claude
cp -r dot-claude ~/.claude/skills/debugginggenerated, unverified - the skill's exact subdirectory could not be determined; check the repository on GitHub
npx skillfed install samhvw8/dot-claude/debuggingFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How do I debug my code effectively?
Debugging provides a methodical four-phase framework for investigating issues rather than applying random fixes. Start by reproducing the problem consistently, then trace root causes through call stacks and logs. Use breakpoints to pause execution at suspect points, inspect variable states, and step through code line-by-line. Validate fixes across system layers before confirming success—this defense-in-depth approach prevents masked errors from resurging in production.
What are the key debugging techniques and best practices?
Debugging emphasizes systematic investigation over guesswork. Core techniques include setting breakpoints at suspected failure points, using watchpoints to monitor variable changes, stepping through execution flow, and inspecting variable values during runtime. Best practices involve reproducing issues reliably first, checking assumptions at each layer, logging strategically to trace execution, and verifying that your fix actually resolves the root cause rather than just the symptom.
How do I step through code with a debugger?
Debugging tools let you pause execution at breakpoints, then advance through code using step-over (skip function calls), step-into (enter function calls), or step-out (exit current function) commands. Set breakpoints at lines where you suspect problems, run your application, and when execution pauses, inspect variable states in the debugger's watch window. This controlled stepping reveals exactly where logic diverges from expectations.
How can I find bugs in my application systematically?
Debugging's verification protocol starts by reliably reproducing the issue, then narrows the problem scope using binary search—disabling half your code, testing, then focusing on whichever half still fails. Trace execution flow through logs and call stacks, inspect variables at each step, and validate assumptions about data types and values. Once you identify the root cause, apply a targeted fix and verify it works across all affected code paths.
What's the difference between logging and debugging?
Debugging uses interactive tools like breakpoints and watchpoints to pause and inspect live execution, giving you real-time visibility into variable states and call stacks. Logging writes timestamped messages to files or streams, letting you trace execution asynchronously after the fact. Debugging excels at pinpointing exact failure moments; logging works better for production monitoring and tracing distributed systems where pausing isn't feasible.
How do I troubleshoot runtime errors using debugging?
Debugging addresses runtime errors through root cause tracing and defense-in-depth validation. When an error occurs, use stack traces to identify which function failed and why. Set breakpoints just before the failure point, inspect variable values, and verify they match your expectations. Check assumptions at each system layer—input validation, business logic, and output formatting. Once fixed, test across edge cases to confirm the error won't resurface.