Agent skill
debugging
Systematic debugging strategies and error analysis patterns. Auto-triggers when investigating bugs, analyzing stack traces, or troubleshooting issues.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/debugging-bigdegenenergy-open-cloud-ops
SKILL.md
Debugging Skill
The Scientific Method of Debugging
- Observe: Gather information about the bug
- Hypothesize: Form theories about the cause
- Predict: What should happen if hypothesis is correct?
- Test: Verify the hypothesis
- Iterate: Refine or reject, repeat
Information Gathering Checklist
- Error message and full stack trace
- Steps to reproduce (exact sequence)
- Expected vs actual behavior
- Environment details (OS, versions, config)
- Recent changes (commits, deployments)
- Frequency (always, intermittent, first occurrence)
- Impact scope (one user, all users, specific conditions)
Debugging Strategies
Binary Search (Bisect)
# Git bisect to find breaking commit
git bisect start
git bisect bad HEAD
git bisect good v1.0.0
# Test each commit, mark good/bad until found
Rubber Duck Debugging
- Explain the code line-by-line out loud
- State what each line SHOULD do
- Compare expectations to actual behavior
- The explanation often reveals the bug
Wolf Fence Algorithm
- Insert a check in the middle of the code
- Determine which half contains the bug
- Repeat, narrowing down to the exact location
Minimal Reproducible Example
- Remove unrelated code
- Simplify inputs
- Isolate the failing case
- Create standalone reproduction
Common Bug Categories
Logic Errors
- Off-by-one errors in loops
- Incorrect boolean logic
- Wrong operator (= vs ==)
- Missing null checks
- Race conditions
State Errors
- Uninitialized variables
- Stale state/cache
- Mutation of shared state
- Incorrect order of operations
Integration Errors
- API contract mismatches
- Serialization/deserialization issues
- Timezone handling
- Encoding problems (UTF-8)
Resource Errors
- Memory leaks
- Connection pool exhaustion
- File handle leaks
- Deadlocks
Debugging Tools by Language
JavaScript/TypeScript
// Conditional breakpoints
debugger;
// Console methods
console.log(value);
console.table(array);
console.trace();
console.time('operation');
console.timeEnd('operation');
// Chrome DevTools
// - Network tab for API calls
// - Performance tab for profiling
// - Memory tab for leak detection
Python
# Built-in debugger
import pdb; pdb.set_trace()
# IPython debugger (better UX)
import ipdb; ipdb.set_trace()
# Logging
import logging
logging.debug(f"Variable value: {var}")
# Profiling
import cProfile
cProfile.run('function()')
General
# Trace system calls
strace -f ./program
# Network debugging
tcpdump -i any port 8080
curl -v http://localhost:8080
# Memory debugging
valgrind ./program
Error Message Analysis
Stack Trace Reading
- Start from the bottom (root cause)
- Find YOUR code (not library code)
- Note the line number and function
- Check the error type and message
Common Patterns
NullPointerException → Missing null check
TypeError → Wrong type passed/returned
KeyError/IndexError → Invalid key/index access
ConnectionError → Network/service issue
TimeoutError → Operation too slow or hanging
When Stuck
- Take a break (fresh eyes help)
- Explain the problem to someone else
- Search error message (include quotes)
- Check recent changes in version control
- Question your assumptions
- Add more logging/instrumentation
- Try to make it worse (understanding helps)
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?