一键导入
systematic-debugging
Enforce root-cause investigation before any fix. Use when encountering a bug, test failure, unexpected behavior, or build error.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Enforce root-cause investigation before any fix. Use when encountering a bug, test failure, unexpected behavior, or build error.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Periodic repository cleanup sweep (Tierward repo variant) - finds orphaned/merged git branches, orphaned worktrees and unregistered worktree directories, stale `.claude/session/*.md` files, stale `.claude/initiatives/*.md` files, and (target:full / target:reviews) orphaned documentation and stale `docs/reviews/` snapshots (archive-only moves, never deletion). Reports every finding with evidence, then executes only the branches/worktrees/session-files the user explicitly confirms via a single AskUserQuestion batch. Never deletes docs/*.md itself - those are always report-only, evidence-based, human-decided. Distinct from the Phase 8 cleanup gate (which tears down one specific block at closure) - this is the periodic sweep that catches what block-by-block cleanup misses.
Unified accessibility audit - axe-core WCAG 2.2 scan, APCA contrast measurement, static a11y checks (aria-label, tabindex, form labels, focus visibility, onClick on non-interactive). Static and live modes.
Performance audit: bundle size, lazy loading, data fetching, caching, N+1 queries, image optimization. Native mode checks memory, I/O, launch weight, energy.
Responsive audit: test pages at 375/768/1024px breakpoints via Playwright. Checks overflow, tap targets, sidebar collapse, text reflow, WCAG 1.4.4 zoom.
Security audit: auth/authz on API routes, input validation, row-level access control (RLS in Postgres, ORM scopes or app-level guards elsewhere), response shape review, secret exposure, HTTP headers. Native mode checks entitlements and Keychain. MCP-aware (v1.20+): when `mcp-nvd` server is wired, Step 3c queries live CVE data instead of static `npm audit` / `pip-audit` snapshots; falls back to local audit commands when MCP unreachable.
Database audit: schema quality, index coverage, row-level access-control completeness, FK cascades, query patterns. Runs live SQL verification (PostgreSQL instance in PATTERNS.md; other engines verify the equivalent guard). Migration file safety → /migration-audit.
| name | systematic-debugging |
| description | Enforce root-cause investigation before any fix. Use when encountering a bug, test failure, unexpected behavior, or build error. |
| user-invocable | true |
| model | opus |
| context | fork |
| allowed-tools | Read Glob Grep Bash Edit |
Random fixes waste time and introduce new bugs. Quick patches mask root causes.
The Iron Law: complete Phase 1 before proposing any fix. Skipping Phase 1 is not using this skill.
Any technical issue: test failures, runtime bugs, unexpected output, build errors, integration failures, performance regressions.
Use especially when:
Before any fix:
Read the error message fully. Stack traces, file paths, line numbers, error codes. Do not paraphrase — the text often contains the direct cause.
Reproduce consistently. List exact steps that trigger the issue. If not reproducible: add logging or assertions, gather more data, do not guess.
Check recent changes. What changed that could cause this? Git diff, new dependencies, config changes, environment differences.
In multi-component systems: add a log or assertion at each component boundary. Run once to identify which layer fails, then investigate that layer specifically.
Write the hypothesis before touching any code:
"The root cause is [X] because [Y]. Prediction: if X is true, then [Z] should also be observable."
Verify the prediction against Phase 1 evidence before proceeding.
* STOP — hypothesis written and verified against evidence. Wait for confirmation before Phase 4. *
Create a repro case before writing any fix — failing test, minimal script, or manual reproduction recipe. Must exist.
One change only. Fix the root cause identified in Phase 3. No bundled refactoring, no "while I'm here" edits.
Verify. The repro case passes. The full test suite is clean. No regressions.
If the fix does not work:
| Temptation | Why it fails |
|---|---|
| Proposing a fix before Phase 1 is done | Root cause unconfirmed — symptoms mask the real issue |
| "Quick fix now, investigate later" | Later never comes; the masked root cause resurfaces |
| Multiple changes in one attempt | Cannot isolate what worked; introduces new bugs |
| Skipping the repro case | Untested fixes rot silently when the codebase changes |
| 3+ fixes failed, one more attempt | Architectural signal — patching further adds debt |
| Excuse | Reality |
|---|---|
| "Issue is simple, process is overkill" | Simple bugs have root causes. Phase 1 takes 5 minutes on simple bugs. |
| "Emergency — no time for process" | Systematic is faster than guess-and-check thrashing. |
| "I see the problem, let me fix it" | Seeing symptoms ≠ understanding root cause. |
| "Multiple fixes at once saves time" | Cannot isolate what worked. Creates new bugs. |
| "One more attempt after 2 failed" | 3+ failures = architecture problem. Question the pattern, not the symptom. |