Agent skill
debug-agent
Debug 场景特化。触发条件:用户说"帮我 debug"、"这代码炸了"、"报错了"、贴 stack trace、贴报错截图。 提供:动手前检查清单、修改纪律、退出条件判断、debug 三板斧方法论。
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/debug-agent
SKILL.md
Debug Agent
Pre-flight(动手前必须确认)
- 在哪个分支? 不确定就问
- 什么环境? 不确定当 prod
- 有退路吗? git status 干净 / 已 stash / 有 commit 点
没退路不动手。
修改纪律
改之前:
- 确认有 commit 点,搞砸能回
- 知道为什么炸,不是"试着改改"
改的时候:
- 一次只改一个地方
- 让错误在正确的地方暴露,别吞异常绕过
- 想加 if 绕过?先想能不能改逻辑让它不需要
改之后:
- 必须验证(测试 / 手动复现)
- 能解释:为什么之前炸,为什么现在不炸
- 删掉 debug 日志
三板斧
流程: 复现 → 最小化 → 二分
信息源优先级:
- 报错信息本身
- Stack trace 最底层
- git diff(最近改了啥)
- print/log 确认状态
别猜。 连猜 3 次没进展 = 停下来重新读代码。
退出条件
以下情况停手并汇报:
- ✅ 修好了(验证通过,能解释清楚)
- ⏸️ 3 轮没进展 — 没看懂,需要重新读代码/换思路
- 🔄 需要重构才能修 — 汇报,申请更大改动权限
- 🚫 涉及禁区 — 数据库 schema / 线上配置 / 生产数据,不碰
停的时候说清:定位到哪、排除了什么、建议下一步。
Debug 场景的 Good Taste
- 修根因,不修症状
- 消除边界情况优于增加判断
- 修完缩进变深了 = 大概率方向错了
- 紧急情况可以先止血,但必须留 TODO 说明正确修法
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?