跳到正文
cccskills
免费在 GitHub 公开中文介绍

systematic-debugging

先准备可重复复现症状的测试或命令,再按原因调查、正常示例对比、假设验证和修复四个阶段,定位根本原因并用回归测试验证结果。

原文查看原文说明

4-phase root cause debugging: understand bugs before fixing.

AI 评分80分/ 100查看安装方法

适用场景

  • 调查测试或构建失败
  • 排查跨多个系统的异常
  • 复现间歇性缺陷
  • 重新分析多次修复失败的原因

中文介绍

功能

这项技能分四个阶段调查缺陷的根本原因,再进行修复:原因调查、与正常示例对比、假设验证和修复。首先准备能够反复检查问题症状的测试或命令,随后检查错误、近期变更和数据流,比较故障情况与正常情况的差异,再提出可验证的假设,每次只改变一个条件进行检验。

适用场景

适合调查测试或构建失败、生产环境缺陷、性能问题,以及系统集成中的异常。对于难以复现的问题,会先提高复现频率;能够复现后,再减少输入或步骤,缩小原因范围。多次修复仍未解决问题时,也可用它重新分析。

使用示例

  • “为这次测试失败建立最小复现步骤,并调查原因。”
  • “追踪从API到数据库的处理过程,确认异常出现在哪个边界。”
  • “修复前先编写回归测试,修复后再运行现有测试。”

注意事项

调查使用read_file、search_files、terminal等工具,修复时要求配合test-driven-development。修复失败达到三次或更多时,需要先与用户讨论设计,再尝试追加修复。

本介绍由 AI(OpenAI Codex)根据公开的 SKILL.md 撰写。准确的规格请查看下方原文。

客观评估

AI 仅根据 SKILL.md 的内容,从 4 个方面进行了评估。星标数和热度不计入评估。

指令清晰度能否看出何时使用、做什么
A良好明确列出测试失败等适用场景,并要求修复前调查根本原因。
步骤具体性步骤、输入输出和示例是否具体
A良好包含复现命令、缩减复现条件的步骤、正常示例对比和阶段完成检查项。
安全性发送数据、删除文件、执行命令等是否有说明
B部分不足要求通过HTTP复现并记录组件边界数据,但未说明目标限制或敏感信息处理。
安装难易度所需工具和 API 密钥是否少且有说明
B部分不足列出`read_file`等工具和`pytest`等命令示例,但未说明执行环境的准备步骤。

总分按每项 A=25 分、B=15 分、C=5 分相加。 由 AI(OpenAI Codex)于 2026年10月20日 评估。仅供参考,安装前请同时查看原文。

如果您认为评估有误,请申请复核

请写明哪一项有误以及原因。无需登录。我们会对照 SKILL.md 重新评估,并在此处更新结果。

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

包含的文件(1)

  • SKILL.md13.7 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Systematic Debugging

Overview

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

Core principle: ALWAYS find root cause before attempting fixes. Symptom fixes are failure.

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

The Iron Law

NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST

If you haven't completed Phase 1, you cannot propose fixes.

The Feedback Loop Rule

The feedback loop is the debugging work. Before reading code to build a theory, create or identify a tight command that can go red on the user's exact symptom and green when the bug is fixed. A tight loop is fast, deterministic, agent-runnable, and specific enough to catch this bug — not merely "doesn't crash".

When a clean repro is hard, spend disproportionate effort building the loop. Guessing without a red-capable loop is the failure mode this skill exists to prevent.

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)
  • Someone 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

Action: Use read_file on the relevant source files. Use search_files to find the error string in the codebase.

2. Build a Tight Feedback Loop

  • Can you trigger the user's exact symptom with one command?
  • Does the command fail for this bug and only pass once the bug is fixed?
  • Is it fast enough to run repeatedly?
  • Is it deterministic? For flaky bugs, can you raise the reproduction rate high enough to debug?
  • If not reproducible → gather more data, don't guess.

