npx skills add https://github.com/charon-fan/agent-playbook --skill debugger一个高级调试专家,帮助系统性地诊断和解决代码问题。
当您出现以下情况时激活:
复现问题
收集上下文
# 检查最近的更改
git log --oneline -10
# 检查错误日志
tail -f logs/error.log
# 检查环境
env | grep -i debug
定位错误来源
缩小范围
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 类别 | 症状 | 调查步骤 |
|---|---|---|
| 空值/未定义 | “无法读取 undefined 的属性 X” | 追踪变量来源 |
| 类型错误 | “X 不是一个函数” | 检查实际类型与预期类型 |
| 异步问题 | 竞态条件,时序问题 | 检查 Promise 处理,async/await |
| 状态问题 | 陈旧数据,错误状态 | 追踪状态变更 |
| 网络问题 | 超时,连接被拒绝 | 检查端点,CORS,认证 |
| 环境问题 | 本地工作,生产环境不工作 | 比较环境变量,版本 |
| 内存问题 | 泄漏,内存不足 | 分析内存使用情况 |
| 并发问题 | 死锁,竞态条件 | 检查锁,共享状态 |
针对每个潜在原因:
# 查找最近修改的文件
find . -type f -mtime -1 -name "*.js" -o -name "*.ts" -o -name "*.py"
# 搜索错误模式
grep -r "ERROR\|FATAL\|Exception" logs/
# 搜索可疑模式
grep -r "TODO\|FIXME\|XXX" src/
# 检查代码中遗留的 console.log
grep -r "console\.log\|debugger" src/
JavaScript/TypeScript:
# 使用调试输出运行
NODE_DEBUG=* node app.js
# 检查语法
node -c file.js
# 在调试模式下运行测试
npm test -- --inspect-brk
Python:
# 使用 pdb 运行
python -m pdb script.py
# 检查语法
python -m py_compile script.py
# 详细模式
python -v script.py
Go:
# 竞态检测
go run -race main.go
# 调试构建
go build -gcflags="-N -l"
# 性能分析
go test -cpuprofile=cpu.prof
# 当您不知道错误在哪里时:
def process():
step1()
step2()
step3()
step4()
# 注释掉一半:
def process():
step1()
# step2()
# step3()
# step4()
# 如果错误消失,则取消注释掉注释部分的一半:
def process():
step1()
step2()
# step3()
# step4()
# 继续直到隔离出错误
// 之前(神秘的失败):
async function getUser(id: string) {
const user = await db.find(id);
return transform(user);
}
// 之后(带日志记录):
async function getUser(id: string) {
console.log('[DEBUG] getUser called with id:', id);
const user = await db.find(id);
console.log('[DEBUG] db.find returned:', user);
const result = transform(user);
console.log('[DEBUG] transform returned:', result);
return result;
}
// 包含错误的复杂代码:
function processBatch(items, options) {
// 100 行复杂逻辑
}
// 创建最小化复现:
function processBatch(items, options) {
console.log('Items:', items.length);
console.log('Options:', options);
// 使用最小数据测试
return processBatch([items[0]], options);
}
| 错误信息 | 可能原因 | 解决方案 |
|---|---|---|
Cannot read property 'X' of undefined | 在 null/undefined 上访问属性 | 添加空值检查,使用可选链 |
X is not a function | 类型错误,变量遮蔽 | 检查 typeof,验证导入 |
Unexpected token | 语法错误 | 检查错误前的行,验证语法 |
Module not found | 导入路径错误 | 检查相对路径,验证文件是否存在 |
EADDRINUSE | 端口已被占用 | 终止现有进程,使用不同端口 |
Connection refused | 服务未运行 | 启动服务,检查端口 |
Timeout | 请求太慢 | 增加超时时间,检查网络 |
生成调试报告:
python scripts/debug_report.py <error-message>
references/checklist.md - 调试检查清单references/patterns.md - 常见调试模式references/errors.md - 错误信息参考每周安装次数
42
代码仓库
GitHub 星标数
10
首次出现
2026年1月22日
安全审计
安装于
gemini-cli35
codex34
cursor34
opencode34
github-copilot30
amp30
An advanced debugging specialist that helps diagnose and resolve code issues systematically.
Activates when you:
Reproduce the issue
Gather context
# Check recent changes
git log --oneline -10
# Check error logs
tail -f logs/error.log
# Check environment
env | grep -i debug
Locate the error source
Narrow down scope
| Category | Symptoms | Investigation Steps |
|---|---|---|
| Null/Undefined | "Cannot read X of undefined" | Trace the variable origin |
| Type Errors | "X is not a function" | Check actual vs expected type |
| Async Issues | Race conditions, timing | Check promise handling, async/await |
| State Issues | Stale data, wrong state | Trace state mutations |
| Network | Timeouts, connection refused | Check endpoints, CORS, auth |
| Environment | Works locally, not in prod | Compare env vars, versions |
| Memory | Leaks, OOM | Profile memory usage |
For each potential cause:
# Find recently modified files
find . -type f -mtime -1 -name "*.js" -o -name "*.ts" -o -name "*.py"
# Grep for error patterns
grep -r "ERROR\|FATAL\|Exception" logs/
# Search for suspicious patterns
grep -r "TODO\|FIXME\|XXX" src/
# Check for console.log left in code
grep -r "console\.log\|debugger" src/
JavaScript/TypeScript:
# Run with debug output
NODE_DEBUG=* node app.js
# Check syntax
node -c file.js
# Run tests in debug mode
npm test -- --inspect-brk
Python:
# Run with pdb
python -m pdb script.py
# Check syntax
python -m py_compile script.py
# Verbose mode
python -v script.py
Go:
# Race detection
go run -race main.go
# Debug build
go build -gcflags="-N -l"
# Profile
go test -cpuprofile=cpu.prof
# When you don't know where the bug is:
def process():
step1()
step2()
step3()
step4()
# Comment out half:
def process():
step1()
# step2()
# step3()
# step4()
# If bug disappears, uncomment half of commented:
def process():
step1()
step2()
# step3()
# step4()
# Continue until you isolate the bug
// Before (mysterious failure):
async function getUser(id: string) {
const user = await db.find(id);
return transform(user);
}
// After (with logging):
async function getUser(id: string) {
console.log('[DEBUG] getUser called with id:', id);
const user = await db.find(id);
console.log('[DEBUG] db.find returned:', user);
const result = transform(user);
console.log('[DEBUG] transform returned:', result);
return result;
}
// Complex code with bug:
function processBatch(items, options) {
// 100 lines of complex logic
}
// Create minimal reproduction:
function processBatch(items, options) {
console.log('Items:', items.length);
console.log('Options:', options);
// Test with minimal data
return processBatch([items[0]], options);
}
| Error | Likely Cause | Solution |
|---|---|---|
Cannot read property 'X' of undefined | Accessing property on null/undefined | Add null check, use optional chaining |
X is not a function | Wrong type, shadowing | Check typeof, verify import |
Unexpected token | Syntax error | Check line before error, validate syntax |
Module not found | Import path wrong | Check relative path, verify file exists |
EADDRINUSE |
Generate a debug report:
python scripts/debug_report.py <error-message>
references/checklist.md - Debugging checklistreferences/patterns.md - Common debugging patternsreferences/errors.md - Error message referenceWeekly Installs
42
Repository
GitHub Stars
10
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketFailSnykPass
Installed on
gemini-cli35
codex34
cursor34
opencode34
github-copilot30
amp30
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
111,800 周安装
阿里云AI语音TTS测试技能 - 最小可行测试验证与安装指南
266 周安装
阿里云 ECS 最小可行性测试 Skill - 自动化云服务 API 连通性验证工具
266 周安装
阿里云PAI AIWorkspace管理技能:使用OpenAPI和SDK管理AI平台资源
264 周安装
阿里云AI技能测试指南:alicloud-ai-misc-crawl-and-skill-test 最小化验证与错误排查
266 周安装
阿里云AI图像编辑测试技能 - 通义千问图像编辑最小可行测试验证
266 周安装
阿里云AI云呼叫中心管理技能:使用OpenAPI和SDK自动化管理CCC资源
264 周安装
| Deadlocks, race conditions |
| Check locks, shared state |
| Port already in use |
| Kill existing process, use different port |
Connection refused | Service not running | Start service, check port |
Timeout | Request too slow | Increase timeout, check network |