debug

debug is a skill for Claude Code from xiaobei930/cc-best. It costs 26 tokens per session (1,435 once invoked), scanned A, original, MIT.

A structured method for reproducing, narrowing down, diagnosing, fixing, and recording software problems using errors and logs.

In plain words
What is it for?
Use it to debug code, analyze error logs, investigate slow behavior, troubleshoot incidents, or verify a bug fix.
Why use it?
It replaces guesswork with a repeatable investigation process for bugs, performance issues, and production incidents.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the cc-best plugin — 19 skills, 44 commands, 8 agents, 20 hooks shipped together

Good fit Use it to debug code, analyze error logs, investigate slow behavior, troubleshoot…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/xiaobei930/cc-best/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 xiaobei930/cc-best --skill debug
Clone the repo
git clone --depth 1 https://github.com/xiaobei930/cc-best

Made for: Claude Code.

Or install cc-best, the plugin that ships this one along with the rest of its 19 skills, 44 commands, 8 agents, 20 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/xiaobei930/cc-best/debug.svg)](https://agentmods.dev/skills/xiaobei930/cc-best/debug)
Your own site
<a href="https://agentmods.dev/skills/xiaobei930/cc-best/debug"><img src="https://agentmods.dev/badge/skills/xiaobei930/cc-best/debug.svg" alt="Measured on agentmods" height="20"></a>
Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,435 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.00026 $0.01435
Opus 5 $0.00013 $0.00718
Sonnet 5 $0.00005 $0.00287
Haiku 4.5 $0.00003 $0.00144

Measured 3d ago against content hash c738d3042ca6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 3d 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 · 175 lines

How it starts

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

调试技能

本技能提供系统化的调试方法和技巧。

触发条件

  • 调试代码问题
  • 分析错误日志
  • 调查性能问题
  • 排查生产事故
  • 修复 Bug

调试原则

黄金法则

  1. 复现问题 - 先能稳定复现,再开始调试
  2. 最小化 - 找到最小可复现用例
  3. 二分法 - 缩小问题范围
  4. 假设验证 - 提出假设,验证假设
  5. 记录过程 - 记录尝试过的方法

调试流程

问题描述 → 复现问题 → 缩小范围 → 定位原因 → 修复验证 → 记录总结

问题描述模板

记录时包含以下要素:

要素 内容
问题描述 简要描述问题现象
预期 vs 实际 期望行为与实际行为的差异
复现步骤 可稳定复现的最小步骤
环境信息 OS、语言版本、依赖版本
错误信息 完整的错误堆栈或日志
已尝试方案 每个方案及其结果

日志调试

有效的日志输出

// ❌ 无用的日志
console.log("here");
console.log(data);

// ✅ 有信息量的日志
console.log("[UserService.createUser] 开始创建用户:", {
  email: user.email,
  timestamp: new Date().toISOString(),
});

console.log("[UserService.createUser] 数据库插入成功:", {
  userId: result.id,
  duration: Date.now() - startTime,
});

console.error("[UserService.createUser] 创建失败:", {
  error: error.message,
  stack: error.stack,
  input: { email: user.email },
});
# ❌ 无用的日志
print("here")
print(data)

# ✅ 有信息量的日志
import logging
logger = logging.getLogger(__name__)

logger.info(f"[create_user] 开始创建用户: email={email}")
logger.info(f"[create_user] 创建成功: user_id={user.id}, duration={duration}ms")
logger.error(f"[create_user] 创建失败: error={str(e)}", exc_info=True)

日志级别使用

级别 用途 示例
DEBUG 详细调试信息 函数参数、中间状态
INFO 正常操作信息 用户登录、订单创建
WARN 警告但可继续 配置缺失使用默认值
ERROR 错误但可恢复 API 调用失败重试
FATAL 致命错误需退出 数据库连接失败

断点调试

VS Code 调试配置 (.vscode/launch.json)

场景 type 关键配置
Node.js node program, preLaunchTask, outFiles
Python python program: "${file}", integratedTerminal
Jest 测试 node program: jest, args: ["--runInBand"]

Read the full file on GitHub · 175 lines

Files

What ships with it

3 files 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. 3d ago First seen · 175 lines · 26 tokens per session scan A c738d3042ca6

Subscribe to this mod's changes

debug is a skill published in the GitHub repository xiaobei930/cc-best (50 stars, last pushed 2mo ago), licensed MIT. It adds 26 tokens to every session and 1,435 once invoked, about $0.0001 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-09-03.