关于 debug
面向开发者的结构化调试技能,帮助复现问题、明确影响范围并调查可能原因。可借助已连接的监控、源代码管理和项目跟踪工具收集线索并创建后续工单。
主要功能
- 01复现步骤与范围分析
- 02预期行为和实际行为对比
- 03利用已连接日志与指标调查
- 04检查近期代码变更
- 05搜索相关问题并创建工单
适用场景
- 01将错误报告整理为可复现步骤
- 02检查近期部署是否与故障相关
- 03记录根因并创建后续工单
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ anthropics/ knowledge-work-plugins --skill debug安装后在 Claude Code 中输入/debug确认已加载。
详细介绍
/debug
如果你看到不熟悉的占位符,或需要检查已连接的工具,请参阅 CONNECTORS.md。
运行一次结构化的调试会话,系统性地找出并修复问题。
用法
/debug $ARGUMENTS
工作原理
┌─────────────────────────────────────────────────────────────────┐
│ DEBUG │
├─────────────────────────────────────────────────────────────────┤
│ Step 1: REPRODUCE │
│ ✓ Understand the expected vs. actual behavior │
│ ✓ Identify exact reproduction steps │
│ ✓ Determine scope (when did it start? who is affected?) │
│ │
│ Step 2: ISOLATE │
│ ✓ Narrow down the component, service, or code path │
│ ✓ Check recent changes (deploys, config changes, dependencies) │
│ ✓ Review logs and error messages │
│ │
│ Step 3: DIAGNOSE │
│ ✓ Form hypotheses and test them │
│ ✓ Trace the code path │
│ ✓ Identify root cause (not just symptoms) │
│ │
│ Step 4: FIX │
│ ✓ Propose a fix with explanation │
│ ✓ Consider side effects and edge cases │
│ ✓ Suggest tests to prevent regression │
└─────────────────────────────────────────────────────────────────┘
我需要你提供什么
请告诉我遇到的问题。以下任一信息都有帮助:
- 错误消息或堆栈跟踪
- 复现步骤
- 最近发生了哪些变更
- 日志或截图
- 预期行为与实际行为
输出
## Debug Report: [Issue Summary]
### Reproduction
- **Expected**: [What should happen]
- **Actual**: [What happens instead]
- **Steps**: [How to reproduce]
### Root Cause
[Explanation of why the bug occurs]
### Fix
[Code changes or configuration fixes needed]
### Prevention
- [Test to add]
- [Guard to put in place]
如果有可用的连接器
如果已连接 ~~monitoring:
- 拉取问题发生时间段前后的日志、错误率和指标
- 显示可能与问题相关的近期部署和配置变更
如果已连接 ~~source control:
- 找出涉及受影响代码路径的近期提交和 PR
- 检查问题是否与某个特定变更相关
如果已连接 ~~project tracker:
- 搜索相关的缺陷报告或已知问题
- 确定修复方案后创建修复工单
提示
- 准确分享错误消息 — 不要转述。原文文本至关重要。
- 说明发生了什么变更 — 近期部署、依赖更新和配置变更是最主要的怀疑对象。
- 提供上下文 — “在 staging 环境正常但在 prod 环境失败”或“仅影响大型负载”能快速缩小排查范围。
评论
支持 Markdown