Skip to content
rtk-ai avatar

Rtk Tdd

Enforces Red-Green-Refactor TDD for Rust, with idiomatic test patterns and a strict pre-commit gate.

CCM score
67 of 100
skills.sh installs
2.4K
GitHub stars
88.2K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers the cycle of writing a failing test, implementing the minimum to pass, then refactoring while staying green
  • Includes test patterns by code type (pure functions, parsing, validation, error handling, roundtrips) and a test_{function}_{scenario} naming convention
  • Enforces a failing-test check before any production code and a cargo fmt --check, cargo clippy --all-targets, and cargo test gate
  • Designed for Rust implementation, testing, refactoring, and bug-fixing tasks, with guidance on when pure TDD does not apply

Install

$ npx -y skills add rtk-ai/rtk --skill rtk-tdd -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Rust TDD Workflow

Three Laws of TDD

  1. Do NOT write production code without a failing test
  2. Write only enough test to fail (including compilation failure)
  3. 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

Details

Repository
github.com/rtk-ai/rtk
Categories
Testing & QA, Rust
First seen
Jun 3, 2026

Questions

What does the rtk-tdd skill do?

The rtk-tdd skill enforces Red-Green-Refactor test-driven development for Rust work. It auto-triggers on implementation, testing, refactoring and bug fixing tasks, and guides the agent with Rust-idiomatic patterns using anyhow and thiserror, cfg(test) modules and an Arrange-Act-Assert workflow.

Where does rtk-tdd stand in the Testing & QA category?

The rtk-tdd skill sits in the Testing & QA category on Claude Marketplaces, alongside tdd, migrate-to-shoehorn, test-driven-development, webapp-testing and break-ui. It differs from those by focusing on Rust code, with cargo test, cargo fmt and cargo clippy as its pre-commit gate.

How do I install the rtk-tdd skill?

Run npx -y skills add rtk-ai/rtk --skill rtk-tdd -y in your project to install it. After that, the agent follows the Three Laws of TDD on Rust tasks, writing a failing test before any production code.

Who is rtk-tdd for?

The rtk-tdd skill is for developers writing Rust who want tests written first. It covers pure functions, parsing, validation, error handling and struct roundtrips, and says when pure TDD does not fit, such as code that calls Command::new or performs direct I/O.

More from rtk-ai/rtk

All 7

Similar to Rtk Tdd

More Testing & QA