C31-debug

A structured bug-investigation workflow that guides an agent from reproducing a problem to verifying a fix. It keeps active debugging sessions in files so work can resume later.

In plain words
What is it for?
Use it to reproduce bugs, trace errors, test possible causes, apply test-first fixes, verify results, and archive resolved investigations.
Why use it?
It provides a written trail of evidence and decisions instead of relying on guesses or losing context between sessions.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/chianw/c31/c31-debug
Any agent
npx skills add ChianW/C31 --skill c31-debug
Clone the repo
git clone --depth 1 https://github.com/ChianW/C31

Made for: Claude Code, Codex.

Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,949 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00032 $0.02949
Opus 5 $0.00016 $0.01474
Sonnet 5 $0.00006 $0.00590
Haiku 4.5 $0.00003 $0.00295

Measured 2d ago against content hash 1f231a5cfc50, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

C31-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 2d 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/core/C31-debug/SKILL.md · 259 lines

How it starts

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

Multilingual Triggers

Language Trigger phrases
EN debug, bug, fix, 排查, 为什么会报错, 报错, trace this error, find the root cause, debugger
ZH 调试, 修复bug, 排查
JA デバッグ, バグ修正, 調査

Output language: Respond automatically in the user's conversation language.

C31-debug — Systematic Debug with Session Management

Investigate bugs through reproduction → trace → hypothesis → test-first fix → verify → archive. All active sessions are tracked in memory/.planning/debug/ for resumption and knowledge compounding.

Session Lifecycle

Check Existing Sessions (always first)

List memory/.planning/debug/*.md. If any non-resolved session exists, present it and ask:

  1. Resume — load the session and continue from the last phase
  2. New session — archive the old one (move to resolved/) and start fresh
  3. Ignore — proceed without archiving

If no active sessions exist, create a new one at memory/.planning/debug/YYMMDD-{brief-desc}.md with frontmatter:

---
session_id: YYMMDD-{brief-desc}
status: active   # active | investigating | fixing | verifying | resolved | stalled
phase: 0         # 0=triage, 1=investigate, 2=root-cause, 3=fix, 4=verify, 5=archive
created: YYYY-MM-DD HH:MM
target: [file/module/test or issue link]
---

Session Resume

If resuming, read the session file, update status: active, and continue from the recorded phase. Preserve all prior hypotheses, ruled-out causes, and evidence in the session file.

Execution Flow

Phase Name Output
0 Triage Problem statement + session file created/resumed
1 Investigate Reproduction confirmed, environment sanity checked, code path traced
2 Root Cause Causal chain confirmed with predictions; session updated
3 Fix Test-first patch applied
4 Verify Tests pass, no regressions; session marked resolved
5 Archive Session moved to resolved/, knowledge-base updated

Read the full file on GitHub · 259 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. 2d ago First seen · 259 lines · 32 tokens per session scan A 1f231a5cfc50

Subscribe to this mod's changes

C31-debug is a skill published in the GitHub repository ChianW/C31 (1 stars, last pushed 7d ago), licensed MIT. It adds 32 tokens to every session and 2,949 once invoked, about $0.0002 per session on Opus 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-31.

Related

Other skills, from other repositories

compare-harnesses

Diff two scaffolded harnesses (ADR-031). Reports manifest meta drift + host list + per-file fingerprint changes (added/removed/changed). Exits 0 IDENTICAL, 1 DRIFT, 2 missing manifest. Use --bundle for the ADR-031 schema-1 JSON envelope.

ruvnet/metaharness · 66 tokens

create-harness

Scaffold your own focused AI agent harness — pick host (Claude Code, Codex, pi.dev, Hermes), template, agents, skills, and ship a npm-publishable harness with its own npx CLI. Use when a user asks to "create my own agent harness", "scaffold a harness", "make a custom Claude Code plugin like ruflo", or "build a…

ruvnet/metaharness · 89 tokens

diag-harness

Kernel-version skew check (ADR-027). Reports manifest surface + manifest kernel + installed kernel + verdict (match/patch-diff/minor-diff/major-diff). Exits 1 on minor/major skew with a copy-pasteable npm install @metaharness/[email protected] next step. Exits 2 if no .harness/manifest.json at path.

ruvnet/metaharness · 85 tokens

example-harness

Scaffold a ready-made AI agent harness in one command from the 19 published @metaharness/ example packages — 9 host integrations (Claude Code, Codex, Hermes, pi.dev, OpenClaw, RVM, Copilot, OpenCode, GitHub Actions) + 10 vertical pods (devops, research, trading, support, legal, coding, education, sales, gaming…

ruvnet/metaharness · 90 tokens

oia-manifest

Emit .harness/oia-manifest.json declaring layer alignment with the OIA v0.1 9-layer reference architecture. Self-describes the harness's MCP wiring, witness signing, audit log, identity posture (always 'none' at v0.1). --check verifies an existing manifest, --dry-run prints without writing, --json emits to stdout.

ruvnet/metaharness · 79 tokens

repo-genome

7-section readiness scorecard for a LOCAL repo. Reports repo type + agent topology + MCP risk + test confidence + release readiness + recommended harness plan + scorecard. Exit 0 ready, 1 needs-work, 2 blocked. --json for the 6-field scorecard, --bundle for the ADR-031 schema-1 envelope.

ruvnet/metaharness · 73 tokens