rtk-ai avatar

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-code

Installs into .claude/skills of the current project.

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

Sponsors

Details

Repository
github.com/rtk-ai/rtk
Categories
Testing & QA, Code Review & Quality, Debugging, Automation & Workflows, Rust
First seen
Jun 3, 2026

More from rtk-ai/rtk

All 7
1daymade avatarqa-expertdaymade/claude-code-skillsThis skill should be used when establishing comprehensive QA testing processes for any software project. Use when creating test strategies, writing test cases f2Kskills.sh installs
2jezweb avatarvitestjezweb/claude-skillsSet up Vitest testing in any project — detects type (Cloudflare Workers, React, Node, library), generates vitest.config.ts, test setup, utilities, and a sample 1.8Kskills.sh installs
3github avatarplanning-oracle-to-postgres-migration-integration-testinggithub/awesome-copilotCreates an integration testing plan for .NET data access artifacts during Oracle-to-PostgreSQL database migrations. Analyzes a single project to identify reposi1.8Kskills.sh installs
4alirezarezvani avatarcoveragealirezarezvani/claude-skillsAnalyze test coverage gaps. Use when user says "test coverage", "what's not tested", "coverage gaps", "missing tests", "coverage report", or "what needs testing1.7Kskills.sh installs
5adobe avatartesting-blocksadobe/skillsUse this when you have made AEM Edge Delivery Services code changes to blocks, scripts, or styles and need to validate them before opening a pull request. Cover1.6Kskills.sh installs
6madteacher avatarflutter-testingmadteacher/mad-agents-skillsWrite, fix, review, debug, and validate Flutter tests for apps, packages, and plugins. Use when adding unit tests, widget tests, integration tests, MethodChanne1.5Kskills.sh installs