rtk-tdd

Enforce the TDD Red-Green-Refactor cycle for Rust development with cargo fmt, clippy, and test.

75.3k|4.7k|Updated Jan 22, 2026
One-click install
npx skills add https://github.com/rtk-ai/rtk --skill rtk-tdd-rtk-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rtk-tdd
Source: https://github.com/rtk-ai/rtk/tree/main/.claude/skills/rtk-tdd
Command: npx skills add https://github.com/rtk-ai/rtk --skill rtk-tdd-rtk-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill enforces the Test-Driven Development (TDD) methodology for Rust projects, ensuring code quality and maintainability by guiding developers through the Red-Green-Refactor cycle.

Core Features & Use Cases

  • TDD Enforcement: Guides developers through writing failing tests before implementation.
  • Idiomatic Rust Testing: Promotes Rust-specific testing patterns like #[cfg(test)], Result<()>, and #[should_panic].
  • Use Case: When starting a new feature in a Rust project, use this Skill to ensure all new code is written with comprehensive, passing tests from the outset.

Quick Start

Follow the Red-Green-Refactor steps to write a new test for the module_name function.

Frequently Asked Questions about rtk-tdd

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce a Test-Driven Development workflow in Rust?

To enforce a Test-Driven Development workflow in Rust, follow the Red-Green-Refactor cycle by writing failing tests first, implementing code to pass them, and then refactoring. This ensures code quality through structured, iterative testing.

What are the best ways to write idiomatic Rust tests for error paths?

The best way to write idiomatic Rust tests for error paths is using patterns like `#[should_panic]` and returning `Result<()>` from test functions. This approach aligns with the Red-Green-Refactor cycle to validate failures effectively.

How do I set up pre-commit gates for Rust code quality?

To set up pre-commit gates for Rust code quality, configure your workflow to run `cargo fmt`, `cargo clippy`, and `cargo test` before commits are accepted. This ensures all code meets formatting and linting standards with passing tests.

Does Test-Driven Development work well with Rust refactoring?

Test-Driven Development works exceptionally well with Rust refactoring because the Red-Green-Refactor cycle ensures you have comprehensive, passing tests before you refactor. This minimizes regressions and maintains code quality throughout the developer workflow.

When do I need to use `#[should_panic]` in Rust testing?

You need to use `#[should_panic]` in Rust testing when verifying that a specific function or code path correctly panics under invalid conditions. It is a core idiomatic pattern for testing error paths within the TDD workflow.