Skip to content
rtk-ai avatar

Tdd Rust

Test-driven workflow for building RTK output filters in Rust, with real fixtures and enforced token-savings checks.

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

Own this skill? Claim it

What it does

  • Covers the Red-Green-Refactor loop plus savings verification and snapshot locking for each new command filter
  • Includes real-fixture capture steps, Arrange-Act-Assert examples, ANSI-stripping and fallback test patterns, and a quality gate
  • Enforces at least 20% token reduction, no panics on empty or malformed input, and no synthetic test data
  • Designed for developers adding new filters to RTK and auto-triggers on requests like "new filter" or "write tests for"

Install

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

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

Files

RTK TDD Workflow

Enforce Red-Green-Refactor for all RTK filter development.

The Loop

1. RED   — Write failing test with real fixture
2. GREEN — Implement minimum code to pass
3. REFACTOR — Clean up, verify still passing
4. SAVINGS — Verify ≥20% token reduction
5. SNAPSHOT — Lock output format with insta

Step 1: Real Fixture First

Never write synthetic test data. Capture real command output:

# Capture real output from the actual command
git log -20 > tests/fixtures/git_log_raw.txt
cargo test 2>&1 > tests/fixtures/cargo_test_raw.txt
cargo clippy 2>&1 > tests/fixtures/cargo_clippy_raw.txt
gh pr view 42 > tests/fixtures/gh_pr_view_raw.txt

# For commands with ANSI codes — capture as-is
script -q /dev/null cargo test 2>&1 > tests/fixtures/cargo_test_ansi_raw.txt

Fixture naming: tests/fixtures/<command>_raw.txt

Step 2: Write the Test (Red)

#[cfg(test)]
mod tests {
    use super::*;
    use insta::assert_snapshot;

    fn count_tokens(s: &str) -> usize {
        s.split_whitespace().count()
    }

Details

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

Questions

What does the tdd-rust skill do?

The tdd-rust skill enforces a Red-Green-Refactor workflow for developing RTK filters in Rust. It guides writing failing tests with real command fixtures, verifying at least 20% token savings, and locking output format with insta snapshot tests.

How do I install the tdd-rust skill?

Run npx -y skills add rtk-ai/rtk --skill tdd-rust -y in your project. After that, the agent can follow the RTK test-driven workflow for new filter implementations.

Where does tdd-rust rank among Rust skills?

The tdd-rust skill ranks in the top 50 of the Rust category on Claude Marketplaces. It differs from related skills like rust-testing by being tailored to RTK filter development, with real fixtures and token savings assertions.

Does tdd-rust need any special tools or setup?

The skill works with Read, Write, Edit and Bash tools and uses cargo, cargo insta and clippy for its quality gate. It assumes you are working in the RTK codebase with real command output available to capture as fixtures.

More from rtk-ai/rtk

All 7

Similar to Tdd Rust

More Rust