debugging-strategies
Skill6 starsChanged 6 months agoMITView on GitHub
When isolating and fixing unpredictable or complex software bugs.
11 other projects use a version of this.
Adopted by
Most recently taken up by
- xfstudio/skillstheir own version, first seen Oct 13, 2026
- Samueladewole/claude-skillstheir own version, first seen Oct 13, 2026
- Ghosteken/agent-harnesstheir own version, first seen Oct 1, 2026
- enes9103/my-claude-agents-skillstheir own version, first seen Sep 28, 2026
- roshankodi/agent-skillstheir own version, first seen Sep 22, 2026
- Fandry96/k3-agentic-skillstheir own version, first seen May 12, 2026
Used with
Projects with it also use code-review-excellence.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
xfstudioSkillcode-review-excellence
Master effective code review practices to provide constructive feedback, catch bugs early, and foster knowledge sharing while maintaining team morale. Use when reviewing pull requests, establishing review standards, or mentoring developers.
Also in 3 projects that use this
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- Fandry96/k3-agentic-skills★ 27same name
- xfstudio/skills★ 9same name
- ai4brands-design/claude-skills★ 2same name
- CodeWithBehnam/cc-docs★ 2same name
- Ghosteken/agent-harness★ 2same name
- ronrefael/sonde★ 2same name
- roshankodi/agent-skills★ 2same name
- lschGSL/claude_code_template★ 1same name
- enes9103/my-claude-agents-skills★ 0same name
- maikCyphlock/skills★ 0same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- caching-strategiesSkill
- event-driven-designSkill
- logging-observability-standardsSkill
- api-design-restSkill
- database-query-optimizationSkill
- error-handling-architectureSkill
- code-review-guidelinesSkill
- ci-cd-pipeline-architectureSkill
- git-workflow-branchingSkill
- dom-security-hardeningSkill
- react-component-designSkill
- state-management-patternsSkill
- accessibility-ui-designSkill
The file
We split this skill into the rules it gives an agent
12 rules. 0 are common, 12 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
12
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 50
Isolate the Subsystem: Use binary search (comment out code halves, use git bisect, add logging) to locate the exact module causing the issue
- Distinctive: line 52
Test Hypothesis: Add targeted logging or step through debugger to verify assumptions about state/variables at runtime
- Distinctive: line 55
Add Regression Test: Ensure this bug never reoccurs
- Distinctive: line 58
MUST establish a reproducible test BEFORE changing code
- Distinctive: line 59
MUST only change one variable or line at a time during hypothesis testing
- Distinctive: line 60
MUST NOT apply multiple changes simultaneously (makes diagnosis impossible)
- Distinctive: line 61
MUST use binary search for isolation (comment out halves, not random guessing)
- Distinctive: line 62
MUST formulate a hypothesis before adding logging or changes
- Distinctive: line 63
MUST keep the fix minimal (change only what caused the bug)
- Distinctive: line 75
Test passes but bug still exists in production
- Distinctive: line 76
No hypothesis formed before debugging
- Distinctive: line 95
Regression test: Test ensuring bug never reoccurs
“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Debugging Strategies
Purpose
"Guess and check" programming wastes hours. This skill replaces randomness with the scientific method: reproduce the bug reliably, isolate the failing component via binary search, formulate testable hypotheses, and apply minimal fixes. The goal is deterministic bug resolution, not random fixes that seem to work.
When to use
- Investigating a defect reported in production
- Facing a failing test with no obvious root cause
- Understanding unfamiliar or undocumented legacy code
- Debugging intermittent failures (flaky tests)
When NOT to use
- Performance optimization (use Caching Strategies or Database Query Optimization)
- Code review (use Code Review Guidelines)
- Architecture decisions (different concern)
Inputs required
- Failing code, test, or end-to-end scenario
- Ability to reproduce the failure
- Source code and execution environment
Workflow
- Reproduce the Bug: Consistently replicate the failure state. If you CANNOT reproduce it, STOP (get more details). Write a failing test.
- Isolate the Subsystem: Use binary search (comment out code halves, use
git bisect, add logging) to locate the exact module causing the issue - Formulate Hypothesis: Propose WHY the failure is happening based on logs, stack traces, and code inspection
- Test Hypothesis: Add targeted logging or step through debugger to verify assumptions about state/variables at runtime
- Apply Minimal Fix: Change ONLY what's necessary to make the test pass (single line if possible)
- Verify Fix: Confirm the failing test now passes, and no other tests break
- Add Regression Test: Ensure this bug never reoccurs
Rules
- MUST establish a reproducible test BEFORE changing code
- MUST only change one variable or line at a time during hypothesis testing
- MUST NOT apply multiple changes simultaneously (makes diagnosis impossible)
- MUST use binary search for isolation (comment out halves, not random guessing)
- MUST formulate a hypothesis before adding logging or changes
- MUST keep the fix minimal (change only what caused the bug)
Anti-patterns
- Shotgun Debugging: Randomly changing configuration or code until things "seem to work"
- Blaming the Compiler: Assuming the language/framework is broken before checking your code
- Adding Debug Code: Adding excessive logging everywhere instead of targeted logging
- Not Isolating: Staring at code trying to reason about it instead of actually testing
- Fixing Symptoms: "Fixing" the error message instead of fixing the root cause
- Multiple Changes: Changing 5 things at once, then one works, but you don't know which
Failure conditions
- Bug cannot be reproduced
- Test passes but bug still exists in production
- No hypothesis formed before debugging
- Fix applied without verification test
- Multiple changes applied simultaneously
Validation checklist
- Failing test or scenario created and reproducible
- Bug can be consistently reproduced every time
- Subsystem isolated (know which file/function is failing)
- Hypothesis is specific (not "something is wrong")
- Targeted logging/breakpoints confirm hypothesis
- Fix is minimal (only necessary changes)
- Failing test now passes
- No other tests broken
- Regression test added
- Root cause documented in code comments or commit
Output format
- Failing test: Automated test that reproduces the bug
- Minimal fix: Code change addressing root cause only
- Regression test: Test ensuring bug never reoccurs
- Documentation: Comment explaining root cause and why fix works
Security considerations
- Debug logging MUST NOT leak sensitive data (credentials, PII)
- Breakpoint debugging MUST NOT be left in production code
- Temporary logging MUST be removed before commit
- Hypothesis testing MUST NOT modify production data
Agent execution notes
- Agent MAY: Add failing tests, add targeted logging, apply minimal fixes, use git bisect
- Agent MUST NEVER: Make multiple changes simultaneously, apply fixes without tests, leave debug code
- Agent MUST ASK: Before running expensive operations, before modifying production-like data
- Agent MUST VALIDATE: Failing test reproduces bug, fix is minimal, regression test present
Example
❌ Anti-pattern (Shotgun debugging, multiple changes, no hypothesis):
// User reports: "Login sometimes fails"
// Response: randomly change stuff
// Change 1: Remove cache (wild guess)
Cache.clear();
// Change 2: Increase timeout (wild guess)
timeout = 5000;
// Change 3: Retry login (wild guess)
retry();
// Change 4: Restart server
process.restart();
// "It works now!" - but which change fixed it?✅ Correct pattern (Systematic, hypothesis-driven, minimal fix):
// User reports: "Login sometimes fails with 'Session token invalid'"
// 1. Create failing test
test('login should succeed with valid credentials', async () => {
const user = await login('user@test.com', 'password');
expect(user).toBeDefined();
});
// 2. Run test 10 times - fails randomly - good, reproducible
for (let i = 0; i < 10; i++) {
npm test; // Run failing test
}
// 3. Isolate subsystem with logging
function validateToken(token) {
console.log('Token:', token, 'Expires:', token.expiresAt, 'Now:', Date.now());
if (token.expiresAt < Date.now()) {
throw new Error('Token expired');
}
}
// 4. Hypothesis: Token generation race condition in parallel requests
// 5. Test: Run login twice simultaneously
Promise.all([login(...), login(...)]);
// Confirm: Second request gets token from first request but with different expiresAt
// 6. Minimal fix: Add mutex to token generation
const mutex = new Mutex();
async function generateToken() {
return mutex.runExclusive(async () => {
return createToken();
});
}
// 7. Verify: Failing test now passes 100 times
// 8. Add regression test
test('concurrent logins should not fail', async () => {
const results = await Promise.all([
login('user@test.com', 'password'),
login('user@test.com', 'password')
]);
expect(results.every(r => r)).toBe(true);
});Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

