Systematic debugging and problem-solving methodology. Activate when encountering unexpected errors, service failures, regression bugs, deployment issues, or...
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install debug-methodology或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install debug-methodology⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/debug-methodology/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: debug-methodology description: Systematic debugging and problem-solving methodology. Activate when encountering unexpected errors, service failures, regression bugs, deployment issues, or when a fix attempt has failed twice. Also activate when proposing ANY fix to verify it addresses root cause (not a workaround). Prevents patch-chaining, wrong-environment restarts, workaround addiction, and "drunk man" random fixes. ---
Systematic approach to debugging and problem-solving. Distilled from real production incidents and industry best practices.
Every fix MUST target the root cause. Workarounds are forbidden unless explicitly approved.
Before proposing ANY solution, pass the Root Cause Gate:
┌─────────────────────────────────────────────┐
│ ROOT CAUSE GATE │
│ │
│ 1. What is the ACTUAL problem? │
│ 2. WHY does it happen? (not just WHAT) │
│ 3. Does my fix eliminate the WHY? │
│ YES → proceed │
│ NO → this is a workaround → STOP │
│ │
│ Workaround test: │
│ "If I remove my fix, does the bug return?" │
│ YES → workaround (fix the cause instead)│
│ NO → genuine fix ✅ │
└─────────────────────────────────────────────┘
Problem: API returns 524 timeout
Why? → Cloudflare cuts connections >100s
Why? → The API call takes >100s
Why? → Using non-streaming request, server holds connection silent
Why? → Code uses regular fetch, not streaming
Fix: → Use streaming (server sends data continuously, Cloudflare won't cut)
❌ WRONG: Switch to faster model (workaround — avoids the timeout instead of fixing it)
✅ RIGHT: Use streaming API (root cause — Cloudflare needs ongoing data)
| Problem | Workaround (❌) | Root Cause Fix (✅) | |---------|----------------|-------------------| | API timeout | Switch to faster model | Use streaming / fix the slow query | | Data precision loss | Search by name instead of ID | Fix BigInt parsing | | Search returns nothing | Try different search strategy | Fix the search implementation | | Dependency conflict | Downgrade / pin version | Use correct environment (venv) | | Feature doesn't work | Remove the feature | Debug why it fails |
Self-check question: "Am I solving the problem, or avoiding it?"
Before ANY fix attempt:
□ What is the EXACT symptom? (error message, behavior, screenshot)
□ When did it last work? What changed since then?
□ How is the service running? (process, env, startup command)
For running services:
ps -p <PID> -o command= # How was it started?
ls .venv/ venv/ env/ # Virtual environment?
which python3 && python3 --version
which node && node --version
NEVER restart a service without first recording its original startup command.
Priority order:
Change X → Test → Works? → Done
→ Fails? → REVERT X → new hypothesis
Do NOT stack changes.
2 fix attempts failed → STOP. Revert ALL. Back to Phase 1.
You are likely:
After any fix, verify:
□ Does it solve the ORIGINAL problem? (not just silence the error)
□ Did I introduce new issues? (regression check)
□ Would removing my fix bring the bug back? (confirms causality)
□ Is the fix in the right layer? (not patching symptoms upstream)
Bypassing the problem instead of fixing it. "It's slower but works" / "Use a different approach". → Ask: "Am I solving or avoiding?" If avoiding → find the real fix. → Workarounds are ONLY acceptable when: (1) explicitly approved by user, (2) clearly labeled as temporary, (3) a TODO is created for the real fix.
Randomly changing things until the problem disappears. → Each change needs a hypothesis.
Looking where comfortable, not where the problem is. → "Is this where the bug IS, or where I KNOW HOW TO LOOK?"
Copying a fix without understanding why it works. → Understand the mechanism first.
User says "it broke after you changed X" → immediately diff X. → User observations are the most valuable data.
□ Runtime: system or venv/nvm?
□ Dependencies: match expected versions?
□ Config: .env, config.json — recent changes?
□ Process manager: PM2/systemd — restart method?
□ Logs: tail -f before reproducing
□ Backup: snapshot before any change
Iron Rule: NEVER edit files directly on the server. NEVER overwrite server files without backup.
Standard deployment (every time, no exceptions):
1. PULL scp server:/opt/apps/项目/ ./local-项目/
(pull the files you need + related files)
2. EDIT Make changes locally
(complex multi-line → write full file, never sed)
3. VERIFY node -c *.js # syntax check
node -e "require('./file')" # module load check
(STOP if verification fails — do not proceed)
4. BACKUP ssh server "cp file file.bak.$(date +%s)"
5. PUSH scp ./local-file server:/opt/apps/项目/file
6. RESTART pm2 restart <app>
(use SAME method as original — check ps/pm2 show first)
7. HEALTH curl -s http://localhost:<port>/health
pm2 logs <app> --lines 5 --nostream
(if unhealthy → revert backup immediately)
Changing 1 file → pull that file + its imports/importers
Changing routes → also pull server.js (check mount points)
Changing frontend → also pull index.html (check script tags)
Changing config → also pull code that reads the config
Unsure what to pull → pull the whole project directory
❌ sed -i for multi-line code on server
❌ Skip node -c after editing .js
❌ pm2 restart before syntax verification
❌ Tell user to refresh before health check passes
❌ Push without backup
Every code change on a server MUST be syntax-verified before restart/reload.
After editing .js files:
□ node -c <file> # Syntax check
□ node -e "require('./<file>')" # Module load check (for route files)
□ FAIL → DO NOT restart. DO NOT tell user to refresh. Fix first.
After editing .html files:
□ Check critical tag closure (div/script/style)
□ grep -c '<div' file && grep -c '</div' file # Count match
Complex multi-line changes:
□ Write complete file locally → scp upload
□ NEVER use sed for multi-line code insertion (newlines get swallowed)
□ If sed is unavoidable → verify with node -c immediately after
Restart sequence:
□ node -c *.js passes → pm2 restart <app>
□ Check pm2 logs --lines 5 for startup errors
□ curl health endpoint to confirm service is up
Why: sed -i multi-line insertion silently corrupts JS (newlines become single line), causing syntax errors that break the entire page with no visible error to the user.
...
安装 Debug Methodology 后,可以对 AI 说这些话来触发它
Help me get started with Debug Methodology
Explains what Debug Methodology does, walks through the setup, and runs a quick demo based on your current project
Use Debug Methodology to systematic debugging and problem-solving methodology
Invokes Debug Methodology with the right parameters and returns the result directly in the conversation
What can I do with Debug Methodology in my developer & devops workflow?
Lists the top use cases for Debug Methodology, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/debug-methodology/ 目录(个人级,所有项目可用),或 .claude/skills/debug-methodology/(项目级)。重启 AI 客户端后,用 /debug-methodology 主动调用,或让 AI 根据上下文自动发现并使用。
Debug Methodology 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Debug Methodology 可免费安装使用。请查阅仓库了解许可证信息。
Systematic debugging and problem-solving methodology. Activate when encountering unexpected errors, service failures, regression bugs, deployment issues, or...
Debug Methodology 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using Debug Methodology
Identifies repetitive steps in your workflow and sets up Debug Methodology to handle them automatically