rust-tddlisted
Install: claude install-skill po4yka/rust-skills
# Rust TDD
## Purpose
This skill is **rigid**. Follow every step exactly. Do not skip RED. Do not write
implementation before a failing test exists.
The value of TDD is not the test file. The value is that the test failed first, for the
reason you predicted. A test written after the implementation only proves that the code
does what the code does.
## The cycle
Repeat this cycle for every behavior change:
1. **RED** — Write exactly one failing test. Run it. Confirm that it fails, and that it
fails for the expected reason. A compile error is not a valid RED. Make the test
compile, then let the assertion fail.
2. **GREEN** — Write the minimum implementation that makes the test pass. Run the test
again. Do not add code that no test requires.
3. **REFACTOR** — Clean up the test and the implementation. Run the crate tests to confirm
that nothing broke.
4. **LINT** — Run the format and lint gate before you call the cycle complete.
```bash
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
```
`--all-targets` includes tests, benches, and examples. The lint gate applies to test code
too. See the `rust-lints` skill for the lint set and for allow-with-reason policy.
Never batch multiple behaviors into one cycle. One test, one behavior, one cycle.
### RED is a prediction, not a formality
Before you run the failing test, write down the expected failure in one sentence: which
assertion fails, and with which value.