skills/debugging/SKILL.md
Use when a test is failing, when a bug is reported, when behavior is unexpected or intermittent, when a build or integration step fails, or when a flaky test keeps resurfacing. Especially when "the fix seems obvious", when multiple previous fixes haven't stuck, or when under time pressure to ship.
npx skillsauth add joshsymonds/gambit debuggingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Debugging in gambit is investigation, not fixing. You reproduce the bug, gather evidence, trace to the true root cause, and write a test that proves you understand it. Then you hand that understanding to gambit:brainstorming, which designs the fix as an epic and runs it through the normal build pipeline.
Random fixes waste time and create new bugs. A fix for a symptom you don't understand is a guess wearing a confidence costume.
Core principle: Find the root cause with evidence before any fix is designed.
Iron Law: No fix designed without root-cause evidence AND a failing test that reproduces the bug. Think the fix is obvious? Prove it with evidence first. No exceptions.
Announce at start: "I'm using gambit:debugging to find the root cause."
MEDIUM FREEDOM — Follow the investigation sequence; adapt the techniques to the bug in front of you. Non-negotiable: evidence before hypothesis, a failing test before handoff, fix the source not the symptom.
| Step | Action | STOP If | |------|--------|---------| | 1 | Reproduce & gather evidence | Can't reproduce consistently | | 2 | Investigate root cause | Still guessing (no evidence) | | 3 | Write failing test that captures the bug | Test passes (doesn't catch it) | | 4 | Hand root cause to brainstorming | 3+ hypotheses already failed → question architecture |
Terminal: root cause + failing test → gambit:brainstorming designs and executes the fix. This skill does NOT fix, classify, or close — it understands, then hands off.
Don't use for: new features (gambit:brainstorming), refactoring (gambit:refactoring)
BEFORE forming any theory:
git log --oneline -10 and git diff HEAD~5..HEAD -- path/to/affected/codeMulti-component path? When the failing path crosses 3+ boundaries (CI → build → signing; handler → service → cache → DB), you can't reason out which component is broken from the error alone — instrument every boundary, run once, then investigate the layer the evidence points at. See references/root-cause-tracing.md.
Evidence before hypothesis. Use tools, not guessing.
WebSearch for error messages; dispatch an Explore agent for codebase investigation (how is this called? what data flows here? what changed?)Match the bug shape to a technique:
| Bug shape | Technique | |-----------|-----------| | Flaky / timing-dependent test | references/condition-based-waiting.md | | "Which test pollutes shared state?" | references/find-polluter.sh | | Deep-stack bug, unclear origin | references/root-cause-tracing.md |
Write the smallest test that reproduces the bug. Run it — it MUST fail.
A failing test is how you prove you found the real bug instead of a plausible story. If it passes immediately, you don't understand the bug yet — return to step 2.
def test_rejects_empty_email():
# Reproduces the reported bug: empty email slips through registration
_, err = create_user(User(email=""))
assert err is not None, "expected validation error for empty email"
This test is the artifact you hand to brainstorming — it pins down exactly what "fixed" means.
You now hold the two things a good fix needs: the root cause (with evidence) and a failing test that captures it. That's the seed of the fix epic.
Default (almost always) — invoke gambit:brainstorming:
Skill skill="gambit:brainstorming"
Tell it the investigation is done so it designs the fix rather than re-investigating. Feed it:
Brainstorming turns this into an epic and routes it through executing-plans → review like any other work — that's where the fix gets written, verified, and reviewed.
Fast path (one-liners only): if the root cause is a genuine one-line change and the failing test fully guards it, just make the change and verify (test passes + full suite green). Don't spin up an epic for a typo. Anything larger than a one-liner → brainstorming.
If 3+ hypotheses or fixes have already failed: STOP. Each fix revealing a new problem elsewhere, or fixes that need "massive refactoring," means your root-cause model is wrong or the architecture is. Question fundamentals with the user before handing a shaky diagnosis to brainstorming.
All mean: STOP. Return to steps 1–2.
| Excuse | Reality | |--------|---------| | "Issue is simple, don't need to investigate" | Simple issues have root causes too | | "Emergency, no time to investigate" | Systematic is FASTER than thrashing | | "Just try this fix first, then investigate" | First fix sets the pattern. Do it right. | | "I'll write the test after I confirm the fix" | Untested fixes don't stick | | "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause | | "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem | | "Obviously X is the cause" | "Obvious" causes are often wrong. Get evidence. |
Can't check these? Return to the process.
This skill calls:
Explore / general-purpose agents for codebase investigationWebSearch for error-message researchgambit:brainstorming (terminal — designs and executes the fix from the root cause)Called by:
gambit:parallel-agents (investigates each isolated failure)Workflow:
Bug → reproduce → evidence → root cause → failing test → gambit:brainstorming → (epic → executing-plans → review)
testing
Use when creating a new skill, modifying an existing skill, writing or rewriting a SKILL.md file, auditing a skill's description for discoverability, or when user mentions "create a skill", "write a skill", "new skill", "modify skill", "improve skill", "edit the skill".
development
Use before any completion claim, success statement, or marking a task done. Triggers when about to say "Great!", "Perfect!", "Done", "All set", "Ready to commit", before creating a PR, before moving to the next task, or when code has changed since the last test run.
data-ai
Use when starting an isolated feature branch, when working on multiple features simultaneously, when experimenting without affecting the main workspace, or when a clean workspace is needed before beginning implementation. User phrases like "start a new branch", "set up a worktree", "isolated workspace", "work on feature X separately".
development
Use at the start of every session before any response or action. Also invoke whenever uncertain which gambit skill applies, when about to implement / debug / refactor / test / plan / brainstorm, or when a user request could match any gambit skill even at 1% probability.