本文へ移動
cccskills
無料GitHub で公開

debug

Diagnosis before prescription: reproduce, hypothesize, isolate, fix root cause, add a regression test; refactor mode maps deps, coupling and blast radius. Triggers: bug, error, fix, broken, not working, crashed, stack trace, exception, refactor, restructure, coupling, dependency map.

インストール方法を見る

含まれるファイル(2)

  • SKILL.md7.1 KB
  • reference/debug-research.md18.4 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

<skill id="debug"> <purpose> Debugging is forming and testing a THEORY that explains the bug. Not random changes. Not guessing. Scientific method applied to code. DEFECT (in code) → INFECTION (in state) → FAILURE (visible symptom). The failure you see is NOT where the bug is. Binary search upstream. Systematic methodology beats ad-hoc guessing. The process is the multiplier.

Diagnosis comes before prescription: a surgeon cutting before the X-ray is guessing with a knife. Two modes, same discipline. bug (default) is the steps below. refactor swaps the subject from a failure to a structure, and produces a plan instead of a fix. </purpose>

<prerequisite>Run agentdb recall with the exact error text, subsystem/library, failing test, and known files/symbols. Recall again when the hypothesis changes or a new failure appears; that is a new retrieval question. Reference on demand: skills/debug/reference/debug-research.md.</prerequisite>

<steps> 1. **REPRODUCE**: get specific before touching code. - Document: exact input, expected output, actual output (full stack trace), environment, frequency. - "Sometimes fails" is not a reproduction. Get deterministic. - Sensitive or high-blast-radius bug: investigate read-only (plan mode) and settle the approach before any edit. <!-- Updated 2026-09-20: sitepoint.com / claudelog.com Claude Code debugging guides --> - (gate: can reproduce consistently, OR have added targeted logging to wait for next occurrence)
  1. HYPOTHESIZE: list 3 causes before pursuing any.

    • Read ALL error output first (anchoring bias mitigation).
    • Write each hypothesis to AgentDB. Prevents circular re-investigation.
    • (gate: 3 candidate hypotheses written; none pursued yet)
  2. ISOLATE: binary search, O(log n) not O(n).

    • Code: call chain A→B→C→D→E fails → check midpoint C → recurse into failing half.
    • Time: git bisect between known-good and known-bad commit. ~10 tests for 1000 commits.
    • Input: large failing input → split in half → recurse to minimal reproduction case.
    • Instrument at boundaries: log inputs/outputs at each layer boundary.
    • Mock external dependencies to isolate which one causes failure.
    <!-- Updated 2026-09-19: dev.to flaky-test patterns; claudelog/sfeir debugging guides -->
    • Diff working vs failing state (env, config, input, commit) before theorizing.

    • Flaky test: classify first as timing/race, shared state, unseeded randomness, or environment difference; only then propose a fix.

    • (gate: failure localized to a specific function/commit/input subset)

  3. ROOT CAUSE: the error line is the FAILURE. The DEFECT is upstream.

    • Ask: what assumption was violated? What invariant broke?
    • If you can't explain WHY it broke, you haven't found root cause.
    • Top causes by frequency: wrong input shape/type · off-by-one · missing null check · race condition · shared-state mutation · wrong comparison operator · variable scope · swallowed error · API contract mismatch · environment difference.
    • (gate: can state root cause in one sentence explaining the violated invariant)
  4. FIX: root cause, not symptom.

    • Fix the DEFECT, not the FAILURE site. (Null check at crash site = symptom fix.)
    • Write regression test that fails before fix, passes after.
    • Run: original failing case + edge cases + full regression suite.
    • Commit fix + test together.
    • (gate: regression test green; original failing case passes) </steps>

<refactor_mode> Triggers: refactor, restructure, clean up, coupling, dependency, "what breaks if". Same rule: diagnose, then hand off. Do not start cutting inside this mode.

  1. MAP: every file/module touching the target. Grep/Glob every reference, or graphify affected <symbol> when the graph is fresh. Build the import/call map.
  2. TRACE DEPS: per file, who calls it, who depends on it, what breaks if it changes.
  3. MEASURE COUPLING: cross-module reference counts, circular dependencies, the per-function CCN from scripts/complexity.sh.
  4. RISKS: current edge cases, what is tested, what is not, invariants to preserve.
  5. PLAN: files in change order, tests that must pass before AND after, tier by reversibility x blast radius (file count is only a weak hint). Hand off to /kernel:simplify to execute, which owns the preservation contract and the gate. </refactor_mode>

<diagnosis_output> When the run ends at a diagnosis rather than a fix, emit this and stop:

