bug-fix

bug-fix is a skill for Claude Code from rushengzhou/sid-code. It costs 62 tokens per session (2,128 once invoked), scanned A, original, MIT.

A structured bug-fixing workflow that takes a problem from reproduction and evidence-based cause finding through approval, implementation, testing, and cleanup.

In plain words
What is it for?
Use it to investigate reported bugs, identify the responsible files and code paths, implement an approved fix, and verify the result.
Why use it?
It reduces guesswork by requiring proof of the cause before changes and proof from tests or a build after the fix.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it to investigate reported bugs, identify the responsible files and code paths, implement an approved fix, and verify the result.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rushengzhou/sid-code/bug-fix
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 rushengzhou/sid-code --skill bug-fix
Clone the repo
git clone --depth 1 https://github.com/rushengzhou/sid-code

Made for: Claude Code.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/rushengzhou/sid-code/bug-fix/github.svg)](https://agentmods.dev/skills/rushengzhou/sid-code/bug-fix)
Your own site
<a href="https://agentmods.dev/skills/rushengzhou/sid-code/bug-fix"><img src="https://agentmods.dev/badge/skills/rushengzhou/sid-code/bug-fix/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 bug-fix

Your own site · 80×15
<a href="https://agentmods.dev/skills/rushengzhou/sid-code/bug-fix"><img src="https://agentmods.dev/badge/skills/rushengzhou/sid-code/bug-fix.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 62 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,128 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.00062 $0.02128
Opus 5.5 $0.00025 $0.00851
Sonnet 5.5 $0.00012 $0.00426
Haiku 4.5 $0.00006 $0.00213

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

Security

Grade A, and why

bug-fix 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.

packages/core/src/skill/builtin/bug-fix/SKILL.md · 132 lines

How it starts

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

Bug Fix Skill — 半自动修复标准作业流程(SOP)

你是 sid-code 内置的 bug-fix Skill,负责把一个 bug 从「报错」走到「已验证修复」的完整闭环。 你的核心原则是 要证据、不拍脑袋:每个根因结论都要有 file:line 实证,每个"已修复"都要有测试/构建通过的实证。

这是「为 AI 代码兜底」叙事里的修复环节——code-review 只读不改、负责发现问题;bug-fix 负责落地修复。 两者职责互补,本 Skill 会写代码(allowed-tools 含 write/edit),因此必须经过 plan mode + 人工审批才动手。


0. 执行总纲(六步,顺序不可跳)

Step 1 复现与范围确认  →  Step 2 定位根因(要证据)  →  Step 3 plan 出方案
   →  [人工审批]  →  Step 4 实现  →  Step 5 测试验证  →  Step 6 清理与汇报

开始前先用 todo_write 把这六步登记成 todo,逐步推进、逐步勾掉,避免长任务中途遗漏环节。


Step 1:复现与范围确认

  1. 读取用户给的报错信息 / 失败用例 / 异常堆栈,提炼出确切的失败现象(什么输入 → 期望什么 → 实际什么)。
  2. 用 grep / glob 圈定涉及的文件与符号(报错里的函数名、文件名、错误文案是最好的检索锚点)。
  3. 如果项目可运行:先跑一次复现(bash 跑相关测试 / 启动命令),亲眼确认失败,而不是假设它失败。
    • 跑不起来 / 缺环境 → 如实说明,基于静态阅读继续,但在汇报里标注"未实测复现"。

产出:一句话描述确切失败现象 + 一份"嫌疑文件清单"。


Step 2:定位根因(要证据,不拍脑袋)

  1. 用 read 读嫌疑文件的完整相关段落(不只看片段——很多根因要靠上下文才能看清)。
  2. 沿调用链追:谁调用了它、它依赖什么、数据从哪来到哪去,一直追到真正的根因,而非表层症状。
  3. 每一个根因结论都必须引用 file:line 实证:
    • ✅ "根因在 src/query/empty-param.ts:43-48,isEmptyToolInput({}) 对任何空对象返回 true,不看工具是否本就无参数。"
    • ❌ "可能是参数校验有问题"(无位置、无证据 → 禁止)。
  4. 区分根因与症状:报错出现的地方往往不是根因所在。改症状不改根因 = 没修。

⚠️ 红线 RL-FIX-1:未拿到 file:line 证据前,不得进入 Step 3 出方案。


Step 3:进入 plan mode 出修复方案

  1. 调用 enter_plan_mode 进入计划模式。
  2. 在计划文件里写清三件事:
    • 根因:用 Step 2 的 file:line 证据链说明问题出在哪、为什么会触发。
    • 修复点:要改哪些文件、改成什么样、为什么这样改能根治(而非打补丁掩盖症状)。
    • 验证方式:改完怎么证明修好了(跑哪些测试、补哪些用例、构建是否通过)。
  3. 评估影响面与可逆性:是否触及共享状态 / 删除数据 / 改动认证或基础设施——高风险点在 plan 里显式标注。
  4. 调用 exit_plan_mode 提交人工审批。审批通过前不写任何代码。

这一步是 bug-fix 做成 activate 模式的原因:只有在主对话里才能进 plan mode 并等用户审批 (子代理被禁止进入 plan mode)。


Step 4:实现

审批通过后再动手:

  1. 按方案用 write / edit 落地修复。遵守全局文件编辑规范:
    • 改动 > 30 行或同文件改 3 处以上 → 用 write 整块覆盖,不要连续 edit。
    • edit 的 old_string 要带上下文保证唯一;连续失败 2 次立即重新 read 再改。
    • 禁止三连点省略占位符:代码里 NEVER 用 // ... rest of 代替已存在代码。
  2. 只解决被问的那个 bug:不顺手重构无关代码、不加方案外的功能。
  3. 如需排查复杂分支,可临时加调试日志;修复确认后必须在 Step 6 清理掉。

红线 RL-FIX-2:不修改测试断言来"让测试变绿"。测试暴露的是问题,不是要被改的对象。

Read the full file on GitHub · 132 lines

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 First seen · 132 lines · 62 tokens per session scan A c3766a2b2a29

Subscribe to this mod's changes

bug-fix is a skill published in the GitHub repository rushengzhou/sid-code (2 stars, last pushed 1mo ago), licensed MIT. It adds 62 tokens to every session and 2,128 once invoked, about $0.0002 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-31.