跳到正文
Skillpedia
通用编程48k · #5918

systematic-debugging

它能做什么

这个工具可以帮你找到技术问题的根本原因,比如程序报错或行为异常。它会引导你先调查,再动手修复,确保问题真正解决,而不是只做临时遮掩。

适用场景

  • ✓程序出现你看不懂的错误时。
  • ✓你已经尝试修复好几次都没有成功时。
  • ✓在紧急情况下,人很容易想要快速打补丁时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/systematic-debugging/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/systematic-debugging/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我的代码在保存文件时出现了奇怪的错误,应该怎么调查根本原因?”

每周 5 个新技能,1 分钟读完。

工作原理

这个工具建议按照有条理的步骤来:首先,弄清楚错误内容,并想办法重现它;然后,检查最近有哪些改动。接下来,再提出假设,并用尽可能小的改动来验证原因。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Systematic Debugging

Overview

Random fixes waste time and create new bugs. Quick patches mask underlying issues.

Core principle: Investigate before guessing and separate a verified repair from a temporary mitigation. During an incident, an authorized rollback or containment action may restore service while root-cause work continues.

Violating the letter of this process is violating the spirit of debugging.

The Iron Law

NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST

Start with the observable failure and the smallest useful evidence check. Label any emergency mitigation explicitly and preserve evidence for the later root-cause investigation.

When to Use

Use for ANY technical issue:

  • Test failures
  • Bugs in production
  • Unexpected behavior
  • Performance problems
  • Build failures
  • Integration issues

Use this ESPECIALLY when:

  • Under time pressure (emergencies make guessing tempting)
  • "Just one quick fix" seems obvious
  • You've already tried multiple fixes
  • Previous fix didn't work
  • You don't fully understand the issue

Don't skip when:

  • Issue seems simple (simple bugs have root causes too)
  • You're in a hurry (rushing guarantees rework)
  • Manager wants it fixed NOW (systematic is faster than thrashing)

The Four Phases

You MUST complete each phase before proceeding to the next.

Phase 1: Root Cause Investigation

BEFORE attempting ANY fix:

  1. Read Error Messages Carefully

    • Don't skip past errors or warnings
    • They often contain the exact solution
    • Read stack traces completely
    • Note line numbers, file paths, error codes
  2. Reproduce Consistently

    • Can you trigger it reliably?
    • What are the exact steps?
    • Does it happen every time?
    • If not reproducible → gather more data, don't guess
  3. Check Recent Changes

    • What changed that could cause this?
    • Git diff, recent commits
    • New dependencies, config changes
    • Environmental differences
  4. Gather Evidence in Multi-Component Systems

    WHEN system has multiple components (CI → build → signing, API → service → database):

    BEFORE proposing fixes, add diagnostic instrumentation:

    For EACH component boundary:
      - Record allowed field names, sizes, statuses and correlation IDs
      - Redact secrets and private payloads before logging
      - Verify environment/config propagation
      - Check state at each layer
    
    Run once to gather evidence showing WHERE it breaks
    THEN analyze evidence to identify failing component
    THEN investigate that specific component
    

    Example (multi-layer system):

    # In each relevant process, report presence only; never dump secret values.
    if [ -n "${IDENTITY:-}" ]; then
      echo 'IDENTITY is set'
    else
      echo 'IDENTITY is absent or empty'
    fi
    
    # Read-only validation of an already-built artifact, when available.
    codesign --verify --verbose=2 "$APP"
    

    Interpretation: Compare presence checks at the actual workflow/build boundaries. Artifact verification does not itself prove that the correct signing identity propagated.

  5. Trace Data Flow

    WHEN error is deep in call stack:

    See root-cause-tracing.md in this directory for the complete backward tracing technique.

    Quick version:

    • Where does bad value originate?
    • What called this with bad value?
    • Keep tracing up until you find the source
    • Fix at source, not at symptom

Phase 2: Pattern Analysis

Find the pattern before fixing:

  1. Find Working Examples

    • Locate similar working code in same codebase
    • What works that's similar to what's broken?
  2. Compare Against References

    • If implementing pattern, read reference implementation COMPLETELY
    • Don't skim - read every line
    • Understand the pattern fully before applying
  3. Identify Differences

    • What's different between working and broken?
    • List every difference, however small
    • Don't assume "that can't matter"
  4. Understand Dependencies

    • What other components does this need?
    • What settings, config, environment?
    • What assumptions does it make?

Phase 3: Hypothesis and Testing

Scientific method:

  1. Form Single Hypothesis

    • State clearly: "I think X is the root cause because Y"
    • Write it down
    • Be specific, not vague
  2. Test Minimally

    • Make the SMALLEST possible change to test hypothesis
    • One variable at a time

…

常见问题

为什么不能直接试一个快速修复?

快速修复可能会掩盖真正的问题,还可能引入新的 bug,最终反而花费更多时间。调查根本原因,才能得到持久的解决方案。

什么是“根本原因”?

它是问题发生的根本原因。只处理表面现象(也就是可见的错误)是不够的,根本原因才是源头问题,修好它,错误才不会再次出现。

如果问题涉及系统的多个部分怎么办?

工具会建议检查各部分之间的通信,并在每个“边界”(即一个部分与另一个部分交互的地方)记录信息,从而找出故障最先出现的位置。

详情

作者的原始描述

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5918
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能