gstack-openclaw-investigate
它能做什么
这个技能以“必须先找到根本原因,才能修复”为规则来引导调试。适合遇到错误、异常行为或某项功能突然停止工作的开发者。
适用场景
- ✓当你让智能体修复 bug 或调查错误的时候。
- ✓当你的项目中出现堆栈跟踪或异常行为的时候。
- ✓当有人报告某项功能停止工作的时候。
技能链接
https://github.com/garrytan/gstack/blob/main/openclaw/skills/gstack-openclaw-investigate/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我看一下:昨天更新后,有个功能不能用了。请先找出根本原因,再动手修改。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体收集症状,阅读代码路径,检查近期改动,并复现 bug。在测试和修复之前,它会先提出一个具体的假设。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Systematic Debugging
Iron Law
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.
Fixing symptoms creates whack-a-mole debugging. Every fix that doesn't address root cause makes the next bug harder to find. Find the root cause, then fix it.
Phase 1: Root Cause Investigation
Gather context before forming any hypothesis.
Collect symptoms: Read the error messages, stack traces, and reproduction steps. If the user hasn't provided enough context, ask ONE question at a time. Don't ask five questions at once.
Read the code: Trace the code path from the symptom back to potential causes. Search for all references, read the logic around the failure point.
Check recent changes:
git log --oneline -20 -- <affected-files>Was this working before? What changed? A regression means the root cause is in the diff.
Reproduce: Can you trigger the bug deterministically? If not, gather more evidence before proceeding.
Check memory for prior debugging sessions on the same area. Recurring bugs in the same files are an architectural smell.
Output: "Root cause hypothesis: ..." ... a specific, testable claim about what is wrong and why.
Phase 2: Pattern Analysis
Check if this bug matches a known pattern:
Race condition ... Intermittent, timing-dependent. Look at concurrent access to shared state.
Nil/null propagation ... NoMethodError, TypeError. Missing guards on optional values.
State corruption ... Inconsistent data, partial updates. Check transactions, callbacks, hooks.
Integration failure ... Timeout, unexpected response. External API calls, service boundaries.
Configuration drift ... Works locally, fails in staging/prod. Env vars, feature flags, DB state.
Stale cache ... Shows old data, fixes on cache clear. Redis, CDN, browser cache.
Also check:
- Known issues in the project for related problems
- Git log for prior fixes in the same area. Recurring bugs in the same files are an architectural smell, not a coincidence.
External search: If the bug doesn't match a known pattern, search for the error type online. Sanitize first: strip hostnames, IPs, file paths, SQL, customer data. Search the error category, not the raw message.
Phase 3: Hypothesis Testing
Before writing ANY fix, verify your hypothesis.
Confirm the hypothesis: Add a temporary log statement, assertion, or debug output at the suspected root cause. Run the reproduction. Does the evidence match?
If the hypothesis is wrong: Search for the error (sanitize sensitive data first). Return to Phase 1. Gather more evidence. Do not guess.
3-strike rule: If 3 hypotheses fail, STOP. Tell the user:
"3 hypotheses tested, none match. This may be an architectural issue rather than a simple bug."
Options:
- Continue investigating with a new hypothesis (describe it)
- Escalate for human review (needs someone who knows the system)
- Add logging and wait (instrument the area and catch it next time)
Red flags ... if you see any of these, slow down:
- "Quick fix for now" ... there is no "for now." Fix it right or escalate.
- Proposing a fix before tracing data flow ... you're guessing.
- Each fix reveals a new problem elsewhere ... wrong layer, not wrong code.
Phase 4: Implementation
Once root cause is confirmed:
Fix the root cause, not the symptom. The smallest change that eliminates the actual problem.
Minimal diff: Fewest files touched, fewest lines changed. Resist the urge to refactor adjacent code.
Write a regression test that:
- Fails without the fix (proves the test is meaningful)
- Passes with the fix (proves the fix works)
Run the full test suite. No regressions allowed.
If the fix touches >5 files: Flag the blast radius to the user before proceeding. That's large for a bug fix.
Phase 5: Verification & Report
Fresh verification: Reproduce the original bug scenario and confirm it's fixed. This is not optional.
Run the test suite.
Output a structured debug report:
DEBUG REPORT
- Symptom: what the user observed
- Root cause: what was actually wrong
- Fix: what was changed, with file references
- Evidence: test output, reproduction showing fix works
- Regression test: location of the new test
- Related: prior bugs in same area, architectural notes
- Status: DONE | DONE_WITH_CONCERNS | BLOCK
常见问题
它会很快修补症状吗?
不会。它的设计目标是先找到根本原因,避免反复打补丁式的修复。
它会检查近期改动吗?
会。它会查看受影响文件的近期提交历史。
它会提问吗?
会。当需要更多背景信息时,它会一次问一个问题。
详情
作者的原始描述
Use when asked to debug, fix a bug, investigate an error, or do root cause analysis, and when users report errors, stack traces, unexpected behavior, or say something stopped working.
repo: garrytan/gstack
热度
- GitHub 星标
- 139k
- 排名
- #713
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …