Debug
Use when something is broken, failing, hanging, erroring, or behaving unexpectedly. Systematic debugging workflow: reproduce → isolate → hypothesize → fix → verify. Prevents guessing and shotgun fixes. Also triggers on frustration signals like 'why isn't this working', 'it's broken', 'stuck'.From its SKILL.md
npx -y skills add chrsmay/codebrain-plugin --skill debugAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.6 KB, as published. Nobody here has run it
CodeBrain Debug
Systematic debugging workflow. Diagnose before fixing. Evidence before assumptions.
CRITICAL RULE
Do NOT guess-and-fix. The #1 failure mode of AI debugging is jumping to a fix without understanding the root cause. This skill enforces a structured process that prevents that.
Usage
/codebrain:debug [description of the problem]
If no description provided, ask: "What's happening that shouldn't be? Or what's not happening that should be?"
Workflow
Phase 1: Understand the Symptom
-
Capture the exact error.
- If there's an error message: read it carefully, note the file:line, the error type, and the stack trace
- If there's unexpected behavior: get the user to describe expected vs. actual
- If there's a hang/timeout: note what was happening when it stalled
-
Check recent changes.
- Run
git log --oneline -10— what changed recently? - Run
git diff --stat— what's currently modified? - Has this ever worked? If yes, what changed since it last worked?
- Run
-
Read the constitution and relevant specs.
- Load
.codebrain/memory/known-issues.md— is this a known issue? - Load
.codebrain/memory/continuity.md— what was done in the last session?
- Load
Phase 2: Reproduce
-
Confirm the bug is reproducible.
- Run the failing command/test via Bash
- Capture the exact output
- If it can't be reproduced: note that and adjust approach (intermittent bugs need different strategies)
-
Narrow the scope.
- Can you reproduce with a simpler input?
- Does it fail on a specific file, endpoint, or data?
- Does it fail in isolation or only in combination?
Phase 3: Isolate
-
Trace the execution path.
- Use knowledge graph (
mcp__codebase_memory__trace_call_path) to trace from the entry point to the failure - Read each file in the call chain
- Identify where the actual behavior diverges from expected
- Use knowledge graph (
-
Check the blast radius.
- Use
mcp__code_review_graph__get_impact_radius_toolon recently changed files - Were any of the files in the error's call chain recently modified?
- Use
-
Binary search if needed.
- If the call chain is long, add diagnostic logging at the midpoint
- Run again — does the error occur before or after the midpoint?
- Repeat until isolated to a specific function/line
Phase 4: Hypothesize (Present to User)
-
Form exactly ONE hypothesis about the root cause.
- State it as: "The bug is caused by [X] in [file:line] because [evidence]"
- Cite the evidence: error message, call trace, git diff, test output
- If you have multiple possible causes, rank by likelihood and present the top one
-
Ask the user before fixing.
- Present: the hypothesis, the evidence, and the proposed fix
- Ask: "Does this match what you're seeing? Should I proceed with this fix?"
- Do NOT fix without user confirmation — this prevents shotgun fixes
Phase 5: Fix
-
Apply the minimal fix.
- Change as few lines as possible to fix the root cause
- Do NOT refactor surrounding code while fixing a bug
- Do NOT add "improvements" — fix the bug and nothing else
-
Follow constitution principles.
- Fail fast: if the fix adds error handling, it should be specific (not generic catch-all)
- KISS: simplest fix that addresses the root cause
- SRP: if the fix reveals a function doing too much, note it but don't refactor now
Phase 6: Verify
-
Reproduce the original failure — it should now pass.
- Run the same command from Phase 2 step 4
- If it still fails: go back to Phase 3, your hypothesis was wrong
-
Check for regressions.
- Run the full test suite
- Run build
- Check that the blast radius files still work
-
Update memory.
- If this was a tricky bug, add to
.codebrain/memory/known-issues.mdwith:- Symptom
- Root cause
- Fix applied
- How to prevent recurrence
- If this revealed a pattern, add to
.codebrain/memory/patterns.md
- If this was a tricky bug, add to
Phase 7: Prevent (Optional)
- Write a regression test that specifically tests the scenario that was broken.
- If the root cause was a systemic issue (not just a one-off typo), suggest a constitution principle or lint rule that would catch it in the future.
Output Format
# Debug Report
**Symptom:** [what went wrong]
**Root Cause:** [what caused it — file:line with evidence]
**Fix:** [what was changed]
**Regression Test:** [test name, if written]
**Prevention:** [suggested rule/pattern to prevent recurrence]
Rules
- Reproduce before hypothesizing. No fix without evidence.
- One hypothesis at a time. Don't shotgun multiple fixes hoping one works.
- Minimal fix. Change as few lines as possible. Don't refactor during debugging.
- Ask before fixing. Present the hypothesis and get user confirmation.
- Write it down. Every non-trivial bug goes into known-issues.md for future reference.
- Check the obvious first. Typos, wrong variable names, missing imports — before deep analysis.