Logo Debug Hypothesis

Debug Hypothesis

Cộng đồng
LichAmnesia
debug-hypothesis

Use when debugging any non-trivial bug — wrong output, crash, flaky test, performance regression, or "it works locally but not in CI." Forces a scientific-method loop (Observe → Hypothesize → Experiment → Conclude) so the agent stops guessing and starts reasoning. Prevents the

Tổng quan

Nhà phát hànhLichAmnesia
Kho mãlich-skills
Tên kỹ năngdebug-hypothesis
Sao
231
Bản fork
26
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Đầy đủ trong hướng dẫn

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được LichAmnesia công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Debug Hypothesis trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/LichAmnesia/lich-skills/tree/main/skills/debug-hypothesis
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git /tmp/lich-skills
mkdir -p .claude/skills
cp -r /tmp/lich-skills/skills/debug-hypothesis .claude/skills/debug-hypothesis
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Debug Hypothesis trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Debug Hypothesis ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Debug Hypothesis không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Hypothesis-Driven Debugging

A four-phase loop that turns debugging from "try random fixes and hope" into a disciplined investigation. Each phase has a goal, hard rules, and a rationalization table for the excuses an agent will invent to skip it.

The core principle: you may not write a fix until you have evidence that your hypothesis is correct. Guessing is not debugging.

When to Use

  • A test fails and the cause is not immediately obvious
  • The same bug has been "fixed" twice and came back
  • The agent tried a fix that didn't work — stop it from trying another
  • A crash or error message you haven't seen before
  • Performance regression with no obvious culprit
  • Behavior differs between environments (local vs CI, dev vs prod)
  • The agent is stuck in a loop, applying the same wrong fix

When NOT to Use

  • Typos, missing imports, or syntax errors — just fix them
  • Build failures with an obvious single-line cause
  • Compiler/linter messages that tell you exactly what and where
  • You already know the root cause and just need to write the fix

If the bug survived one fix attempt, switch to this skill immediately.

The Debug Loop

  OBSERVE  ──▶  HYPOTHESIZE  ──▶  EXPERIMENT  ──▶  CONCLUDE
     │              │                  │               │
     ▼              ▼                  ▼               ▼
  Gather          List 3-5         One minimal       Root cause
  symptoms,       possible         test per          confirmed
  reproduce       causes +         hypothesis,       or loop
  reliably        evidence         max 5 lines       back
     │              │                  │               │
     └──────────────┴──────────────────┴───────────────┘
              write everything to DEBUG.md

Hard rules:

  1. Everything gets written to DEBUG.md. Context compaction will eat your reasoning if it only lives in the conversation.
  2. You may not write fix code during Observe, Hypothesize, or Experiment.
  3. You may not skip Hypothesize. "I think I know what it is" is a hypothesis — write it down and test it like the others.
  4. Each experiment changes at most 5 lines. If your experiment needs more, your hypothesis is too vague — split it.

Phase 1: OBSERVE

Goal. Collect raw facts. Reproduce the bug. Separate what you know from what you assume.

Steps.

  1. Reproduce the bug. Get the exact error message, stack trace, or wrong output. If you cannot reproduce it, that is your first finding.
  2. Find the minimal reproduction. Strip away unrelated code until the bug still appears.
  3. Record the environment: OS, runtime version, dependencies, config.
  4. Note what does work. The boundary between working and broken is where the bug lives.
  5. Write all observations to DEBUG.md under ## Observations.

Exit criteria.

  • Bug reproduced (or documented as non-reproducible with conditions)
  • Exact error message or wrong behavior recorded
  • Minimal reproduction identified
  • Observations written to DEBUG.md

Common Rationalizations

ExcuseReality
"I already know what's wrong"Then write it as a hypothesis and prove it. If you're right, it takes 2 minutes.
"Let me just try this quick fix first"That's how you end up 45 minutes deep with 6 failed attempts.
"The error message is clear enough"Error messages describe symptoms, not causes. NullPointerException tells you what died, not why.
"I don't need to reproduce it, I can see the bug in the code"Can you? Then why hasn't it been fixed yet?

Phase 2: HYPOTHESIZE

Goal. Generate 3-5 possible root causes. For each, list supporting and conflicting evidence from Phase 1. Rank by likelihood.

Steps.

  1. List 3-5 hypotheses. Not 1. Not "I think it's X." Three minimum. Think across categories:
    • Data: wrong input, missing field, type mismatch, encoding
    • Logic: wrong condition, off-by-one, race condition, wrong order
    • Environment: config, version, dependency, permissions
    • State: stale cache, leaked state, initialization order
  2. For each hypothesis, write:
    • Supports: evidence from observations that backs this theory
    • Conflicts: evidence that argues against it
    • Test: the minimal experiment that would prove or disprove it
  3. Mark the ROOT HYPOTHESIS — the one with supporting evidence and no conflicting evidence. If multiple qualify, pick the easiest to test.
  4. Write everything to DEBUG.md under ## Hypotheses.

Example format in DEBUG.md:

markdown
## Hypotheses

### H1: Race condition in session middleware (ROOT HYPOTHESIS)
- Supports: only happens under concurrent requests, timing-dependent
- Conflicts: none yet
- Test: add mutex lock around session read, check if bug disappears

