关于 systematic-debugging
systematic-debugging 是面向开发者和 AI Agent 的结构化调试技能,要求先调查再修改。四个阶段依次处理复现、隔离、根因分析、修复与验证。
主要功能
- 01四阶段调试流程
- 02记录复现步骤与发生率
- 03问题隔离和根因分析
- 04修复后的回归验证
- 05调试命令示例
适用场景
- 01稳定复现并记录故障
- 02缩小问题来源并追查根因
- 03修复后确认问题消失且无回归
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ vudovn/ ag-kit --skill systematic-debugging安装后在 Claude Code 中输入/systematic-debugging确认已加载。
详细介绍
系统化调试
来源:obra/superpowers
概述
此技能提供了一套结构化的调试方法,避免随机猜测,并确保在解决问题之前充分理解问题。
4 阶段调试流程
阶段 1:复现
修复之前,先可靠地复现问题。
## Reproduction Steps
1. [Exact step to reproduce]
2. [Next step]
3. [Expected vs actual result]
## Reproduction Rate
- [ ] Always (100%)
- [ ] Often (50-90%)
- [ ] Sometimes (10-50%)
- [ ] Rare (<10%)
阶段 2:隔离
缩小问题来源的范围。
## Isolation Questions
- When did this start happening?
- What changed recently?
- Does it happen in all environments?
- Can we reproduce with minimal code?
- What's the smallest change that triggers it?
阶段 3:理解
找出根本原因,而不只是表面症状。
## Root Cause Analysis
### The 5 Whys
1. Why: [First observation]
2. Why: [Deeper reason]
3. Why: [Still deeper]
4. Why: [Getting closer]
5. Why: [Root cause]
阶段 4:修复并验证
修复问题,并验证它确实已解决。
## Fix Verification
- [ ] Bug no longer reproduces
- [ ] Related functionality still works
- [ ] No new issues introduced
- [ ] Test added to prevent regression
调试清单
## Before Starting
- [ ] Can reproduce consistently
- [ ] Have minimal reproduction case
- [ ] Understand expected behavior
## During Investigation
- [ ] Check recent changes (git log)
- [ ] Check logs for errors
- [ ] Add logging if needed
- [ ] Use debugger/breakpoints
## After Fix
- [ ] Root cause documented
- [ ] Fix verified
- [ ] Regression test added
- [ ] Similar code checked
常用调试命令
# Recent changes
git log --oneline -20
git diff HEAD~5
# Search for pattern
grep -r "errorPattern" --include="*.ts"
# Check logs
pm2 logs app-name --err --lines 100
反模式
❌ 随意更改 - “也许改一下这个就行……” ❌ 忽视证据 - “不可能是这个原因” ❌ 想当然 - 没有证据就认定“肯定是 X” ❌ 不先复现 - 盲目修复 ❌ 只处理表面症状 - 没有找出根本原因
评论
支持 Markdown