From code-quality-plugin
Guides systematic debugging with principles, workflows, bug patterns, and tools for memory (Valgrind), performance (perf/cProfile), and system tracing (strace/eBPF).
How this skill is triggered — by the user, by Claude, or both
Slash command
/code-quality-plugin:debugging-methodologyopusThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Systematic approach to finding and fixing bugs.
Systematic approach to finding and fixing bugs.
1. Understand → What is expected vs actual behavior?
2. Reproduce → Can you trigger the bug reliably?
3. Locate → Where in the code does it happen?
4. Diagnose → Why does it happen? (root cause)
5. Fix → Minimal change to resolve
6. Verify → Confirm fix works, no regressions
| Symptom | Likely Cause | Check First |
|---|---|---|
| TypeError/null | Missing null check | Input validation |
| Off-by-one | Loop bounds, array index | Boundary conditions |
| Race condition | Async timing | Await/promise handling |
| Import error | Path/module resolution | File paths, exports |
| Type mismatch | Wrong type passed | Function signatures |
| Flaky test | Timing, shared state | Test isolation |
# Valgrind (C/C++/Rust)
valgrind --leak-check=full --show-leak-kinds=all ./program
valgrind --tool=massif ./program # Heap profiling
# Python
python -m memory_profiler script.py
# Linux perf
perf record -g ./program
perf report
perf top # Real-time CPU usage
# Python
python -m cProfile -s cumtime script.py
# System calls (ptrace-based, high overhead)
strace -f -e trace=all -p PID
# Library calls
ltrace -f -S ./program
# Open files/sockets
lsof -p PID
# Memory mapping
pmap -x PID
eBPF is the modern replacement for strace/ptrace-based tracing. Key advantages:
# BCC tools (install: apt install bpfcc-tools)
# Trace syscalls with timing (like strace but faster)
sudo syscount -p PID # Count syscalls
sudo opensnoop -p PID # Trace file opens
sudo execsnoop # Trace new processes
sudo tcpconnect # Trace TCP connections
sudo funccount 'vfs_*' # Count kernel function calls
# bpftrace (install: apt install bpftrace)
# One-liner tracing scripts
sudo bpftrace -e 'tracepoint:syscalls:sys_enter_open { printf("%s %s\n", comm, str(args->filename)); }'
sudo bpftrace -e 'uprobe:/bin/bash:readline { printf("readline\n"); }'
# Trace function arguments in Go/other languages
sudo bpftrace -e 'uprobe:./myapp:main.handleRequest { printf("called\n"); }'
eBPF Tool Hierarchy:
| Level | Tool | Use Case |
|---|---|---|
| High | BCC tools | Pre-built tracing scripts |
| Medium | bpftrace | One-liner custom traces |
| Low | libbpf/gobpf | Custom eBPF programs |
When to use eBPF over strace:
# Packet capture
tcpdump -i any port 8080
# Connection status
ss -tuln
netstat -tuln
# Quick debug
import pdb; pdb.set_trace()
# Better: ipdb or pudb
import ipdb; ipdb.set_trace()
# Print with context
print(f"{var=}") # Python 3.8+
// Browser/Node
debugger;
// Structured logging
console.log({ var1, var2, context: 'function_name' });
// Debug print
dbg!(&variable);
// Backtrace on panic
RUST_BACKTRACE=1 cargo run
When stuck, ask:
npx claudepluginhub laurigates/claude-plugins --plugin code-quality-pluginProvides bug classification trees and systematic workflows for reproducing, isolating, identifying, and fixing crashes, hangs, memory leaks, races, deadlocks, performance issues.
Guides systematic debugging techniques including scientific method, reproduction checklists, hypothesis testing, and binary search for bugs, performance issues, and unexpected behavior across codebases.
Master systematic debugging techniques, profiling tools, and root cause analysis for tracking down bugs and performance issues across any codebase.