## Diagnosis: <title>
Mode: bug | refactor · Confidence: high | medium | low
Root cause: <one sentence naming the violated invariant>
Affected: <file - origin> | <file - downstream> ...
Blast radius: N files. Tier 1|2|3.
Hypotheses: 1. <h> -> CONFIRMED | REJECTED (<evidence>) ...
Recommended approach: <what, not how>
Tests required: <fails before> / <passes after>
Next: /kernel:ingest to implement, /kernel:simplify to restructure.

Decide and state the recommendation. Never stop to ask which hypothesis to pursue. </diagnosis_output>

<anti_patterns> Shotgun (random changes until it works) · fix-and-pray (never re-run the original case) · symptom fixing (null check at the crash site) · printf flooding (binary search first, then targeted logging) · blame-the-framework (it's almost never the library) · unscoped "investigate" (scope narrowly or use a subagent so the file reads don't fill context). </anti_patterns>

<when_stuck> Explain the problem in writing · re-read the error message (the answer is there most of the time) · reduce to a minimal reproduction · ask "what changed?" (git log/diff, deps, env) · search the exact error message in quotes · step away, bias accumulates. Re-run the EXACT original failing case before declaring victory; "seems to work" is not evidence. </when_stuck>

<escalation> 30+ min on one hypothesis with no evidence → abandon it. 3+ hypotheses rejected → step back, re-examine assumptions. 2 failed fix attempts → invoke tearitapart; it may be a design problem. Repeated failed corrections in one session → /clear with a minimal reproduction. Bug only in production → add targeted monitoring, document, move on. For 3+ plausible causes, spawn one fresh-context agent per hypothesis (evidence_for / evidence_against / confidence); fresh context catches what a long session anchors past. </escalation> <telemetry> agentdb emit command "debug" "" '{"mode":"bug|refactor","confidence":"high|medium|low","blast_radius":N,"tier":N}' </telemetry>

<on_complete> agentdb write-end '{"skill":"debug","bug":"<description>","root_cause":"<what_broke>","fix":"<what_fixed>","test":"<regression_test_name>","learned":"<pattern_for_future>"}' </on_complete>

</skill>

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Use AtomLane to compile and execute safe atomic parallel plans on macOS and native Windows Preview for worthwhile independent argv tasks, dependency DAGs, supported platform entrypoints, or Apple-silicon operators. Use at task start or an execution boundary when structured local work may contain two or more worthwhile units; skip plain answers, one quick command, and work whose effects cannot be safely bounded.

日本語の概要は準備中です。原文の説明を表示しています。

hashgraph-online/awesome-codex-plugins1,2732026年10月10日 更新

add

無料

Register a deferred decision in the debt registry. Trigger by judgment, not a marker scan, whenever a future reader would ask "why this way?": an unmade decision, stub, loosened type, bypassed check, swallowed error, a default picked "for now", or a TODO/FIXME/HACK/XXX marker. Trigger immediately whenever you defer work, or when the user invokes $add. Over-register freely; the developer drops with "drop A", "drop A,C", or "drop all".

日本語の概要は準備中です。原文の説明を表示しています。

hashgraph-online/awesome-codex-plugins1,2732026年10月10日 更新

ADK 框架适配层。为 LangChain / EINO / AutoGen / AgentScope / CrewAI 提供框架特定的 代码模板、惯用模式、API 映射和项目结构,供 agent-dev-workshop Phase 5 代码生成使用。 每个框架 reference 文件标注 verified_date 用于版本锁定。

日本語の概要は準備中です。原文の説明を表示しています。

hashgraph-online/awesome-codex-plugins1,2732026年10月10日 更新

中文调试修复技能。用于报错、测试失败、页面异常、功能不符合预期、需要定位根因并做最小修复时。触发语包括"进入调试模式""帮我修问题""报错了""测试失败""页面坏了""找根因"。

日本語の概要は準備中です。原文の説明を表示しています。

hashgraph-online/awesome-codex-plugins1,2732026年10月10日 更新

交互式 AI Agent 开发工作坊:通过 6 阶段深度协作对话,引导用户完成 Agent 需求分析、架构设计、 工具定义、Prompt 与编排设计、代码生成、验证迭代,产出可直接运行的 Agent 项目。 框架无关设计优先,支持 LangChain / EINO / AutoGen / AgentScope / CrewAI 等 ADK 框架。

日本語の概要は準備中です。原文の説明を表示しています。

hashgraph-online/awesome-codex-plugins1,2732026年10月10日 更新

中文漂移审计技能。用于项目或学习过程变乱、上下文漂移、任务分叉、多个方案冲突、命名不一致、Codex 可能顺手改多了时。触发语包括"漂移检查""感觉跑偏了""项目变乱了""检查是否失控""分叉太多""上下文漂移"。

日本語の概要は準備中です。原文の説明を表示しています。

hashgraph-online/awesome-codex-plugins1,2732026年10月10日 更新

hashgraph-online のスキルをすべて見る

このスキルの問題を報告する