npx skills add https://github.com/bobmatnyc/claude-mpm-skills --skill 'Root Cause Tracing'错误通常深藏在调用栈中显现(在错误目录中执行 git init、文件创建在错误位置、使用错误路径打开数据库)。你的直觉是在错误出现的地方修复,但这只是治标不治本。
核心原则: 沿着调用链向后追溯,直到找到原始触发点,然后在源头修复。
此技能是系统化调试工作流中的一项专门技术,通常在处理深层调用栈时,于第 1 阶段(根因调查)应用。
在以下情况使用根因追溯:
与系统化调试的关系:
NEVER FIX JUST WHERE THE ERROR APPEARS
ALWAYS TRACE BACK TO FIND THE ORIGINAL TRIGGER
修复症状只会产生治标不治本的解决方案,掩盖了根本问题。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
Error appears deep in stack?
→ Yes: Start tracing backward
→ Can identify caller? → Trace one level up → Repeat
→ Cannot identify caller? → Add instrumentation (see advanced-techniques.md)
→ No: May not need tracing (error at entry point)
示例:在错误目录中执行 git init
Error symptom → execFileAsync('git', ['init'], { cwd: '' })
← WorktreeManager.createSessionWorktree(projectDir='')
← Session.create() → Project.create() → Test code
← ROOT CAUSE: setupCoreTest() returns { tempDir: '' } before beforeEach
在每一层询问: 这个值从哪里来?这是起源吗?
在源头修复(如果在初始化前访问则抛出错误)+ 添加纵深防御(在 Project.create、WorkspaceManager、环境守卫、插桩处进行验证)。
这可以防止类似的错误并更早地发现问题。
获取详细信息:
console.error() 进行调试(日志记录器可能被抑制)当产生以下想法时,请停止:
以上所有情况都意味着:继续追溯以找到根本原因。
完整的工作流示例请参阅集成。
来自调试会话(2025-10-03):
关键点: 追溯需要 15-30 分钟。治标修复则需要数小时的“打地鼠”游戏。
每周安装量
0
仓库
GitHub 星标数
18
首次出现
Jan 1, 1970
安全审计
Bugs often manifest deep in the call stack (git init in wrong directory, file created in wrong location, database opened with wrong path). Your instinct is to fix where the error appears, but that's treating a symptom.
Core principle: Trace backward through the call chain until you find the original trigger, then fix at the source.
This skill is a specialized technique within the systematic-debugging workflow, typically applied during Phase 1 (Root Cause Investigation) when dealing with deep call stacks.
Use root-cause-tracing when:
Relationship with systematic-debugging:
NEVER FIX JUST WHERE THE ERROR APPEARS
ALWAYS TRACE BACK TO FIND THE ORIGINAL TRIGGER
Fixing symptoms creates bandaid solutions that mask root problems.
Error appears deep in stack?
→ Yes: Start tracing backward
→ Can identify caller? → Trace one level up → Repeat
→ Cannot identify caller? → Add instrumentation (see advanced-techniques.md)
→ No: May not need tracing (error at entry point)
Example: Git init in wrong directory
Error symptom → execFileAsync('git', ['init'], { cwd: '' })
← WorktreeManager.createSessionWorktree(projectDir='')
← Session.create() → Project.create() → Test code
← ROOT CAUSE: setupCoreTest() returns { tempDir: '' } before beforeEach
At each level ask: Where did this value come from? Is this the origin?
For detailed tracing methodology, seeTracing Techniques For complete real-world examples, seeExamples
Fix at source (throw if accessed before initialization) + Add defense-in-depth (validate at Project.create, WorkspaceManager, environment guards, instrumentation).
This prevents similar bugs and catches issues earlier.
For detailed information:
console.error() for debugging in tests (logger may be suppressed)STOP when thinking:
ALL of these mean: Continue tracing to find root cause.
See Integration for complete workflow examples.
From debugging session (2025-10-03):
Bottom line: Tracing takes 15-30 minutes. Symptom fixes take hours of whack-a-mole.
Weekly Installs
0
Repository
GitHub Stars
18
First Seen
Jan 1, 1970
Security Audits
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
140,500 周安装