bug-detective
Skill5 starsChanged 16 days agoMITView on GitHub
Debugs code bugs systematically. Builds a minimal repro that fails on demand, logs each hypothesis and how it was tested so the investigation doesn't go in circles, narrows the cause by binary search over code, input or history, and pins down the change that introduced a regression with a git bisect runner that checks both ends first, handles timeouts and flaky repros, and always restores HEAD. Then writes a failing test, fixes the root cause instead of the symptom, and looks for the same bug elsewhere. Use when the user asks to debug their code, fix a bug, find out why a test or function fails, throws an error or returns the wrong result, track down a regression ("it used to work", "which commit broke this"), run git bisect, or chase a flaky or intermittent failure that only happens sometimes.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- shkodnik1917/claude-brainlabtheir own version, first seen Nov 8, 2026
- Vepricov/claude-brainlabtheir own version, first seen Nov 1, 2026
- kharlamenkodev/skillstheir own version, first seen Oct 13, 2026
- bkywksj/knowledge-basetheir own version, first seen Oct 8, 2026
- Galaxy-Dawn/claude-scholartheir own version, first seen Apr 15, 2026
- Clay-HHK/claude-skillstheir own version, first seen Mar 5, 2026
Used with
Projects with it also use results-report, daily-coding and 10 more.
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.
Galaxy-DawnSkillresults-report
This skill should be used when the user asks to "write an experiment report", "summarize experimental results", "do experiment retrospection", "write a results report", "写实验总结报告", "写实验复盘", or mentions turning completed experiment artifacts into a structured, decision-oriented research report. It assumes strict analysis should come from `results-analysis` first.
Also in 3 projects that use this
Clay-HHKSkilldaily-coding
Daily coding assistant that auto-triggers when writing/modifying code, providing a core checklist.
Also in 3 projects that use this
Clay-HHKSkillkaggle-learner
This skill should be used when the user asks to "learn from Kaggle", "study Kaggle solutions", "analyze Kaggle competitions", or mentions Kaggle competition URLs. Provides access to extracted knowledge from winning Kaggle solutions across NLP, CV, time series, tabular, and multimodal domains.
Also in 3 projects that use this
AnthropicSkillcommand-development
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
Also in 3 projects that use this
AnthropicSkillhook-development
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.
Also in 3 projects that use this
indranilbanerjeeSkillreview-response
Draft a reply to one customer review, voice-scored, with escalation flags. \"reply to this 1-star review\"
Also in 3 projects that use this
- +2 more from Clay-HHK
- +1 more from anthropics
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- Galaxy-Dawn/claude-scholar★ 5.9ksame name
- bkywksj/knowledge-base★ 340same name
- shkodnik1917/claude-brainlab★ 35same name
- Vepricov/claude-brainlab★ 35same name
- Clay-HHK/claude-skills★ 1same name
- kharlamenkodev/skills★ 1same name
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 repository56 other files it gives its agents.
- docs/llms.txtllms.txt
- a11y-fixerSkill
- ad-copy-generatorSkill
- agent-guardrailsSkill
- agent-memory-keeperSkill
- ai-slop-detectorSkill
- api-to-sdkSkill
- app-store-optimizerSkill
- architecture-doctorSkill
- brand-voice-guideSkill
- changelog-from-gitSkill
- codebase-explainerSkill
- codebase-time-machineSkill
- commit-craftSkill
- competitor-spySkill
- content-repurposerSkill
- cost-cutterSkill
- demo-recorderSkill
- dependency-doctorSkill
- dockerize-anythingSkill
- durable-agent-workflowsSkill
- e2e-flow-testerSkill
- email-campaign-writerSkill
- env-secrets-guardSkill
- gh-actions-auditorSkill
- hook-generatorSkill
- incident-commanderSkill
- influencer-outreachSkill
- instagram-growth-managerSkill
- landing-page-roasterSkill
- launch-post-writerSkill
- meeting-notes-to-ticketsSkill
- merge-conflict-resolverSkill
- migration-wizardSkill
- plan-grillerSkill
- prompt-injection-scannerSkill
- pr-reviewer-proSkill
- readme-glow-upSkill
- roast-my-githubSkill
- screenshot-to-componentSkill
- seo-blog-writerSkill
- skill-creator-proSkill
- skill-finderSkill
- skills-doctorSkill
- social-analytics-reporterSkill
- social-media-calendarSkill
- social-media-managerSkill
- sql-optimizerSkill
- startup-idea-validatorSkill
- tdd-loopSkill
- terse-modeSkill
- test-gap-hunterSkill
- tiktok-viral-creatorSkill
- ui-tasteSkill
- youtube-script-writerSkill
- youtube-seo-optimizerSkill
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 8 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 16
If you will bisect, save it as a script outside the repo (/tmp/repro.sh) so it stays the same at every commit.
- Distinctive: line 18
Can't reproduce?: Don't guess-fix. List what differs between where it fails and where it doesn't (versions, data, env vars, OS, …
- Distinctive: line 31
Keep this table in the conversation and update it after every test, so ruled-out ideas stay ruled out:
- Distinctive: line 40
Don't re-test a ruled-out hypothesis without new evidence.
- Distinctive: line 41
After three ruled-out guesses in a row, stop guessing and narrow down (step 4).
- Very specific: line 84
Keep it short: the cause in one or two sentences with file:line, the commit that introduced it if you bisected, the fix, the proof (test …
- Distinctive: line 88
No fix before a repro. If you can't reproduce it, say so and say what you need.
- Distinctive: line 89
Never stash, reset, check out over or discard the user's uncommitted work.
- Distinctive: line 90
Don't delete, skip or loosen a failing test to make it pass.
- Distinctive: line 91
Don't commit or push without the user's OK.
“Common” is measured: kept by at least 6 in 10 of the 5 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
Bug Detective
Debug by evidence: reproduce, guess, test the guess, narrow by halves, fix the cause, prove it. For a live production outage, use incident-commander first. Come back here once there is a specific bug to fix.
1. Reproduce first
Get one command that exits non-zero while the bug is present and 0 once it is fixed: a single test, a script, a curl against a local server. Make it small and deterministic.
- Pin anything that varies between runs, such as random seeds, the clock and timezone, locale, test order (run the one test) and network calls (use a fixture or a local fake).
- Cut the input down to the smallest case that still fails.
- If you will bisect, save it as a script outside the repo (
/tmp/repro.sh) so it stays the same at every commit. - Flaky? Measure the failure rate before changing anything:
for i in $(seq 50); do ./repro.sh >/dev/null 2>&1 || echo F; done | wc -l. If it fails 1 run in 10, a fix needs about 30 clean runs to mean much (0.9^30 ≈ 4% chance of passing by luck). - Can't reproduce? Don't guess-fix. List what differs between where it fails and where it doesn't (versions, data, env vars, OS, concurrency), add logging at the suspect boundary, and ask the user for the exact input, stack trace or logs.
2. Write down observed vs expected
Observed: total() returns 90.0 for a cart of 100.0 with code SAVE10 and no discount rules
Expected: 100.0 (SAVE10 expired on 1 Oct)
Repro: pytest tests/test_cart.py::test_expired_code (fails 10/10)
Since: v2.3.0 was fine, main is not3. Keep a hypothesis log
Keep this table in the conversation and update it after every test, so ruled-out ideas stay ruled out:
| # | Hypothesis | Test, and the result that would rule it out | Result | Verdict |
| 1 | Expiry check uses local time, server runs UTC | Run the repro with TZ=UTC. Wrong if it still fails | still fails | ruled out |
| 2 | Code cache is read before the expiry check | Log the cache hit in apply_code() | cached code applied | confirmed |
- Decide what result would disprove the hypothesis before running the test.
- Change one thing at a time, and revert experiments that didn't help.
- Don't re-test a ruled-out hypothesis without new evidence.
- After three ruled-out guesses in a row, stop guessing and narrow down (step 4).
4. Narrow down by halves
In code, check the state at the midpoint of the path with a log line or an assert. Whichever half has the wrong value is where to look next. With input, halve the failing case until removing anything more makes it pass.
In history, bisect when it worked before (a version, a date, a commit). Find a good ref with git log --until=2026-09-01 -1 --format=%h or a release tag, then:
python3 scripts/bisect_run.py --good v2.3.0 -- /tmp/repro.sh # --bad defaults to HEAD
python3 scripts/bisect_run.py --good v2.3.0 --repeat 5 -- /tmp/repro.sh # flaky: any failure in 5 runs = bad
python3 scripts/bisect_run.py --good a1b2c3d --timeout 60 --timeout-means bad -- npm test -- parser # the bug is a hang
python3 scripts/bisect_run.py --good v2.3.0 --json -- 'make -s || exit 125; ./bin/check'How each run is scored: exit 0 is good. Exit 125, any code in --skip-on-exit, and a timeout are skip (unless --timeout-means bad). Everything else is bad, including crashes and 126/127. One argument after -- runs through sh -c, several run directly. --timeout is per run (default 600 s).
What it does for you: refuses to start with uncommitted changes to tracked files (it never stashes or discards them), runs the repro at --good (must pass) and --bad (must fail) before bisecting, and always runs git bisect reset, including on Ctrl-C. If it says the good ref also fails, a command was not found, or the bad ref passes, fix the repro instead of forcing it. If it warns that the first bad commit fails with a different exit code than --bad, that commit probably broke the build or the setup, not the behaviour you're after, so re-run with that code in --skip-on-exit.
Exit codes: 0 found · 1 only skipped commits left, so it lists the candidates · 2 usage or precondition error · 3 repro check failed at --good or --bad · 130 interrupted.
The first bad commit is a lead, not the answer. Read it (git show <sha>) and explain how the change produces the observed behaviour. If it only bumps a lockfile, the cause is in the dependency, so compare the package's changelog between the two versions.
5. Find the root cause
Keep asking why until one explanation accounts for every observation in the log, including the odd ones. A null check, a retry, a catch-all except, a longer timeout or a sleep hides the symptom unless you can also say why the value was null or why the call was slow. If a guard is the right fix for now, tell the user it is a guard and what the real cause is.
6. Write the failing test, then fix
Turn the repro into a test in the project's framework, at the lowest level that shows the bug. Run it and check it fails for the right reason: the assertion matches the bug, not an import error or a missing fixture. Then make the smallest change that fixes the cause.
7. Prove it
- The new test passes, and the repro passes. If it was flaky, use the run count from step 1.
- The rest of the suite (or at least the affected package) still passes.
- Debug logging and experiments are removed from the diff.
8. Check for siblings
The same mistake often lives in more than one place. Search for the pattern you fixed (git grep -n 'datetime.now()', the same copy-pasted block, other callers of the changed function) and fix them, or list them for the user.
Report
Keep it short: the cause in one or two sentences with file:line, the commit that introduced it if you bisected, the fix, the proof (test name, repro passes N/N), and any siblings found or left.
Rules
- No fix before a repro. If you can't reproduce it, say so and say what you need.
- Never stash, reset, check out over or discard the user's uncommitted work. Ask them to commit or stash it before bisecting.
- Don't delete, skip or loosen a failing test to make it pass.
- Don't commit or push without the user's OK.
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.

