Test-first build loop (TDD) - write a failing test, SEE it fail for the right reason (red), write minimal code to pass (green), refactor only when green. One behavior at a time, vertical slices, tested through the public interface. For building a feature with >=2 behaviors or a bug fix that needs a regression guard. Writes the test AND the minimal impl, runs the repo's test command each cycle. Python (pytest) and TypeScript/JavaScript (mocha, jest, vitest).
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Bonfire?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/sgtlaugh-bonfire)
---
name: bonfire
description: Test-first build loop (TDD) - write a failing test, SEE it fail for the right reason (red), write minimal code to pass (green), refactor only when green. One behavior at a time, vertical slices, tested through the public interface. For building a feature with >=2 behaviors or a bug fix that needs a regression guard. Writes the test AND the minimal impl, runs the repo's test command each cycle. Python (pytest) and TypeScript/JavaScript (mocha, jest, vitest).
allowed-tools: Read, Write, Edit, Grep, Glob, AskUserQuestion, Bash(pytest:*), Bash(python -m pytest:*), Bash(python3 -m pytest:*), Bash(npx mocha:*), Bash(npx jest:*), Bash(npx vitest:*), Bash(npm test:*), Bash(yarn test:*), Bash(git log:*), Bash(git show:*), Bash(git diff:*), Bash(git add:*), Bash(git commit:*)
---
# /bonfire - die, rest at the bonfire, venture again
The TDD loop *is* the Dark Souls loop: **red** (the flame's out - your test fails), **green** (🔥 bonfire lit - it passes), then venture on. You only **refactor at the bonfire** (when green). bonfire writes the failing test, proves it fails for the right reason, writes the minimal code to pass, and repeats - **one behavior at a time.**
**Why it exists.** "Write me some tests" gives you tests that pass *now* - but you never saw them **fail**, so you don't know they catch anything (a test with a broken fixture passes green and guards nothing). bonfire's whole value is the **red step**: a test proven to fail on the real behavior *before* the code exists is a test you can trust. Plus it stops the two classic failures - writing all tests up front against an imagined shape (crap tests), and gold-plating past what the current test needs.
**Honest ceiling - read this.** Red→green proves each test **catches its behavior** and the code is **minimal** - NOT that *untested* behaviors work, nor that the **design** is right, nor that it's bug-free (that's `/aristarchus`/`/darkmoon`). You can't test everything; test the critical paths and **name what you skipped**. A lit bonfire means *this* test passes - not that the dark is gone.
## Usage
```
/bonfire <feature or bug to build, test-first> # leaves the work uncommitted for you to review
/bonfire <feature or bug to build, test-first> --commit # also commits each cycle as it goes green
```
bonfire writes BOTH the test and the minimal impl (you review). `--commit` is your word to commit, for this run only; a caller passes it on for you (`/ludleth --commit` or `--pr`). Python (pytest) and TypeScript/JavaScript (mocha, jest, vitest); other stacks get the same loop with the repo's own runner, which isn't pre-approved.
## When to fire it (proportional - don't TDD a typo)
- **Use it:** a feature with **>=2 behaviors**, or a **bug fix** that deserves a regression guard (write the failing repro first).
- **Skip it:** a one-line/trivial change, pure exploration, config, or skill-authoring. Rigor scaled to the work.
## Phase 0 - Plan (proportional gate)
- Name the **public interface** the work needs (the function/method/endpoint callers use), and **list the behaviors** to test, **prioritized** - plus what you are **NOT** testing (you can't test everything).
- Read the repo's **`CLAUDE.md`** + the **existing tests** in the target area so test names + style match the project (not a separate glossary - use what the repo has).
- **Find the test commands before the first test:** the focused form (one test or one directory) for every red and green, and the suite form for the end. Take them from `CLAUDE.md`, then `package.json` scripts, `pytest.ini`/`pyproject.toml`, or the CI workflow - never assume `npm test` or bare `pytest`. A documented command that fails on setup (a missing token, a service that isn't running) is fixed or swapped for the runner it wraps, before any red counts.
- Name the interface you'll test through: a small interface, tests *through* the seam, mocks at seams, never internals.
- **Gate (proportional):** for a multi-behavior **feature**, state the plan and **confirm with the user before writing tests** (`AskUserQuestion`, interface + behavior list). For a **single bug-fix-with-regression-test**, just proceed.
## Phase 1 - Tracer bullet (first behavior, end-to-end)
Write **ONE** test for the first/most-central behavior, through the **public interface**, asserting **observable behavior** (return value, persisted state, a call made/not made) - never internal/private state.
- **RED:** run just that test with the repo's focused command - `pytest path::Test::test_name`, `npx vitest run path -t "name"`, `npx jest path -t "name"`, `npx mocha path --grep "name"`, or the containerized or wrapped form its `CLAUDE.md` documents (e.g. `docker exec <service> py.test path::test_name`, a runner that only takes a directory). It **must fail** - and on the **asserted behavior**, shown in the output. If it fails on an **import/syntax/fixture error, that is a FAKE red** - fix the *test/setup*, not the code, until the failure is the real behavior. In TypeScript the fake reds are a type error (`TS2304`, `TS2339`...), `Cannot find module`, and a stub that throws: none of them is the assertion failing. If the public interface doesn't exist yet, add a signature-only stub (returns `None`, or in TypeScript a wrong value of the declared type - never a `throw`) as setup; the red must then fail on the assertion. The stub is not the impl. (A green you never earned through a real red is unverified.)
- **Green on the first run?** The test is wrong or the behavior already exists. Break the impl on purpose and watch it go red for the right reason, or drop the test as redundant. Never keep a test you haven't seen fail.
- **GREEN:** write the **minimal** code to pass *this* test - nothing for future tests (`occam`: no speculative features). Run → 🔥 green.
## Phase 2 - Incremental loop (one behavior at a time)
For each remaining behavior: **RED → GREEN**, one at a time.
- **Vertical slices only.** Writing the next test before the current one is green is an **invalid stop** - no "all tests, then all code" (horizontal slicing breeds tests of imagined behavior).
- Each test responds to what the last cycle taught you - that's why they're written one at a time, not in bulk.
## Phase 3 - Refactor (only at the bonfire)
**Only when all tests are green** (never while red): extract duplication, deepen modules, apply judgment. **Re-run the tests after each refactor step** - they must stay green. A test that breaks on an internal refactor *with behavior unchanged* was testing implementation - rewrite it to the public interface.
## Committing - only with `--commit`
Each behavior is one commit, made the moment its cycle goes green, while its files hold only that behavior: two cycles that touch the same file can't be pulled apart afterwards.
- **After each GREEN:** stage that cycle's test and code by path (`git add <paths>`, never `-A` or `.`), and commit them together with a subject naming the behavior in the repo's convention (its `CLAUDE.md`, recent `git log`): `feat: <behavior>` for a new one, `fix: <bug>` for a bug's regression cycle. A test never goes in a commit apart from the code it covers.
- **Phase 3 refactor:** its own `refactor:` commit, once the re-run is green.
- **A hook that blocks a commit stops the run:** leave the work as it is and name the hook. bonfire never amends, rewrites or pushes a commit.
## Output contract (show the work - a claim of "passes" without the red is invalid)
A bonfire run is complete only when:
1. The **plan** was stated: interface + prioritized behaviors + the **skip-list** (what's not tested).
2. **Each cycle shows: the test (behavior-named) → the RED run output (failing on the real behavior) → the minimal impl → the GREEN run output.** Red-then-green is shown, not asserted - "tests pass" without the prior red is not a valid bonfire cycle.
3. Behaviors were taken **one at a time** (no bulk-test-then-bulk-impl).
4. Refactor (if any) happened **green-only**, with tests re-run.
5. A **coverage line** names the behaviors tested vs deliberately skipped.
6. The **existing suite** was run green at the end (the affected test directory, or all of it if it's fast), output shown. A minimal change that breaks another test isn't done.
7. With `--commit`, each cycle names its commit (short sha and subject), and `git log --oneline <start>..` closes the run, `<start>` being the `git rev-parse --short HEAD` taken before the first test.
## Guard rails
- **Real red or it doesn't count.** A test must be seen failing **on its asserted behavior** before the impl or fix exists; a failure from a setup/import error is a fake red - fix the test first. Skipping the red (test written after the code, or never run red) is the cardinal sin.
- **One behavior at a time.** Vertical tracer bullets, never horizontal (all tests up front = tests of imagined behavior).
- **Behavior through the public interface, never internals.** A test that breaks on a behavior-preserving refactor is testing implementation - rewrite it. Don't mock internal collaborators (mock at the seam).
- **Minimal code to pass the current test.** No speculative features (`occam`). Refactor later, at the bonfire.
- **Refactor only when green.** Never restructure while a test is red.
- **Proportional.** Features/bug-fixes earn the full loop; trivial changes don't - don't make TDD into ceremony.
- **Writes code + tests, runs the repo's tests; never pushes, and commits only with `--commit`.** Without it you review and commit. (Run via the repo's documented test command and interpreter, per its `CLAUDE.md`. A containerized or env-prefixed runner like `docker exec` isn't pre-approved, so it asks first.)
- **Not correctness, not design.** Proves tests catch their behavior + minimal code; bugs in untested paths still ship (`/aristarchus`), and design shape is a separate judgment.