### H2: Stale cache returning expired token
- Supports: works after restart (cache cleared)
- Conflicts: cache TTL is 5min, bug appears within 30s
- Test: disable cache, reproduce

### H3: Wrong env variable in CI
- Supports: works locally, fails in CI
- Conflicts: env diff shows identical values
- Test: print actual runtime value in CI logs

Exit criteria.

  • At least 3 hypotheses written
  • Each has supporting/conflicting evidence
  • Each has a specific, minimal test
  • ROOT HYPOTHESIS identified
  • All written to DEBUG.md

Common Rationalizations

ExcuseReality
"I only have one theory"You have one favorite theory. Think harder. What if it's not that?
"Writing this down is slow"Debugging without writing is slower. You'll forget hypothesis 2 after compaction eats it.
"The first hypothesis is obviously right"Then proving it takes 2 minutes. If you skip proof, you'll spend 30 minutes when it turns out wrong.
"I don't have conflicting evidence"That means you haven't looked hard enough, or it really is the root cause. Either way, test it.

Phase 3: EXPERIMENT

Goal. Test the ROOT HYPOTHESIS with the smallest possible change. You are a scientist — you are trying to falsify, not confirm.

Steps.

  1. Write the experiment before running it. What will you change? What result confirms the hypothesis? What result rejects it?
  2. Make the change. Maximum 5 lines. If you need more, your hypothesis is too vague.
  3. Run the reproduction from Phase 1.
  4. Record the result in DEBUG.md under ## Experiments.

Experiment rules.

  • One variable at a time. Do not combine two fixes "to save time."
  • Do not write production fix code. Write diagnostic code: log statements, assertions, simplified logic, hardcoded values.
  • Revert the experiment after recording results. Keep the tree clean.
  • If the experiment is inconclusive, that's a result — record it and test the next hypothesis.

Exit criteria.

  • Experiment executed (one change, one variable)
  • Result recorded: confirmed, rejected, or inconclusive
  • Experimental code reverted
  • Results written to DEBUG.md

Common Rationalizations

ExcuseReality
"Let me just fix it instead of testing"Fixing without confirming the cause is how you ship a wrong fix that breaks something else.
"I'll test two things at once to save time"When both change and the bug disappears, which one fixed it? Now you have to test again.
"5 lines isn't enough"5 lines is enough to add a log, an assertion, a hardcoded value, or a short-circuit. If it isn't, your hypothesis is "something is wrong somewhere" — not a hypothesis.
"I don't need to revert, the fix is basically the experiment"The experiment is diagnostic. The fix is production code. They have different quality bars.

Phase 4: CONCLUDE

Goal. Confirm root cause, write the real fix, and add a regression test.

Steps.

  1. If ROOT HYPOTHESIS confirmed:
    • Write the root cause in one sentence in DEBUG.md.
    • Now — and only now — write production fix code.
    • Add a regression test that fails without the fix and passes with it.
    • Commit fix and test together.
  2. If ROOT HYPOTHESIS rejected:
    • Record the rejection and evidence in DEBUG.md.
    • Promote the next hypothesis to ROOT. Return to Phase 3.
    • If all hypotheses rejected, return to Phase 1 with new observations.
  3. Update DEBUG.md with the final ## Root Cause and ## Fix sections.

Exit criteria.

  • Root cause identified and written in one sentence
  • Fix committed
  • Regression test committed
  • DEBUG.md complete with full investigation trail
  • Original reproduction case now passes

Common Rationalizations

ExcuseReality
"I don't need a regression test, it's a simple fix"Simple fixes for simple bugs don't need this skill. You're here because it wasn't simple. Add the test.
"The DEBUG.md is just for debugging, I'll delete it"Keep it. Future-you debugging the same area will thank present-you.
"All hypotheses failed, I'm stuck"Go back to Observe. You missed something. The bug exists, therefore a cause exists.

The Anti-Bulldozer Rule

The #1 failure mode of AI debugging: the agent forms a theory, writes 150 lines of "fix" code, it doesn't work, so it writes another 150 lines going deeper into the same wrong theory.

This skill exists to prevent that. If you catch yourself or the agent:

  • Writing more than 5 lines before confirming a hypothesis → STOP. Back to Phase 2.
  • Trying the same approach a second time → STOP. The hypothesis is rejected. Next one.
  • Ignoring conflicting evidence → STOP. Write it down. Re-rank hypotheses.
  • Feeling "almost there" after 3 failed attempts → STOP. You are bulldozing.

Write it down. Test it. Prove it. Then fix it.

Câu hỏi thường gặp

Kỹ năng AI Debug Hypothesis làm được gì?

Use when debugging any non-trivial bug — wrong output, crash, flaky test, performance regression, or "it works locally but not in CI." Forces a scientific-method loop (Observe → Hypothesize → Experiment → Conclude) so the agent stops guessing and starts reasoning. Prevents the

Vì sao nên dùng Debug Hypothesis trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Debug Hypothesis là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Debug Hypothesis trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/LichAmnesia/lich-skills/tree/main/skills/debug-hypothesis. TypingMind đọc tệp SKILL.md và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Debug Hypothesis?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Debug Hypothesis với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Debug Hypothesis với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Debug Hypothesis có miễn phí không?

Có. Kỹ năng này được LichAmnesia phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