Ways to construct a loop — try in roughly this order:

  1. Failing test at the seam that reaches the bug: unit, integration, or end-to-end.
  2. HTTP script / curl against a running dev server.
  3. CLI invocation with fixture input, diffing stdout/stderr against expected output.
  4. Headless browser script (Playwright/Puppeteer) asserting on DOM, console, or network.
  5. Replay a captured trace: HAR, request payload, event log, queue message, or webhook body.
  6. Throwaway harness that boots the smallest useful slice of the system and calls the failing path.
  7. Property / fuzz loop when the bug is intermittent wrong output over a broad input space.
  8. Bisection harness suitable for git bisect run when the bug appeared between two known states.
  9. Differential loop comparing old vs new version, two configs, two providers, or two datasets.
  10. Human-in-the-loop script only as a last resort: script the human steps and capture their result so the loop stays structured.

Tighten the loop once it exists:

  • Make it faster: cache setup, narrow scope, skip unrelated initialization.
  • Make the signal sharper: assert the exact symptom, not generic success.
  • Make it more deterministic: pin time, seed randomness, isolate filesystem, freeze network.

For non-deterministic bugs, the immediate goal is a higher reproduction rate, not perfection. Run the trigger 100x, parallelize, add stress, narrow timing windows, or inject sleeps. A 50% flake is debuggable; a 1% flake usually is not.

Action: Use the terminal tool to run the tight loop:

# Run a specific failing test
pytest tests/test_module.py::test_name -v

# Or run a scripted repro
python scripts/repro_bug.py

# Or run a high-repetition flaky repro
for i in {1..100}; do pytest tests/test_flake.py::test_name -q || break; done

3. Check Recent Changes

  • What changed that could cause this?
  • Git diff, recent commits
  • New dependencies, config changes

Action:

# Recent commits
git log --oneline -10

# Uncommitted changes
git diff

# Changes in specific file
git log -p --follow src/problematic_file.py | head -100

4. Gather Evidence in Multi-Component Systems

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

BEFORE proposing fixes, add diagnostic instrumentation:

For EACH component boundary:

  • Log what data enters the component
  • Log what data exits the component
  • Verify environment/config propagation
  • Check state at each layer

Run once to gather evidence showing WHERE it breaks. THEN analyze evidence to identify the failing component. THEN investigate that specific component.

5. Trace Data Flow

WHEN error is deep in the call stack:

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

Action: Use search_files to trace references:

# Find where the function is called
search_files("function_name(", path="src/", file_glob="*.py")

# Find where the variable is set
search_files("variable_name\\s*=", path="src/", file_glob="*.py")

Phase 1 Completion Checklist

  • Error messages fully read and understood
  • A tight loop command exists and has been run at least once
  • Loop is red-capable: it asserts the user's exact symptom, not a nearby failure
  • Loop is deterministic, or a flaky bug has a high enough reproduction rate to debug
  • Recent changes identified and reviewed
  • Evidence gathered (logs, state, data flow)
  • Problem isolated to specific component/code
  • Root cause hypotheses can be stated and tested

STOP: Do not proceed to Phase 2 until you understand WHY it's happening.


Phase 2: Pattern Analysis

Find the pattern before fixing:

0. Minimize the Reproduction

Once the loop is red, shrink the repro to the smallest scenario that still goes red. Cut inputs, callers, config, data, and steps one at a time, re-running the loop after each cut. Keep only what is load-bearing for the failure.

Done when removing any remaining element makes the loop go green. A minimal repro narrows the hypothesis space and often becomes the cleanest regression test.

1. Find Working Examples

  • Locate similar working code in the same codebase
  • What works that's similar to what's broken?

Action: Use search_files to find comparable patterns:

search_files("similar_pattern", path="src/", file_glob="*.py")

2. Compare Against References

  • If implementing a pattern, read the 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 Ranked Falsifiable Hypotheses

  • Generate 3–5 plausible hypotheses before testing any single one.
  • Rank them by likelihood and cheapness to falsify.
  • State the prediction each hypothesis makes: "If X is the cause, then changing or observing Y should make Z happen."
  • Discard or sharpen any hypothesis that does not make a testable prediction.

