From 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.
How this skill is triggered — by the user, by Claude, or both
Slash command
/primeline-skills:debuggingThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Stop guessing. Start investigating. Every bug follows a pattern - find the pattern, find the fix.
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.
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub primeline-ai/primeline-skills