---
title: "The TDD loop"
description: "Red, green, refactor — one behaviour at a time, cases from the scenarios and ZOMBIES."
canonical_url: "https://razcue-agent-kit.vercel.app/en/guides/tdd-loop"
---
# The TDD loop

> Red, green, refactor — one behaviour at a time, cases from the scenarios and ZOMBIES.

In SDD + TDD projects the `tdd` skill drives every behaviour change:

1. **List the cases** — the scenarios being implemented (each already tagged with a ZOMBIES category), then extra unit cases with ZOMBIES. Write the test names first, simplest first.
2. **Red** — write one test, run it, confirm it fails for the expected reason (the assertion, not an import error).
3. **Green** — the smallest change that passes.
4. **Refactor** — only on green, then run again.
5. **Next case.** A bug fix starts with a test that reproduces it.

```bash [Terminal]
npx @razcue/agent-kit tdd status        # changed logic files and their tests (✗ no test = to do)
npx @razcue/agent-kit tdd run           # only the tests related to your changes; --all for the suite
```

`agent-kit tdd run` prints the exit code and the failures; the full log goes to `.agent-kit/runs/`. Test names read as rules and start with the scenario id they prove. Never weaken, skip or delete a test to get to green.


## Sitemap

See the full [sitemap](https://razcue-agent-kit.vercel.app/sitemap.md) for all pages.