If the user is present, show the ranked list before testing. They may have domain knowledge that instantly re-ranks it. If the user is AFK, proceed with your ranking.

2. Test Minimally

  • Test the highest-ranked hypothesis with the smallest possible probe.
  • Change one variable at a time.
  • Don't fix multiple things at once.
  • Prefer debugger/REPL inspection when available; one breakpoint beats ten logs.
  • If you add logs, tag every temporary line with a unique prefix such as [DEBUG-a4f2] so cleanup is a single search.

3. Verify Before Continuing

  • Did it work? → Phase 4
  • Didn't work? → Form NEW hypothesis
  • DON'T add more fixes on top

4. When You Don't Know

  • Say "I don't understand X"
  • Don't pretend to know
  • Ask the user for help
  • Research more

Phase 4: Implementation

Fix the root cause, not the symptom:

1. Create Failing Test Case

  • Simplest possible reproduction
  • Automated test if possible
  • MUST have before fixing
  • Use the test-driven-development skill

2. Implement Single Fix

  • Address the root cause identified
  • ONE change at a time
  • No "while I'm here" improvements
  • No bundled refactoring

3. Verify Fix

# Run the specific regression test
pytest tests/test_module.py::test_regression -v

# Run full suite — no regressions
pytest tests/ -q

4. If Fix Doesn't Work — The Rule of Three

  • STOP.
  • Count: How many fixes have you tried?
  • If < 3: Return to Phase 1, re-analyze with new information
  • If ≥ 3: STOP and question the architecture (step 5 below)
  • DON'T attempt Fix #4 without architectural discussion

5. If 3+ Fixes Failed: Question Architecture

Pattern indicating an architectural problem:

  • Each fix reveals new shared state/coupling in a different place
  • Fixes require "massive refactoring" to implement
  • Each fix creates new symptoms elsewhere

STOP and question fundamentals:

  • Is this pattern fundamentally sound?
  • Are we "sticking with it through sheer inertia"?
  • Should we refactor the architecture vs. continue fixing symptoms?

Discuss with the user before attempting more fixes.

This is NOT a failed hypothesis — this is a wrong architecture.


Red Flags — STOP and Follow Process

If you catch yourself thinking:

  • "Quick fix for now, investigate later"
  • "Just try changing X and see if it works"
  • "Add multiple changes, run tests"
  • "Skip the test, I'll manually verify"
  • "It's probably X, let me fix that"
  • "I don't fully understand but this might work"
  • "Pattern says X but I'll adapt it differently"
  • "Here are the main problems: [lists fixes without investigation]"
  • Proposing solutions before tracing data flow
  • "One more fix attempt" (when already tried 2+)
  • Each fix reveals a new problem in a different place

ALL of these mean: STOP. Return to Phase 1.

If 3+ fixes failed: Question the architecture (Phase 4 step 5).

Common Rationalizations

ExcuseReality
"Issue is simple, don't need process"Simple issues have root causes too. Process is fast for simple bugs.
"Emergency, no time for process"Systematic debugging is FASTER than guess-and-check thrashing.
"Just try this first, then investigate"First fix sets the pattern. Do it right from the start.
"I'll write test after confirming fix works"Untested fixes don't stick. Test first proves it.
"Multiple fixes at once saves time"Can't isolate what worked. Causes new bugs.
"Reference too long, I'll adapt the pattern"Partial understanding guarantees bugs. Read it completely.
"I see the problem, let me fix it"Seeing symptoms ≠ understanding root cause.
"One more fix attempt" (after 2+ failures)3+ failures = architectural problem. Question the pattern, don't fix again.

Quick Reference

PhaseKey ActivitiesSuccess Criteria
1. Root CauseRead errors, reproduce, check changes, gather evidence, trace data flowUnderstand WHAT and WHY
2. PatternFind working examples, compare, identify differencesKnow what's different
3. HypothesisForm theory, test minimally, one variable at a timeConfirmed or new hypothesis
4. ImplementationCreate regression test, fix root cause, verifyBug resolved, all tests pass

