diagnose

GitHub

用于结构化调试测试失败或构建错误。遵循复现、隔离、假设、验证的闭环流程,通过最小化修改定位并修复问题,最终运行完整套件确保无回归。

.claude/skills/diagnose/SKILL.md Totoro-jam/battle-tested-patterns

触发场景

测试用例执行失败 项目构建过程报错

安装

npx skills add Totoro-jam/battle-tested-patterns --skill diagnose -g -y
更多选项

非标准路径

npx skills add https://github.com/Totoro-jam/battle-tested-patterns/tree/main/.claude/skills/diagnose -g -y

不安装直接使用

npx skills use Totoro-jam/battle-tested-patterns@diagnose

指定 Agent (Claude Code)

npx skills add Totoro-jam/battle-tested-patterns --skill diagnose -a claude-code -g -y

安装 repo 全部 skill

npx skills add Totoro-jam/battle-tested-patterns --all -g -y

预览 repo 内 skill

npx skills add Totoro-jam/battle-tested-patterns --list

SKILL.md

Frontmatter
{
    "name": "diagnose",
    "description": "Structured debugging loop for exercise tests or build failures. Reproduce → isolate → hypothesize → fix → verify."
}

Diagnose a Failure

You are debugging a test failure or build error in this project. Follow the structured loop — do NOT jump to a fix without reproducing first.

Loop

1. Reproduce

Run the failing command and capture the exact error:

pnpm test          # All tests (docs + exercises in TS/Rust/Go/Python)
pnpm test:rust     # Rust only
pnpm test:go       # Go only
pnpm test:python   # Python only (auto-finds Python ≥ 3.10)
pnpm build         # VitePress

2. Isolate

Narrow down to the smallest failing unit:

  • Which test file?
  • Which test case?
  • Which assertion?

3. Hypothesize

State your hypothesis in one sentence before changing any code.

4. Instrument

Add minimal logging or assertions to confirm/deny your hypothesis. Do NOT change production code yet.

5. Fix

Apply the minimal fix. Change as little as possible.

6. Verify

Run the full test suite, not just the failing test:

pnpm test && pnpm build

If it still fails, return to step 1 with what you learned.

7. Regression Test

If the bug was non-trivial, add a test that would have caught it.

版本历史

  • 0307be9 当前 2026-07-05 14:53

同 Skill 集合

.claude/skills/new-pattern/SKILL.md
.claude/skills/verify-source/SKILL.md
plugins/pattern-skills/skills/adopt-pattern/SKILL.md
plugins/pattern-skills/skills/audit-pattern/SKILL.md

元信息

文件数
0
版本
0307be9
Hash
65261c90
收录时间
2026-07-05 14:53

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-15 19:38
浙ICP备14020137号-1 $访客地图$