
Rtk Tdd
This enforces strict test-driven development for Rust projects, meaning you literally cannot write production code without a failing test first. It walks you through red-green-refactor cycles with concrete patterns: arrange-act-assert structure, cfg(test) modules in the same file, and idiomatic assertions like is_err() for error paths. The pre-commit gate (fmt, clippy, test) is non-negotiable. It's opinionated about when NOT to use pure TDD too, like skipping Command::new() execution tests in favor of testing parsers. If you're serious about TDD discipline in Rust and want guardrails that prevent shortcuts, this keeps you honest. The three laws are actually enforced, not suggested.
- skills.sh installs
- 2.2K
- GitHub stars
- 86K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add rtk-ai/rtk --skill rtk-tdd --agent claude-codeInstalls into .claude/skills of the current project.
Files
Rust TDD Workflow
Three Laws of TDD
- Do NOT write production code without a failing test
- Write only enough test to fail (including compilation failure)
- Write only enough production code to pass the failing test
Cycle: RED (test fails) -> GREEN (minimum to pass) -> REFACTOR (cleanup, cargo test)
Red-Green-Refactor Steps
1. Write test in #[cfg(test)] mod tests of the SAME file
2. cargo test MODULE::tests::test_name -- must FAIL (red)
3. Implement the minimum in the function
4. cargo test MODULE::tests::test_name -- must PASS (green)
5. Refactor if needed, re-run cargo test (still green)
6. cargo fmt && cargo clippy --all-targets && cargo test (final gate)
Never skip step 2. If the test passes immediately, it tests nothing.
Idiomatic Rust Test Patterns
Sponsors
Details
- Repository
- github.com/rtk-ai/rtk
- Categories
- Testing & QA, Code Review & Quality, Debugging, Automation & Workflows, Rust
- First seen
- Jun 3, 2026