# Debug hypothesis

> Debug hypothesis is an open-source agent skill for developer tools. Guides an agent through a hypothesis-driven loop for hard-to-find bugs. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/LichAmnesia/lich-skills/tree/main/skills/debug-hypothesis
- **Repository:** https://github.com/lichamnesia/lich-skills
- **GitHub stars:** 233
- **License:** MIT
- **Skill name:** debug-hypothesis
- **Collection:** https://github.com/LichAmnesia/lich-skills
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

This skill sets up a four-phase debugging method for non-trivial bugs: observe the symptoms and reproduce them, form several candidate causes, run one small falsifying experiment at a time, and only then write a fix. The agent is told to record its reasoning in a DEBUG.md file so the investigation trail survives context compaction.

The skill includes hard rules that stop the agent from writing fix code before a hypothesis is supported, limit each experiment to five changed lines, and require reverting diagnostic code after each test. Each phase has exit criteria and a table of common excuses for skipping steps, which the agent is expected to check against.

No scripts are included; the skill is a single SKILL.md with instructions only, so it expects the agent to have access to the codebase, the ability to run the reproduction, and a way to write files.

## When your agent uses it

> 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

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/LichAmnesia/lich-skills/tree/HEAD/skills/debug-hypothesis)
- [License: MIT](https://github.com/LichAmnesia/lich-skills/tree/HEAD/skills/debug-hypothesis)

## Features

- **Four-phase debug loop:** Walks the agent through observe, hypothesize, experiment and conclude in order.
- **Hypothesis ranking:** Requires three to five candidate causes, each with supporting and conflicting evidence.
- **Minimal experiments:** Limits each test to one variable and at most five changed lines of diagnostic code.
- **DEBUG.md investigation log:** Keeps observations, hypotheses, experiments and root cause in a persistent file.
- **Regression test requirement:** Requires a failing-then-passing regression test alongside the confirmed fix.
- **Anti-bulldozer checks:** Lists warning signs that the agent is pushing a wrong theory with repeated fixes.

## Good for

- Track down a flaky test that fails only sometimes
- Investigate a performance regression with no obvious cause
- Find why code works locally but fails in CI
- Diagnose a crash after a previous fix did not hold
- Work out why an API returns wrong output for some inputs

## Install

### Claude Code

This skill ships in the `lich-skills` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add LichAmnesia/lich-skills
/plugin install lich-skills@lich-skills
```

Or copy only this skill to `~/.claude/skills/debug-hypothesis`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/debug-hypothesis &&
cp -R "$tmp/skills/debug-hypothesis" ~/.claude/skills/debug-hypothesis &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/debug-hypothesis` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/debug-hypothesis` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/debug-hypothesis &&
cp -R "$tmp/skills/debug-hypothesis" ~/.agents/skills/debug-hypothesis &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/debug-hypothesis` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/debug-hypothesis` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/debug-hypothesis &&
cp -R "$tmp/skills/debug-hypothesis" ~/.cursor/skills/debug-hypothesis &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/debug-hypothesis` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/LichAmnesia/lich-skills.git --path skills/debug-hypothesis
```

Or copy the folder to `~/.gemini/skills/debug-hypothesis` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/debug-hypothesis`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/debug-hypothesis &&
cp -R "$tmp/skills/debug-hypothesis" ~/.copilot/skills/debug-hypothesis &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/debug-hypothesis` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/LichAmnesia/lich-skills.git
```

Then copy `lich-skills/skills/debug-hypothesis` into your agent's skills folder as `debug-hypothesis`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When should I not use Debug hypothesis?

The skill says not to use it for typos, missing imports, syntax errors, build failures with an obvious single-line cause, compiler or linter messages that point to the problem, or when the root cause is already known and only the fix is needed.

### Does Debug hypothesis change my code?

It asks the agent to write only diagnostic code such as logs, assertions or hardcoded values during experiments, revert it afterwards, and write production fix code only after the root cause is confirmed.

### Where does the investigation get recorded?

Everything is written to a DEBUG.md file, with sections for observations, hypotheses, experiments, root cause and fix.

### Does Debug hypothesis need any scripts or extra tools?

No scripts are included and no allowed tools are set. The instructions assume the agent can reproduce the bug, edit files and run tests.

### How do I install Debug hypothesis in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/debug-hypothesis to use it in all your projects, or to .claude/skills/debug-hypothesis in one project. Or install the lich-skills plugin, which includes it: /plugin marketplace add LichAmnesia/lich-skills, then /plugin install lich-skills@lich-skills.

### Does Debug hypothesis run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Debug hypothesis?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Debug hypothesis?

The closest alternatives to Debug hypothesis are Diagnostic reasoning, Interactive debugging, Diagnosing bugs, Principle fix root causes and Debug.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Diagnostic reasoning](https://ai-powered.com/skills/diagnostic-reasoning): Diagnostic reasoning is an open-source agent skill for developer tools.
- [Interactive debugging](https://ai-powered.com/skills/interactive-debugging): Interactive debugging is an open-source agent skill for developer tools.
- [Diagnosing bugs](https://ai-powered.com/skills/diagnosing-bugs): Diagnosing bugs is an open-source agent skill for developer tools.
- [Principle fix root causes](https://ai-powered.com/skills/principle-fix-root-causes): Principle fix root causes is an open-source agent skill for developer tools.
- [Debug](https://ai-powered.com/skills/debug-jasgujral): Debug is an open-source agent skill for developer tools.
- [Bug fix](https://ai-powered.com/skills/bug-fix): Bug fix is an open-source agent skill for developer tools.
- [Agent introspection debugging](https://ai-powered.com/skills/agent-introspection-debugging): Agent introspection debugging is an open-source agent skill for developer tools.
- [TDD](https://ai-powered.com/skills/tdd-michael-denyer): TDD is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/debug-hypothesis
