rtk-tdd
rtk-tdd enforces the red-green-refactor cycle for Rust development, automatically guiding you through failing tests, minimal implementations, and refactoring phases. It provides Rust-idiomatic testing patterns using anyhow/thiserror, cfg(test) modules, and Arrange-Act-Assert workflows, with pre-commit gates ensuring code quality.
rtk-tdd enforces test-driven development for Rust projects using red-green-refactor cycles and idiomatic testing patterns.
AI-generated summary based on this skill's SKILL.md
Decision gist · record as of 2026-07-27
rtk-tdd enforces test-driven development for Rust projects using red-green-refactor cycles and idiomatic testing patterns. rtk-tdd enforces the red-green-refactor cycle for Rust development, automatically guiding you through failing tests, minimal implementations, and refactoring phases. It provides Rust-idiomatic testing patterns using anyhow/thiserror, cfg(test) modules, and Arrange-Act-Assert workflows, with pre-commit gates ensuring code quality.
Use it when
- rtk-tdd teaches you to write failing tests before implementation using Rust-idiomatic patterns.
- rtk-tdd provides Rust-idiomatic testing patterns including cfg(test) module setup, Arrange-Act-Assert workflows.
Verify before relying
Read SKILL.md below before installing (2 files). Open directory: indexed for reading, not audited.
Install
rtk-ai/rtk/rtk-tdd · repository language: Rust
Open directory. Skills are indexed for reading, not audited. Review a skill's body before installing it.
Frequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
What is rtk-tdd and how does it enforce test-driven development?
rtk-tdd is an Apache-2.0 licensed skill that enforces the red-green-refactor cycle for Rust development. It automatically guides you through failing tests, minimal implementations, and refactoring phases, ensuring TDD discipline throughout your Rust projects while maintaining idiomatic patterns.
How do I write rust tests first in the rtk-tdd workflow?
rtk-tdd teaches you to write failing tests before implementation using Rust-idiomatic patterns. Start with Arrange-Act-Assert structure in cfg(test) modules, use anyhow/thiserror for error handling tests, and follow rtk-tdd's guidance through the red phase (failing test), green phase (minimal implementation), and refactor phase.
What rust testing patterns does rtk-tdd recommend?
rtk-tdd provides Rust-idiomatic testing patterns including cfg(test) module setup, Arrange-Act-Assert workflows, proper test naming conventions, and error handling patterns using anyhow/thiserror. It covers unit test organization, edge case testing, and bug-fix TDD approaches aligned with Rust best practices.
How does rtk-tdd implement the red-green-refactor cycle?
rtk-tdd automates the red-green-refactor methodology by guiding you to write failing tests first, then implement minimal code to pass them, then refactor safely. It integrates with cargo test automation to validate each phase and ensures you follow this cycle consistently across your Rust projects.
Can rtk-tdd set up pre-commit quality gates for my Rust code?
Yes, rtk-tdd supports pre-commit quality gates to enforce code quality in Rust projects. These gates ensure tests pass, code follows idiomatic patterns, and TDD discipline is maintained before commits, helping your team maintain consistent testing standards.
What cargo automation does rtk-tdd provide for testing workflows?
rtk-tdd integrates cargo test automation into your TDD workflow, automating test execution across the red-green-refactor cycle. It helps you structure tests properly, organize test modules with cfg(test), and maintain efficient cargo-based testing practices throughout development.
SKILL.md
Rendered from the published skill. Quoted content, verbatim.
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
(truncated - see the full file via the links below)
File tree — 2 files
.claude/skills/rtk-tdd/SKILL.md
.claude/skills/rtk-tdd/references/testing-patterns.md
Let your AI agent find skills like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 56,283 agent skills by what they can do, searchable in plain language.
wish › “Enforce test-driven development workflow for Rust projects”
Give your agent the search over MCP, or paste the wish link into any chat. No install? Search from any chat →
Related skills
tdd-rust guides you through test-driven filter implementation for RTK using the Red-Green-Refactor cycle. Start with real command output fixtures, write failing tests that verify both output format and ≥60% token reduction, then implement the minimum code to pass. Lock output format with snapshot tests and integrate into your CLI.
Ship orchestrates the full release cycle for RTK projects: quality verification, semantic versioning, changelog generation, git tagging, and remote push to activate CI/CD pipelines. Follow pre-release checklists, execute the multi-step workflow, and verify post-release artifacts automatically.
tdd guides you through strict test-driven development using the red-green-refactor cycle: write a failing test, implement minimal code to pass it, then refactor. The skill enforces the discipline of writing tests before production code and provides framework-specific commands for multiple languages.
Rtk helps you set up and troubleshoot Rust Token Killer, a CLI tool that rewrites shell commands into token-efficient versions for AI agents. Install via Homebrew, script, or Cargo, then initialize RTK for your specific agent—Claude Code, Codex, Gemini CLI, Cursor, Copilot, Windsurf, Cline, or OpenCode. Use direct `rtk` commands like `rtk git status` or `rtk read` when automatic hooks aren't available.
RTK Optimizer detects high-verbosity shell commands and suggests RTK wrappers to dramatically reduce token usage—achieving up to 92% savings on git log, 90% on cargo test and pytest, and similar gains across build tools and package managers. The skill automatically proposes optimizations when it spots commands like git diff, find, or test frameworks, then executes the wrapped version to preserve context window space.
This skill covers seven Rust design patterns applied to RTK's CLI filter architecture, from type-safe wrappers and configuration builders to stateful parsers and resource management. Each pattern includes practical examples showing when to use it, when to skip it, and how it fits RTK's single-threaded, zero-overhead design philosophy.
More skills Tdd Workflow (MIT) · testing-strategy (MIT) · test-driven-development (MIT) · tdd (MIT) · agf-running-sit-tests (MIT) · Test Driven Development (unlicensed) · Tdd (unlicensed) · agf-running-apple-sit (MIT)