debug

debug is a skill for Claude Code from ariaxhan/kernel-claude. It costs 64 tokens per session (1,746 once invoked), scanned A, original, MIT.

A structured method for debugging software failures by reproducing the problem, testing several possible causes, isolating the failing part, and identifying the upstream defect. Each fix is checked with a regression test, which ensures the same bug does not return.

In plain words
What is it for?
Use it when a bug, failed test, crash, exception, unexpected result, or regression needs a carefully verified root-cause fix.
Why use it?
It reduces guesswork and helps prevent fixes that only hide the visible error. It also keeps later investigations from repeating work or stopping at the wrong line of code.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions subagents; mentions Claude Code.

Part of the kernel plugin — 27 skills, 10 agents, 4 hooks shipped together

Good fit Use it when a bug, failed test, crash, exception, unexpected result, or regression needs a carefully verified root-cause fix.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ariaxhan/kernel-claude/debug
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ariaxhan/kernel-claude --skill debug
Clone the repo
git clone --depth 1 https://github.com/ariaxhan/kernel-claude

Made for: Claude Code.

Or install kernel, the plugin that ships this one along with the rest of its 27 skills, 10 agents, 4 hooks.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for debug

README.md
[![agentmods](https://agentmods.dev/badge/skills/ariaxhan/kernel-claude/debug/github.svg)](https://agentmods.dev/skills/ariaxhan/kernel-claude/debug)
Your own site
<a href="https://agentmods.dev/skills/ariaxhan/kernel-claude/debug"><img src="https://agentmods.dev/badge/skills/ariaxhan/kernel-claude/debug/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for debug

Your own site · 80×15
<a href="https://agentmods.dev/skills/ariaxhan/kernel-claude/debug"><img src="https://agentmods.dev/badge/skills/ariaxhan/kernel-claude/debug.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,746 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00064 $0.01746
Opus 5.5 $0.00026 $0.00698
Sonnet 5.5 $0.00013 $0.00349
Haiku 4.5 $0.00006 $0.00175

Measured 1mo ago against content hash dc32fc23fad8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

debug scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/debug/SKILL.md · 135 lines

How it starts

The opening of the file, as written. The whole thing — 135 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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.

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.

  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.
    • 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)

<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>

Read the full file on GitHub · 135 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +3 lines dc32fc23fad8
  2. 1mo ago Changed · +5 lines 37ec335142db
  3. 1mo ago Changed · +39 lines · +12 tokens per session 1c2f989607e0
  4. 1mo ago First seen · 88 lines · 52 tokens per session scan A 18939e83b03c

Subscribe to this mod's changes

debug is a skill published in the GitHub repository ariaxhan/kernel-claude (14 stars, last pushed 2d ago), licensed MIT. It adds 64 tokens to every session and 1,746 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.