From ccmagic
Systematic debugging with scientific method, parallel investigation, and persistent sessions
How this skill is triggered — by the user, by Claude, or both
Slash command
/ccmagic:debug [bug description] or [resume <slug>][bug description] or [resume <slug>]sonnetThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Systematic bug investigation using the scientific method. Persistent session files survive context resets and enable multi-session debugging.
Systematic bug investigation using the scientific method. Persistent session files survive context resets and enable multi-session debugging.
Parallel execution: When hypotheses are independent, test them simultaneously with parallel Explore agents.
Parse $ARGUMENTS:
resume <slug>: resume an existing debug session → load session fileAskUserQuestion to gather symptomsFor resume mode:
ls context/debug/*-{slug}*.md 2>/dev/null
Read the session file and skip to Step 5 (continue investigation from where it left off).
If $ARGUMENTS provides a bug description, use it. Otherwise gather via AskUserQuestion:
mkdir -p context/debug
Create context/debug/{YYYYMMDD-HHMMSS}-{slug}.md using the template from ${CLAUDE_SKILL_DIR}/session-template.md.
Fill in: symptoms, reproduction steps, environment, reproduction rate.
Load ${CLAUDE_SKILL_DIR}/methodology.md for the root cause taxonomy and hypothesis generation guidance.
Based on symptoms, classify as: crash/exception, wrong output, performance degradation, intermittent/flaky, or environment-specific. This narrows the investigation strategy.
git log --oneline -20
git log --oneline --since="3 days ago"
If the bug is recent and there are recent commits, it's likely a regression → mark git bisect as a priority strategy.
Generate 2-4 hypotheses, each with:
Rank by likelihood. Record all hypotheses in the session file.
Mark which hypotheses can be tested in parallel (no shared state or experiment interference) vs which must be sequential.
Launch up to 3 Explore agents simultaneously, one per independent hypothesis:
Use Task tool with:
subagent_type: "Explore"
prompt: |
# Hypothesis Investigation
## Bug Context
**Symptom**: {symptom}
**Reproduction**: {steps}
## Hypothesis to Test
{hypothesis statement}
## Prediction
If this is correct: {expected observation}
## Experiment
{what to check — specific files, code paths, git history, logs}
## Instructions
1. Execute the experiment exactly as described
2. Compare results against the prediction
3. Report:
- Verdict: CONFIRMED / REFUTED / INCONCLUSIVE
- Evidence: specific file:line references, command output
- If CONFIRMED: describe the root cause precisely
- If REFUTED: what does this eliminate? Any new hypothesis suggested?
- If INCONCLUSIVE: what additional experiment would be decisive?
When the bug is a regression with a known-good point:
# Offer automated bisection
git bisect start
git bisect bad HEAD
git bisect good {known-good-commit}
# Automate with reproduction test if available:
git bisect run {test-command}
git bisect reset
Use AskUserQuestion to confirm the known-good commit before starting bisect.
Test one at a time, updating the session file after each result.
After agents return or experiments complete:
Add a timestamped journal entry for each investigation round:
If not yet resolved, use AskUserQuestion:
Debug Status: {round N complete}
Tested: {hypotheses tested and verdicts}
Current best lead: {most promising direction}
How to proceed?
- Another round — {suggested next hypotheses}
- Git bisect — narrow down the regression commit
- Blocked — save findings, pause investigation
- Widen scope — explore different root cause categories
When root cause is confirmed:
Update session file with:
file:line)AskUserQuestionRun the reproduction steps and confirm the bug is gone:
{reproduction command that should now succeed}
If tests exist for the affected area, run them:
{relevant test command}
After fix is verified, prompt for regression test creation:
Use AskUserQuestion:
Fix verified. Create a regression test?
- Yes — write a test that reproduces the original bug (should pass now, would have caught this)
- No — skip (add a TodoWrite reminder instead)
If yes:
If no:
TodoWrite entry: "Add regression test for {bug slug} — {file:line}"Resolvedmkdir -p context/debug/resolved
mv context/debug/{session-file} context/debug/resolved/
Bug resolved!
Root Cause: {category} — {brief explanation}
Location: {file:line}
Fix: {what was changed}
Regression Test: {test file or "deferred"}
Session log: context/debug/resolved/{filename}
If the investigation revealed related issues:
TodoWrite entries for each so they're not lost.When invoked, immediately begin investigation. For new sessions, capture symptoms and generate hypotheses quickly — don't over-plan before investigating. For resume sessions, read the session file and pick up exactly where the last investigation left off. Each round should make measurable progress: either confirm/refute a hypothesis or narrow the search space. Document everything in the session file — it's the lifeline across context resets.
npx claudepluginhub devondragon/ccmagic --plugin ccmagicCreates bite-sized, testable implementation plans from specs or requirements, with file structure and task decomposition. Activates before coding multi-step tasks.