No slash command · from bugfix
Structured debugging process for bug fixes: reproduce, plan, failing test, fix, verify. Use when fixing bugs.
Ships in bugfix. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Structured debugging methodology for fixing bugs. Ensures bugs are properly understood before fixing, captured in tests to prevent regression, and fixed with minimal changes.
┌─────────────────────────────────────────────────────────────────────────────────┐
│ BUG FIX WORKFLOW │
├─────────────────────────────────────────────────────────────────────────────────┤
│ 1. REPRODUCE → 2. PLAN → 3. FAILING TEST → 4. FIX → 5. VERIFY │
└─────────────────────────────────────────────────────────────────────────────────┘
Goal: Confirm the bug exists and understand how to trigger it.
Procedure:
Output: Bug reproduction confirmed with clear steps
## Bug Reproduction
- **Steps to reproduce:**
1. ...
2. ...
- **Expected:** ...
- **Actual:** ...
- **Environment:** <runtime version>, <os/platform>
Key Rule: Cannot proceed without reproduction. If you can't trigger the bug, you can't verify the fix.
Goal: Understand WHY the bug occurs and design the fix approach.
Procedure:
/developer for code patternsDebug Logging Pattern:
# Add temporary debug logging to trace execution
# TypeScript: logger.debug('checkpoint', { var1, var2 });
# Python: logger.debug(f"checkpoint: {var1=}, {var2=}")
# Go: log.Printf("checkpoint: var1=%v var2=%v", var1, var2)
Output: Root cause identified + fix plan approved
## Root Cause & Fix Plan
- **Location:** `<file>:<line>`
- **Cause:** Off-by-one error in array index comparison (uses `<` instead of `<=`)
- **Why it happens:** Edge case when index equals array length exactly
- **Fix:** Change `<` to `<=` in boundary comparison
- **Edge cases:** Empty array, single element, last element
Key Rule: Get user approval before proceeding. Never guess-and-fix.
Goal: Capture the bug in a test that fails with current code.
Procedure:
Output: A failing test that documents the bug
# Write a test that exercises the exact bug scenario
# The test MUST fail before the fix is applied
# TypeScript/Jest: it('should handle boundary', () => { expect(fn(edge)).toBe(expected); });
# Python/pytest: def test_boundary(): assert fn(edge) == expected
# Go: func TestBoundary(t *testing.T) { if got := fn(edge); got != want { t.Errorf(...) } }
Key Rule: Do NOT proceed to fixing until you have a failing test. The test is proof the bug exists and will prevent regression.
Goal: Implement the minimal fix that makes the failing test pass.
Procedure:
Output: Failing test now passes, debug logs removed
# Example: Off-by-one fix (language agnostic)
# Before (bug): if index < length
# After (fix): if index <= length
Key Rule: Minimal fix only. Do not refactor, clean up, or "improve" surrounding code. That's a separate task.
Goal: Ensure the fix doesn't break anything else.
Procedure:
Output: All tests pass, pre-commit succeeds
task test # Run all tests
task precommit # Run lint + tests
┌─────────────────┐
│ Bug reported │
└────────┬────────┘
│
▼
┌─────────────────┐ ┌─────────────────┐
│ B1: REPRODUCE │────►│ Cannot reproduce│
│ │ │ Ask for context │
└────────┬────────┘ └─────────────────┘
│ ✓ Confirmed
▼
┌─────────────────┐ ┌─────────────────┐
│ B2: PLAN │────►│ Unclear cause? │
│ Root cause + │ │ Add debug logs │
│ fix approach │◄────│ Re-analyze │
│ (uses /developer)│ └─────────────────┘
└────────┬────────┘
│ ✓ User approved
▼
┌─────────────────┐
│ B3: FAILING TEST│
│ Write test that │
│ captures bug │
└────────┬────────┘
│ ✓ Test fails
▼
┌─────────────────┐ ┌─────────────────┐
│ B4: FIX │────►│ Test still fails│
│ Minimal change │ │ Re-analyze fix │
│ │◄────│ │
└────────┬────────┘ └─────────────────┘
│ ✓ Test passes
▼
┌─────────────────┐ ┌─────────────────┐
│ B5: VERIFY │────►│ Other tests fail│
│ Run all tests │ │ Check side │
│ │◄────│ effects │
└────────┬────────┘ └─────────────────┘
│ ✓ All pass
▼
┌─────────────────┐
│ Ready for │
│ /commit │
└─────────────────┘
When working on a bug fix, track progress in workflow context:
{
"type": "fix",
"bugfix": {
"phase": "plan",
"reproductionConfirmed": true,
"rootCause": "Off-by-one in boundary comparison",
"rootCauseLocation": "<file>:<line>",
"planApproved": true,
"failingTestFile": "<test-file>"
}
}
| Don't | Do Instead |
|---|---|
| Jump straight to fixing | Reproduce first, plan the fix |
| Change code to debug | Add debug logs, analyze, then change |
| Fix without approval | Get user approval on fix plan |
| Fix + refactor together | Minimal fix only, refactor separately |
| Skip regression tests | Always run full test suite |
| Guess the root cause | Trace code path, add logs if unclear |
When /workflow start detects a bug ticket (via "bug" label or keywords), it triggers this bugfix flow:
/workflow start PROJ-123 (bug ticket)type: fix/commit → /pr-createSee skill.yaml for patterns and procedures.
See sharp-edges.yaml for common debugging pitfalls.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub dohernandez/claude-skills --plugin bugfix