SKILL.md
TDD playbook
HARD-GATE
- No implementation until a test exists, was run, and failed because behaviour is missing (not because of compile noise you have not fixed in the test).
- Implementation waits for explicit user approval.
- Quality gate before you call it done — same commands as
docs/skill-authoring.md:cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo test.
When to use
New or changed behaviour in a Rust crate. Prefer unit tests next to the module; tests/ only for public-API contracts.
Loads
| Skill | Role |
|---|---|
load-context |
existing crates |
rust-essentials |
apply docs/fcis-rust.md |
Phases
- Context + RED —
load-contextif the crate exists. Write the smallest failing test. Runcargo test <test_name> -- --exact. - HITL + GREEN — show the test + failure. Wait. Implement only what was approved. Re-run until green.
- Refactor — behaviour unchanged; re-run after each step.
- Quality — fmt, clippy
-D warnings,cargo testfor the crate.
Validation
- RED: failure is missing behaviour
- User said to implement
- GREEN on the target test
- fmt/clippy/test exit 0
Error recovery
| Problem | Action |
|---|---|
| Test does not compile | fix the test; stay in RED |
| Still red after impl | smallest fix; re-approve if the approach changed |
| Refactor red | revert last step |
| Clippy red | fix; do not #[allow] to skip the gate |
Output
## TDD Report
**Behaviour:** …
**Test:** `path` / `test_name`
**RED:** command + reason
**Approval:** yes/no
**GREEN:** command
**Quality:** fmt / clippy / test
**Skipped (ponytail):** …
Integration
Atomics during GREEN: type-driven-design, error-handling, ownership-borrowing as needed. Do not skip rust-essentials.