Agent skill
debugging
Systematic debugging that identifies root causes rather than treating symptoms. Uses sequential thinking for complex analysis, web search for research, and structured investigation to avoid circular reasoning and whack-a-mole fixes.
Install this agent skill to your Project
npx add-skill https://github.com/ratacat/claude-skills/tree/main/skills/debugging
SKILL.md
Debugging
Quickstart
- Capture exact repro, scope, and recent changes
- Isolate components/files; trace path to failure
- Research exact error; check official docs
- Compare failing vs working patterns; form a testable hypothesis
- Verify with minimal test; apply minimal fix across all instances; validate
When to Use This Skill
Use debugging when:
- A bug has no obvious cause or has been "fixed" before but returned
- Error messages are unclear or misleading
- Multiple attempted fixes have failed
- The issue might affect multiple locations in the codebase
- Understanding the root cause is critical for proper resolution
Skip this skill for:
- Simple syntax errors with obvious fixes
- Trivial typos or missing imports
- Well-understood, isolated bugs with clear solutions
Core Anti-Patterns to Avoid
Based on documented failures in AI debugging, explicitly avoid:
- Circular Reasoning: Never propose the same fix twice without learning why it failed
- Premature Victory: Always verify fixes were actually implemented and work
- Pattern Amnesia: Maintain awareness of established code patterns throughout the session
- Context Overload: Use the 50% rule - restart conversation when context reaches 50%
- Symptom Chasing: Resist fixing error messages without understanding root causes
- Implementation Before Understanding: Never jump to code changes before examining existing patterns
UNDERSTAND (10-step checklist)
- Understand: capture exact repro, scope, and recent changes
- Narrow: isolate components/files; trace path to failure
- Discover: research exact error (WebSearch → Parallel Search, Context7:get-library-docs)
- Examine: compare against known-good patterns in the codebase
- Reason: use SequentialThinking:process_thought and 5 Whys to reach root cause
- Synthesize: write a falsifiable hypothesis with predictions
- Test: add logs/tests to confirm the mechanism
- Apply: minimal fix for root cause, across all occurrences, following patterns
- Note: record insights, warnings, decisions
- Document: update comments/docs/tests as needed
Progress Tracking with TodoWrite
Use TodoWrite to track debugging progress through the UNDERSTAND checklist:
-
At start: Create todos for each applicable step:
☐ U - Capture exact repro and scope ☐ N - Isolate failing component ☐ D - Research error message ☐ E - Compare with working patterns ☐ R - Root cause analysis (5 Whys) ☐ S - Write falsifiable hypothesis ☐ T - Verify with minimal test ☐ A - Apply fix across all occurrences ☐ N - Record insights ☐ D - Update docs/tests -
During debugging: Mark steps in_progress → completed as you work through them
-
When stuck: TodoWrite makes it visible which step is blocked - helps identify if you're skipping steps or going in circles
-
Skip steps only if: Bug is simple enough that checklist is overkill (see "Skip this skill for" above)
Tool Decision Tree
- Know exact text/symbol? → grep
- Need conceptual/semantic location? → codebase_search
- Need full file context? → read_file
- Unfamiliar error/behavior? → Context7:get-library-docs, then WebSearch → Parallel Search
- Complex multi-hypothesis analysis? → SequentialThinking:process_thought
Context Management
- Restart at ~50% context usage to avoid degraded reasoning
- Before restart: summarize facts, hypothesis, ruled-outs, next step
- Start a fresh chat with just that summary; continue
Decision Framework
IF same fix proposed twice → Stop; use SequentialThinking:process_thought IF error is unclear → Research via WebSearch → Parallel Search; verify with docs IF area is unfamiliar → Explore with codebase_search; don't guess IF fix seems too easy → Confirm it addresses root cause (not symptom) IF context is cluttered → Restart at 50% with summary IF multiple hypotheses exist → Evaluate explicitly (evidence for/against) IF similar code works → Find and diff via codebase_search/read_file IF declaring success → Show changed lines; test fail-before/pass-after IF fix spans multiple files → Search and patch all occurrences IF library behavior assumed → Check Context7:get-library-docs
Quality Checks Before Finishing
Before declaring a bug fixed, verify:
- Root cause identified and documented
- Fix addresses cause, not symptom
- All occurrences fixed (searched project-wide)
- Follows existing code patterns
- Original symptom eliminated
- No regressions introduced
- Tests/logs verify under relevant conditions
- Docs/tests updated (comments, docs, regression tests)
References
reference/root-cause-framework.mdreference/antipatterns.md
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
brave-search
Use when user asks to search the web, look something up online, find current/recent/latest information, or needs cited answers. Triggers on "search", "look up", "find out about", "what is the current/latest", image searches, news lookups. NOT for searching code/files—only for web/internet searches.
bug-reproduction-validator
Use this agent when you receive a bug report or issue description and need to verify whether the reported behavior is actually a bug. This agent will attempt to reproduce the issue systematically, validate the steps to reproduce, and confirm whether the behavior deviates from expected functionality. <example>\nContext: The user has reported a potential bug in the application.\nuser: "Users are reporting that the email processing fails when there are special characters in the subject line"\nassistant: "I'll use the bug-reproduction-validator agent to verify if this is an actual bug by attempting to reproduce it"\n<commentary>\nSince there's a bug report about email processing with special characters, use the bug-reproduction-validator agent to systematically reproduce and validate the issue.\n</commentary>\n</example>\n<example>\nContext: An issue has been raised about unexpected behavior.\nuser: "There's a report that the brief summary isn't including all emails from today"\nassistant: "Let me launch the b...
agent-native-audit
Run comprehensive agent-native architecture review with scored principles
brainstorming
This skill should be used before implementing features, building components, or making changes. It guides exploring user intent, approaches, and design decisions before planning. Triggers on "let's brainstorm", "help me think through", "what should we build", "explore approaches", ambiguous feature requests, or when the user's request has multiple valid interpretations that need clarification.
performance-oracle
Use this agent when you need to analyze code for performance issues, optimize algorithms, identify bottlenecks, or ensure scalability. This includes reviewing database queries, memory usage, caching strategies, and overall system performance. The agent should be invoked after implementing features or when performance concerns arise.\n\n<example>\nContext: The user has just implemented a new feature that processes user data.\nuser: "I've implemented the user analytics feature. Can you check if it will scale?"\nassistant: "I'll use the performance-oracle agent to analyze the scalability and performance characteristics of your implementation."\n<commentary>\nSince the user is concerned about scalability, use the Task tool to launch the performance-oracle agent to analyze the code for performance issues.\n</commentary>\n</example>\n\n<example>\nContext: The user is experiencing slow API responses.\nuser: "The API endpoint for fetching reports is taking over 2 seconds to respond"\nassistant: "Let me invoke the...
triage
Triage and categorize findings for the CLI todo system
Didn't find tool you were looking for?