/primeline-skills:systematic-debuggingfrom primeline-skills
Use when encountering any bug, test failure, or unexpected behavior. Provides a structured 4-step cycle and ACH methodology for complex bugs. Replaces random guessing with evidence-based investigation.
Ships in primeline-skills. 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.
Stop guessing. Start investigating. Every bug follows a pattern - find the pattern, find the fix.
Announce: "Using systematic-debugging to investigate this issue."
For straightforward bugs, this is often enough:
If these 3 steps solve it, you're done. If not, use the full system below.
Goal: See the bug happen with your own eyes.
If you can't reproduce it, you can't fix it. Gather more context first.
Goal: Collect facts, not theories.
Read the relevant code. Don't guess what it does - read it.
Evidence Checklist:
- [ ] Full error message and stack trace
- [ ] The source code at the error location
- [ ] Recent changes to related files (git log --oneline -10 -- <file>)
- [ ] Input data that triggers the bug
- [ ] What the code should do vs what it actually does
Rule: Observe before editing. If you haven't read the code, you don't understand the bug. If you don't understand the bug, your fix will create the next bug.
Goal: Generate 2-3 possible explanations. Then test them.
For each hypothesis:
Don't stop at the first hypothesis that feels right. The most obvious explanation is wrong about 40% of the time.
Goal: Make the smallest change that fixes the bug. Verify it works.
Done. If the fix doesn't work, go back to Phase 2 with new evidence.
When a bug survives the 4-phase cycle, use Analysis of Competing Hypotheses:
Write down every possible explanation, including ones that seem unlikely:
H1: The database query returns stale cached data
H2: The auth token expires between request and response
H3: A race condition in the async handler
H4: The input validation silently drops a required field
| Evidence | H1 (Cache) | H2 (Token) | H3 (Race) | H4 (Validation) |
|---|---|---|---|---|
| Bug is intermittent | Consistent | Consistent | Supports | Inconsistent |
| Only happens under load | Neutral | Neutral | Supports | Inconsistent |
| Error log shows timeout | Inconsistent | Supports | Supports | Inconsistent |
| Fresh deploy doesn't fix | Supports | Neutral | Neutral | Supports |
Remove hypotheses that are inconsistent with the evidence. The survivor is your best lead.
In the example above, H4 is inconsistent with two pieces of evidence - eliminate it first. H1 is inconsistent with one - it's less likely. H2 and H3 both survive - investigate the one that's easier to test first.
| Situation | Method |
|---|---|
| Clear error message, obvious location | Quick Start (3 steps) |
| Known area, unclear cause | 4-Phase Cycle |
| Multiple possible causes, intermittent | ACH Method |
| Bug persists after 2+ fix attempts | ACH Method |
Complex bugs benefit from delegation. Score: Exploration (+3) + 3+ files (+2) = 5+. Delegate the investigation, keep the fix.
## 1. TASK
Investigate why [SYMPTOM] occurs when [TRIGGER].
## 2. EXPECTED OUTCOME
Root cause analysis: error location (file:line), why it fails, suggested fix.
## 3. REQUIRED TOOLS
Read, Grep, Glob, Bash (read-only: test output, git log)
## 4. MUST DO
- Reproduce the error by running: [COMMAND]
- Read the source at the error location
- Check git log for recent changes
- Form at least 2 hypotheses and test each
## 5. MUST NOT DO
- Don't modify any files
- Don't run the application in production mode
- Don't access external services
## 6. CONTEXT
Error: [FULL_ERROR_MESSAGE]
Relevant files: [FILE_LIST]
Last working state: [COMMIT_OR_DATE]
Agent: debugger | Model: Sonnet | Effort: Medium (6 turns)
| Pattern | Problem | Fix |
|---|---|---|
| "Let me just try this..." | Random changes without understanding | Phase 2 first - gather evidence |
| Fixing the symptom | Suppressing the error instead of the cause | Trace to the root, not the surface |
| Changing multiple things at once | Can't tell which change fixed it | One change, one test, one commit |
| Ignoring the stack trace | The answer is literally in the output | Read the error. All of it. |
| "It works on my machine" | Environment assumptions | Reproduce in the failing environment |
| Debugging in production | Risk of data loss or downtime | Reproduce locally first |
For the extended guide with recovery protocols, see references/anti-patterns.md.
If you have the Starter System installed:
/remember failure: [description] to log bugs you've seen before/remember at the start of debugging - the bug might be a known pattern/handoff to pass debugging context when you run out of session timeWhen Kairn is configured, debugging gains:
Without Kairn: each debugging session starts fresh. The 4-phase cycle still works, you just can't learn from past sessions automatically.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
5 skills in this plugin
/code-reviewUse when reviewing pull requests, reviewing your own code before committing, or when asked to review code changes. Provides structured analysis with severity categorization, security focus, and optional worktree isolation for safe PR review./config-architectUse when creating, restructuring, or scaling a CLAUDE.md file. Provides tiered loading patterns, organization templates, and token measurement guidance. Prevents the "unmanageable blob" problem./smart-delegationUse when facing any non-trivial task to decide whether to handle it yourself or delegate to a subagent. Provides score-based routing, model selection, and structured prompt templates for effective delegation./plan-and-executeUse when you have a multi-step task, before touching code. Creates bite-sized implementation plans with TDD emphasis, then executes them in batches with review checkpoints. Prevents the "just start coding" trap.Generated from the plugin's indexed repository (primeline-ai/primeline-skills) — no native marketplace selected
npx claudepluginhub p/primeline-ai-primeline-skills