ワンクリックで
systematic-debugging
Use when encountering any bug, test failure, unexpected behavior, or system anomaly — before proposing fixes
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when encountering any bug, test failure, unexpected behavior, or system anomaly — before proposing fixes
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
[Workflow] Explore an idea and design a solution before implementing
Use when the what or how of a change has open questions requiring collaborative design dialogue with the user — before committing to an approach
[Agent] Subagent persona for reviewing code changes against a plan and quality standards
Use when approaching complex exploration, research, or synthesis tasks — understanding systems, codebases, domains, or architectures before proposing changes or designs
Use when facing 2+ tasks that can proceed without shared state, sequential dependencies, or mutual file edits
[Workflow] Execute an implementation plan task by task with review checkpoints
| name | systematic-debugging |
| description | Use when encountering any bug, test failure, unexpected behavior, or system anomaly — before proposing fixes |
| metadata | {"owner":"shrug-labs","last_updated":"2026-03-23T00:00:00.000Z"} |
Find the root cause, then fix it. Guessing wastes time and creates new bugs.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
If you have not completed Phase 1, you cannot propose fixes.
No exceptions:
Violating the letter of this rule IS violating the spirit.
This skill is for bugs where the cause is not immediately visible from the error alone.
digraph debugging {
"Gather evidence" [shape=box];
"Root cause identified?" [shape=diamond];
"Analyze patterns" [shape=box];
"Form hypothesis" [shape=box];
"Test minimally" [shape=box];
"Confirmed?" [shape=diamond];
"Attempts >= 3?" [shape=diamond];
"Implement fix" [shape=box];
"Verify fix" [shape=doublecircle];
"Question architecture" [shape=doublecircle];
"Gather evidence" -> "Root cause identified?";
"Root cause identified?" -> "Analyze patterns" [label="no"];
"Root cause identified?" -> "Implement fix" [label="yes"];
"Analyze patterns" -> "Form hypothesis";
"Form hypothesis" -> "Test minimally";
"Test minimally" -> "Confirmed?";
"Confirmed?" -> "Implement fix" [label="yes"];
"Confirmed?" -> "Attempts >= 3?" [label="no"];
"Attempts >= 3?" -> "Question architecture" [label="yes — stop"];
"Attempts >= 3?" -> "Gather evidence" [label="no — new data"];
"Implement fix" -> "Verify fix";
}
BEFORE attempting ANY fix:
git diff and recent commits in the affected areaWhen the system has multiple components (CI -> build -> deploy, API -> service -> database, controller -> operator -> infrastructure):
For EACH component boundary:
1. What data enters this component?
2. What data exits this component?
3. What config/environment does it expect?
4. What is the actual state at this layer?
Run diagnostics ONCE to find WHERE it breaks.
THEN investigate that specific component.
MCP-aware evidence sources — use available integrations before manual investigation:
| Need | Check first | Manual fallback |
|---|---|---|
| Deployment state | CI/CD or deployment MCP tools | SSH to host, check process/logs |
| Related tickets | Issue tracker MCP tools | Search web UI |
| Recent PRs in area | Code review MCP tools | git log --oneline --all |
| Infrastructure state | Cloud provider MCP tools | CLI commands |
| Runtime logs | Observability MCP tools | kubectl logs, journalctl |
If a tool-orchestration skill is available, invoke it to select the right evidence source for the environment.
When the error appears deep in a call stack:
When manual tracing is blocked, add diagnostic instrumentation:
cwd, relevant env vars, caller stackNever fix where the error appears without checking where the bad data came from.
State it explicitly: "The root cause is X because evidence Y shows Z."
Hypothesis quality check. Prefer structural explanations (data flow, variable lifetime, error handling paths) over timing/concurrency theories unless there is direct evidence of concurrent execution (goroutine spawning, async callbacks, thread pools) in the call path. Concurrency bugs are real but rare; variable lifecycle bugs are common. A plausible concurrency theory without concurrency evidence wastes investigation cycles.
After fixing the source, add validation at each layer the bad data passed through:
| Layer | Purpose | Example |
|---|---|---|
| Entry point | Reject invalid input at API/function boundary | Validate non-empty, correct type, exists |
| Business logic | Ensure data is semantically valid for this operation | Domain invariant checks |
| Environment guard | Prevent dangerous operations in specific contexts | Refuse destructive ops outside temp dirs in tests |
| Diagnostic logging | Capture context for future forensics | Log inputs + stack before risky operations |
One layer catches most bugs. Four layers make the bug structurally impossible.
If three hypothesis-test cycles have failed:
STOP. This is not a bug in one component — it is an architectural problem.
Signs: each fix reveals new coupling, fixes require "massive refactoring," each fix creates symptoms elsewhere.
Escalate to the user before attempting fix #4. Present what you tried and what each attempt revealed.
When the bug involves flaky tests or race conditions:
| Excuse | Reality |
|---|---|
| "Issue is simple, skip process" | Simple bugs have root causes. Process takes 2 minutes for simple bugs. |
| "Emergency, no time" | Systematic debugging is faster than guess-and-check. Always. |
| "Just try this first" | The first fix sets the pattern. Start right. |
| "I'll write the test after" | Untested fixes regress. Test first proves the fix. |
| "Multiple fixes at once saves time" | Cannot isolate what worked. Creates new bugs. |
| "I see the problem" | Seeing symptoms is not understanding root cause. |
| "One more attempt" (after 2+ failures) | Three-strike rule. Question the architecture. |
| "The fix is obvious from the error" | Obvious fixes at symptom sites mask root causes upstream. |
| "CI flagged these files, just fix them" | The check scope may be wrong. Compare what the check scans to what the tool covers. Fixing files you didn't intentionally change may be treating a symptom. |
If you catch yourself doing any of these, STOP and return to Phase 1:
| Bug Type | Evidence Depth | Approach |
|---|---|---|
| Single-file logic error | Narrow — read error, read function | Trace data flow, fix at source |
| Cross-component failure | Broad — instrument boundaries | Boundary diagnostics, find failing handoff |
| Intermittent / flaky | Deep — timing, state, environment | Reproduce under load, condition-based waiting |
| Performance regression | Broad — profiles, metrics, diffs | Measure before/after, isolate hotspot |
| "Works on my machine" | Environment-focused | Diff environments, check config/state divergence |
Once the fix is verified, route to the appropriate next step:
Do not jump from debugging directly to large-scale changes. A verified root cause is an input to planning — not a license to refactor.