debug
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDebug Workflow Skill
Debug Workflow Skill
Overview
概述
Investigation-first workflow for debugging and regression fixes. Provides two tracks based on urgency: hotfix (fast, minimal ceremony) and thorough (rigorous, full RCA documentation).
以调查为核心的调试与回归修复工作流。根据紧急程度提供两种路径:热修复(快速、流程简化)和全面修复(严谨、包含完整RCA文档)。
Triggers
触发条件
Activate this skill when:
- User runs command
/debug - User reports a bug or regression
- User needs to investigate an error
- User says "fix this bug" or similar
Disambiguation: If the user says "fix" or "clean up" — use when something is broken (error, crash, wrong behavior). Use when the code works but needs structural improvement.
/debug/refactor在以下场景激活此Skill:
- 用户执行/debug命令
- 用户报告Bug或回归问题
- 用户需要调查错误
- 用户说出"fix this bug"或类似表述
歧义消除: 如果用户提到"fix"或"clean up"——当功能出现故障(错误、崩溃、行为异常)时使用/debug;当代码可正常运行但需要结构优化时使用/refactor。
Workflow Overview
工作流概述
/debug
│
┌────┴────┐
│ Triage │
└────┬────┘
│
┌─────────────────┼─────────────────┐
│ │ │
--hotfix (default) --escalate
│ │ │
▼ ▼ ▼
┌────────────────┐ ┌─────────────┐ ┌──────────┐
│ Hotfix Track │ │ Thorough │ │ /ideate │
│ │ │ Track │ │ handoff │
└────────────────┘ └─────────────┘ └──────────┘ /debug
│
┌────┴────┐
│ 分类排查 │
└────┬────┘
│
┌─────────────────┼─────────────────┐
│ │ │
--hotfix (默认) --escalate
│ │ │
▼ ▼ ▼
┌────────────────┐ ┌─────────────┐ ┌──────────┐
│ 热修复路径 │ │ 全面修复 │ │ /ideate │
│ │ │ 路径 │ │ 移交 │
└────────────────┘ └─────────────┘ └──────────┘Command Interface
命令接口
Start Debug Workflow
启动调试工作流
bash
undefinedbash
undefinedDefault: thorough track
默认:全面修复路径
/debug "Description of the bug"
/debug "Bug描述"
Fast path: hotfix track
快速路径:热修复路径
/debug --hotfix "Production is down - users can't login"
/debug --hotfix "生产环境宕机 - 用户无法登录"
Escalate to feature workflow
升级至功能开发工作流
/debug --escalate "This needs architectural changes"
undefined/debug --escalate "此修复需要架构变更"
undefinedMid-Workflow Commands
工作流中途命令
bash
undefinedbash
undefinedSwitch from hotfix to thorough (during investigation)
从热修复路径切换至全面修复路径(调查过程中)
/debug --switch-thorough
/debug --switch-thorough
Escalate to /ideate (manual handoff)
升级至/ideate流程(手动移交)
/debug --escalate "Reason for escalation"
/debug --escalate "升级原因"
Resume after context compaction
上下文压缩后恢复工作流
/rehydrate
undefined/rehydrate
undefinedTrack Comparison
路径对比
| Aspect | Hotfix | Thorough |
|---|---|---|
| Urgency | P0 (production down) | P1/P2 (normal priority) |
| Investigation | 15 min time-boxed | No time limit |
| RCA Document | No (minimal in state) | Yes (full docs/rca/) |
| Worktree | No (in-place fix) | Yes (isolated) |
| Review | Smoke test only | Spec review |
| Human Checkpoints | 1 (merge) | 1 (merge) |
| 方面 | 热修复 | 全面修复 |
|---|---|---|
| 紧急程度 | P0(生产环境宕机) | P1/P2(常规优先级) |
| 调查时长 | 限时15分钟 | 无时间限制 |
| RCA文档 | 无(仅在状态中记录极简信息) | 有(完整文档存储于docs/rca/) |
| 工作树 | 无(原地修复) | 有(隔离环境) |
| 审核 | 仅冒烟测试 | 规范审核 |
| 人工检查点 | 1个(合并阶段) | 1个(合并阶段) |
Decision Runbooks
决策手册
For track-selection criteria at the triage phase, query the decision runbook:
exarchos_orchestrate({ action: "runbook", id: "triage-decision" })For investigation escalation criteria, query:
exarchos_orchestrate({ action: "runbook", id: "investigation-decision" })These runbooks encode the structured decision trees for track selection. The agent reads the decision tree and follows the guidance — the platform does not execute branches.
如需了解分类排查阶段的路径选择标准,请查询决策手册:
exarchos_orchestrate({ action: "runbook", id: "triage-decision" })如需了解调查升级标准,请查询:
exarchos_orchestrate({ action: "runbook", id: "investigation-decision" })这些手册编码了路径选择的结构化决策树。Agent会读取决策树并遵循指引——平台不会执行分支逻辑。
Hotfix Track
热修复路径
Fix production issues ASAP. Speed over ceremony.
HSM phases: → (15 min max) → (no worktree) → →
triageinvestigatehotfix-implementhotfix-validatecompletedSee for triage guidance.
references/triage-questions.md尽快修复生产环境问题。优先速度,简化流程。
HSM阶段: → (最长15分钟)→ (无工作树)→ →
triageinvestigatehotfix-implementhotfix-validatecompleted分类排查指引请参考。
references/triage-questions.mdInvestigation Timer
调查计时器
- On hotfix track selection: record in state
investigation.startedAt - After each major finding: check elapsed time
- At 15 min mark: emit event, pause for user confirmation
investigation.timeout- Switch to thorough track? (yes/no)
For detailed phase instructions, see .
references/hotfix-track.md- 选择热修复路径后:在状态中记录
investigation.startedAt - 每次有重要发现后:检查已耗时
- 到达15分钟时限时:触发事件,暂停并等待用户确认
investigation.timeout- 是否切换至全面修复路径?(是/否)
详细阶段说明请参考。
references/hotfix-track.mdThorough Track
全面修复路径
Fix bugs with proper rigor. Full RCA documentation.
HSM phases: → → → → (worktree + TDD) → → → →
triageinvestigatercadesigndebug-implementdebug-validatedebug-reviewsynthesizecompletedFor detailed phase instructions, see . For systematic investigation methodology, see .
references/thorough-track.mdreferences/investigation-checklist.md以严谨的方式修复Bug,包含完整的RCA文档。
HSM阶段: → → → → (工作树+TDD)→ → → →
triageinvestigatercadesigndebug-implementdebug-validatedebug-reviewsynthesizecompleted详细阶段说明请参考。系统调查方法请参考。
references/thorough-track.mdreferences/investigation-checklist.mdCharacterization Testing (Thorough Track Only)
特征测试(仅全面修复路径)
Before fixing a bug in the thorough track, capture the buggy behavior as a characterization test:
- Before fix: Write a test that documents the current (buggy) behavior — it should PASS with the bug present
- Write the fix test: Write a test that describes the correct behavior — it should FAIL (this is the standard TDD RED phase)
- Apply the fix: Implement the fix. The fix test should now PASS, and the characterization test should now FAIL
- Verify: The characterization test failing confirms the bug is actually fixed. If it still passes, the fix didn't address the root cause.
This is not required for the hotfix track — hotfixes prioritize speed over documentation.
在全面修复路径中修复Bug前,需将错误行为捕获为特征测试:
- 修复前: 编写测试记录当前(错误)行为——Bug存在时测试应通过
- 编写修复测试: 编写测试描述正确行为——此时测试应失败(这是标准TDD的RED阶段)
- 应用修复: 实施修复。修复测试应转为通过,特征测试应转为失败
- 验证: 特征测试失败确认Bug已被修复。若仍通过,则修复未解决根本原因
热修复路径无需此步骤——热修复优先速度而非文档记录。
Track Switching
路径切换
- Hotfix -> Thorough: When investigation timer expires (15 min). All findings preserved.
- Thorough -> Escalate: When fix requires architectural changes. Hand off to .
/ideate
For detailed switching logic, see .
references/thorough-track.md- 热修复 → 全面修复: 调查计时器到期(15分钟)时触发。所有调查结果将被保留。
- 全面修复 → 升级: 修复需要架构变更时触发。移交至/ideate流程。
详细切换逻辑请参考。
references/thorough-track.mdAuto-Chain Behavior
自动链式行为
Both tracks have ONE human checkpoint before completion.
Hotfix auto-chain:
triage → investigate → hotfix-implement → [HUMAN: hotfix-validate] → completed
(auto) (auto)Thorough auto-chain:
triage → investigate → rca → design → debug-implement → debug-validate → debug-review → [HUMAN: synthesize] → completed
(auto) (auto) (auto) (auto) (auto) (auto)两种路径在完成前均包含一个人工检查点。
热修复自动链:
triage → investigate → hotfix-implement → [人工环节: hotfix-validate] → completed
(自动) (自动)全面修复自动链:
triage → investigate → rca → design → debug-implement → debug-validate → debug-review → [人工环节: synthesize] → completed
(自动) (自动) (自动) (自动) (自动) (自动)State Management
状态管理
Initialize debug workflow:
action: "init", featureId: "debug-<issue-slug>", workflowType: "debug"See for full schema.
@skills/debug/references/state-schema.md初始化调试工作流:
action: "init", featureId: "debug-<issue-slug>", workflowType: "debug"完整状态 schema 请参考。
@skills/debug/references/state-schema.mdPhase Transitions and Guards
阶段转换与守卫条件
Every phase transition has a guard that must be satisfied. Before transitioning, consult for the exact prerequisite for each guard.
@skills/workflow-state/references/phase-transitions.md每个阶段转换都有必须满足的守卫条件。转换前,请查阅获取每个守卫条件的确切前提。
@skills/workflow-state/references/phase-transitions.mdSchema Discovery
Schema 发现
Use for
parameter schemas and
for phase transitions, guards, and playbook guidance.
exarchos_workflow({ action: "describe", actions: ["set", "init"] })exarchos_workflow({ action: "describe", playbook: "debug" })使用获取参数schema,使用获取阶段转换、守卫条件和工作手册指引。
exarchos_workflow({ action: "describe", actions: ["set", "init"] })exarchos_workflow({ action: "describe", playbook: "debug" })Integration Points
集成点
With /rehydrate
与/rehydrate集成
Debug workflows resume like feature workflows:
bash
/rehydrate调试工作流与功能开发工作流的恢复方式一致:
bash
/rehydrateWith Existing Skills
与现有Skill集成
- Uses spec-review skill for thorough track review phase
- Uses synthesis skill for PR creation
- Uses git-worktrees skill for thorough track implementation
- 全面修复路径的审核阶段使用spec-review skill
- PR创建使用synthesis skill
- 全面修复路径的实施阶段使用git-worktrees skill
With MCP Workflow State Tools
与MCP工作流状态工具集成
Extended to support:
- field
workflowType: "debug" - Debug-specific phases handled by the SessionStart hook (which determines next action on resume)
- Debug context provided by the SessionStart hook on session start
扩展支持:
- 字段
workflowType: "debug" - 会话启动钩子(SessionStart hook)处理调试专属阶段(用于恢复时确定下一步操作)
- 会话启动时由SessionStart钩子提供调试上下文
Completion Criteria
完成标准
Hotfix Complete
热修复完成
- Root cause identified (even if briefly)
- Minimal fix applied
- Affected tests pass
- Follow-up RCA task created
- Changes merged
Completion guard shapes — set these via before transitioning to :
exarchos_workflow setcompleted| Exit path | Guard | Required state |
|---|---|---|
| Direct push (no PR) | | |
| Validation passed | | |
| Via PR | Through | |
- 已确定根本原因(即使仅简要记录)
- 已应用最小化修复
- 受影响的测试已通过
- 已创建后续RCA任务
- 变更已合并
完成守卫条件 —— 转换至前,需通过设置以下条件:
completedexarchos_workflow set| 退出路径 | 守卫条件 | 必填状态 |
|---|---|---|
| 直接推送(无PR) | | |
| 验证通过 | | |
| 通过PR | 经 | 必须存在 |
Thorough Complete
全面修复完成
- Full RCA documented in docs/rca/ (use )
references/rca-template.md - Fix matches RCA findings
- TDD implementation with tests
- Spec review passed
- PR merged
Completion guard shapes — the thorough track exits through → (guard: , requires in state).
synthesizecompletedpr-url-existsprUrl- 完整的RCA文档已存储于docs/rca/(使用模板)
references/rca-template.md - 修复方案匹配RCA发现
- 采用TDD方式实施并包含测试
- 规范审核已通过
- PR已合并
完成守卫条件 —— 全面修复路径通过 → 退出(守卫条件:,状态中必须存在)。
synthesizecompletedpr-url-existsprUrlAnti-Patterns
反模式
| Don't | Do Instead |
|---|---|
| Start coding before understanding bug | Investigate first, always |
| Skip RCA on thorough track | Document for future learning |
| Exceed 15 min on hotfix investigation | Switch to thorough track |
| Add features during bug fix | Scope creep - only fix the bug |
| Skip tests because "it's just a fix" | Fixes need tests to prevent regression |
| 禁止行为 | 正确做法 |
|---|---|
| 未理解Bug就开始编码 | 始终先进行调查 |
| 全面修复路径中跳过RCA | 记录文档以供后续学习 |
| 热修复调查时长超过15分钟 | 切换至全面修复路径 |
| Bug修复过程中添加新功能 | 避免范围蔓延 - 仅修复Bug |
| 以"只是个修复"为由跳过测试 | 修复需要测试以防止回归 |
Troubleshooting
故障排查
See for MCP tool failures, state desync, investigation timeouts, and track switching issues.
references/troubleshooting.mdMCP工具故障、状态不同步、调查超时及路径切换问题的排查请参考。
references/troubleshooting.md