Hermes Agent Integration

Investigation Tools

Use these Hermes tools during Phase 1:

  • search_files — Find error strings, trace function calls, locate patterns
  • read_file — Read source code with line numbers for precise analysis
  • terminal — Run tests, check git history, reproduce bugs
  • web_search/web_extract — Research error messages, library docs

With delegate_task

For complex multi-component debugging, dispatch investigation subagents:

delegate_task(
    goal="Investigate why [specific test/behavior] fails",
    context="""
    Follow systematic-debugging skill:
    1. Read the error message carefully
    2. Reproduce the issue
    3. Trace the data flow to find root cause
    4. Report findings — do NOT fix yet

    Error: [paste full error]
    File: [path to failing code]
    Test command: [exact command]
    """,
    toolsets=['terminal', 'file']
)

With test-driven-development

When fixing bugs:

  1. Write a test that reproduces the bug (RED)
  2. Debug systematically to find root cause
  3. Fix the root cause (GREEN)
  4. The test proves the fix and prevents regression

Real-World Impact

From debugging sessions:

  • Systematic approach: 15-30 minutes to fix
  • Random fixes approach: 2-3 hours of thrashing
  • First-time fix rate: 95% vs 40%
  • New bugs introduced: Near zero vs common

No shortcuts. No guessing. Systematic always wins.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

1password

免费有简介AI 评分 100分

通过1Password CLI,将保存的密码和API密钥用于命令及配置模板,完成安装、认证、秘密值读取,并通过环境变量向命令传递凭据。

  • 安装并配置1Password CLI
  • 使用已保存的API密钥运行命令
  • 向配置模板填入秘密值
NousResearch/hermes-agent25.5万2026年10月19日 更新

3-statement-model

免费有简介AI 评分 90分

创建用公式联动利润表、资产负债表和现金流量表的 Excel 模型,分阶段填入历史实际数据与预测假设,比较不同情景,并检查三张报表之间的一致性。

  • 向财务模板填入历史实际数据
  • 建立三张财务报表联动的预测
  • 比较基准、乐观和悲观情景
NousResearch/hermes-agent25.5万2026年10月19日 更新

accelerate

免费有简介AI 评分 80分

以少量修改让现有PyTorch训练代码适用于多GPU或多台机器,指导混合精度、节省内存的DeepSpeed与FSDP配置,以及训练启动方法。

  • 将单GPU训练迁移至多GPU
  • 配置混合精度训练
  • 通过DeepSpeed或FSDP节省内存
NousResearch/hermes-agent25.5万2026年10月19日 更新

actual-setup

免费有简介AI 评分 100分

帮助配置Hermes,通过Actual Computer在自己的设备上运行AI模型。支持加密中继与本地连接,涵盖模型选择、响应测试,以及请求报错或空响应的排查。

  • 使用Actual密钥连接Hermes
  • 在本地设备上运行模型
  • 查找、下载并加载本地模型
NousResearch/hermes-agent25.5万2026年10月19日 更新

adversarial-ux-test

免费有简介AI 评分 80分

扮演不擅长技术、容易不满的用户测试应用,发现难懂的操作和导致放弃使用的障碍。将实际可改进的问题与个人抱怨分开,整理截图、修复建议和任务单。

  • 在发布或演示前检查易用性
  • 检查新用户的使用体验
  • 查找注册和付费流程中的障碍
NousResearch/hermes-agent25.5万2026年10月19日 更新

agent-merge-conflict-arbiter

免费有简介AI 评分 100分

从中立立场解决两个智能体分别修改代码产生的Git冲突,对照双方差异和意图,记录每处冲突的取舍理由,并通过构建或测试验证合并结果。

  • 解决两个智能体的分支冲突
  • 整合并行工作树中的修改
  • 核对冲突设计决策的理由
NousResearch/hermes-agent25.5万2026年10月19日 更新

查看 NousResearch 的全部技能

报告此技能的问题