Rust Testing
kurealnum/dotfiles
Rust testing patterns including unit tests, integration tests, async testing, property-based testing, mocking, and coverage.
Enforces red-green-refactor for Rust work, with idiomatic test patterns, a naming convention and a pre-commit gate of cargo fmt, clippy and test.
$ npx skills add rtk-ai/rtk --skill rtk-tdd -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install rtk-ai/rtk rtk-tdd --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/rtk-ai/rtk.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/rtk-tdd .claude/skills/rtk-tdd && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "rtk-tdd" agent skill from https://github.com/rtk-ai/rtk/tree/develop/.claude/skills/rtk-tdd into .claude/skills/rtk-tdd/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "rtk-tdd", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/rtk-ai/rtk/tree/develop/.claude/skills/rtk-tddType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add rtk-ai/rtk --skill rtk-tdd -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install rtk-ai/rtk rtk-tdd --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rtk-ai/rtk.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.claude/skills/rtk-tdd .agents/skills/rtk-tdd && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "rtk-tdd" agent skill from https://github.com/rtk-ai/rtk/tree/develop/.claude/skills/rtk-tdd into .agents/skills/rtk-tdd/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "rtk-tdd", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add rtk-ai/rtk --skill rtk-tdd -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install rtk-ai/rtk rtk-tdd --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rtk-ai/rtk.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.claude/skills/rtk-tdd .cursor/skills/rtk-tdd && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "rtk-tdd" agent skill from https://github.com/rtk-ai/rtk/tree/develop/.claude/skills/rtk-tdd into .cursor/skills/rtk-tdd/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "rtk-tdd", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/rtk-ai/rtk.git --path .claude/skills/rtk-tdd--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add rtk-ai/rtk --skill rtk-tdd -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install rtk-ai/rtk rtk-tdd --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rtk-ai/rtk.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.claude/skills/rtk-tdd .gemini/skills/rtk-tdd && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "rtk-tdd" agent skill from https://github.com/rtk-ai/rtk/tree/develop/.claude/skills/rtk-tdd into .gemini/skills/rtk-tdd/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "rtk-tdd", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install rtk-ai/rtk rtk-tddInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add rtk-ai/rtk --skill rtk-tdd -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/rtk-ai/rtk.git skills-src && mkdir -p .github/skills && cp -r skills-src/.claude/skills/rtk-tdd .github/skills/rtk-tdd && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "rtk-tdd" agent skill from https://github.com/rtk-ai/rtk/tree/develop/.claude/skills/rtk-tdd into .github/skills/rtk-tdd/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "rtk-tdd", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add rtk-ai/rtk --skill rtk-tdd -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install rtk-ai/rtk rtk-tdd --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/rtk-ai/rtk.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.claude/skills/rtk-tdd .opencode/skills/rtk-tdd && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "rtk-tdd" agent skill from https://github.com/rtk-ai/rtk/tree/develop/.claude/skills/rtk-tdd into .opencode/skills/rtk-tdd/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "rtk-tdd", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
rtk-tddEnforces red-green-refactor for Rust work, with idiomatic test patterns, a naming convention and a pre-commit gate of cargo fmt, clippy and test.
The skill applies the three laws of test-driven development to Rust: no production code without a failing test, write only enough test to fail (a compile failure counts), and write only enough production code to pass. Tests go in a cfg(test) module of the same file. The agent runs the specific test and confirms it fails before implementing the minimum, and it never skips that step, because a test that passes at once tests nothing.
A pattern table covers Arrange-Act-Assert, assert_eq and assert, error-path checks with is_err, tests that return Result, should_panic, and tempfile-based tests for filesystem code. A second table maps code types such as pure functions, parsing, validation, error handling and serialization roundtrips to test shapes, and tests are named test_function_scenario. For functions that spawn commands, process exit calls, direct I/O and CLI wiring it suggests testing the parser or the pure logic instead.
Before a commit, cargo fmt --all --check, cargo clippy --all-targets and cargo test must all pass, with no allow attributes unless justified. A testing-patterns reference file is included.
3 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit e4f0509. It shows what the files ask for, not the result of running them.
Pre-approves these tools, so the agent can use them without asking each time:
ReadWriteEditBashFrom allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
cargoFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Rust TDD Workflow loads about 753 tokens when it runs, and up to ~1.6k if it reads all its reference files. Until then it costs about 62 tokens; SKILL.md has 215 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check noted patterns worth knowing about, such as sudo or a known installer.
allowed-tools: Read, Write, Edit, BashAutomated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from rtk-ai/rtk at commit e4f0509, republished under its Apache-2.0 licence (© rtk-ai). 215 words, ~753 tokens.
.claude/skills/rtk-tdd/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.Cycle: RED (test fails) -> GREEN (minimum to pass) -> REFACTOR (cleanup, cargo test)
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.
| Pattern | Usage | When |
|---|---|---|
| Arrange-Act-Assert | Base structure for every test | Always |
assert_eq! / assert! | Direct comparison / booleans | Deterministic values |
assert!(result.is_err()) | Error path testing | Invalid inputs |
Result<()> return type | Tests with ? operator | Fallible functions |
#[should_panic] | Expected panic | Invariants, preconditions |
tempfile::NamedTempFile | File/I/O tests | Filesystem-dependent code |
| Code Type | Test Pattern | Example |
|---|---|---|
| Pure function (str -> str) | Input literal -> assert output | assert_eq!(truncate("hello", 3), "...") |
| Parsing/filtering | Raw string -> filter -> contains/not-contains | assert!(filter(raw).contains("expected")) |
| Validation/security | Boundary inputs -> assert bool | assert!(!is_valid("../etc/passwd")) |
| Error handling | Bad input -> is_err() | assert!(parse("garbage").is_err()) |
| Struct/enum roundtrip | Construct -> serialize -> deserialize -> eq | assert_eq!(from_str(to_str(x)), x) |
test_{function}_{scenario}
test_{function}_{input_type}Examples: test_truncate_edge_case, test_parse_invalid_input, test_filter_empty_string
Command::new() -> test the parser, not the executionstd::process::exit() -> refactor to Result first, then test the Resultcargo fmt --all --check
cargo clippy --all-targets
cargo testAll 3 must pass. No exceptions. No #[allow(...)] without documented justification.
© rtk-ai, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 1 other file (references) in .claude/skills/rtk-tdd of rtk-ai/rtk.
Open the folder on GitHubat commit e4f0509
Rust TDD Workflow next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Rust TDD Workflow this skillrtk-ai/rtk | 83k | — | ~753 | Automated safety check: Notes | Apache-2.0 | |
| Rust Testingkurealnum/dotfiles | 290 | 6 repos | ~2.9k | Automated safety check: Pass | None | |
| MoAI TDD Workflowmodu-ai/moai-adk | 1.2k | — | ~3.1k | Automated safety check: Pass | Apache-2.0 | |
| Test-Driven Development Enforcerzereight/gitlab-mcp | 2k | 1 repos | ~904 | Automated safety check: Pass | MIT | |
| Jest Testing PatternsChrisWiles/claude-code-showcase | 6.1k | 7 repos | ~1.5k | Automated safety check: Pass | None | |
| TDD WorkflowhellangleZ/burn-in-cceverywhere-ralph | 112 | 11 repos | ~2.4k | Automated safety check: Pass | None |
kurealnum/dotfiles
Rust testing patterns including unit tests, integration tests, async testing, property-based testing, mocking, and coverage.
modu-ai/moai-adk
Drives test-first development through the RED, GREEN, REFACTOR cycle, with a config switch that selects between TDD and a DDD workflow for existing code.
zereight/gitlab-mcp
Enforces strict red-green-refactor, with a failing test first, the minimum code to pass it, then cleanup, and a quick reference for common test runners.
ChrisWiles/claude-code-showcase
Jest patterns for React Native style tests: TDD discipline, mock factory functions, module and GraphQL hook mocking, custom render helpers and anti-patterns to avoid.
hellangleZ/burn-in-cceverywhere-ralph
A skill your agent uses when writing new features, fixing bugs, or refactoring code.
AprilNEA/OpenLogi
Verifies OpenLogi's native GPUI interface with focused tests, the component gallery and a mock agent, choosing the evidence that fits each change.
rtk-ai/rtk
Describes seven Rust design patterns for the RTK CLI filter modules, with when to use each, RTK examples, and notes on when a pattern is overkill.
rtk-ai/rtk
Enforces red-green-refactor for new RTK output filters in Rust, using real captured fixtures, snapshot tests with insta and token-savings assertions.
rtk-ai/rtk
Reviews RTK's Rust code for over-engineering and verbose patterns, applying idioms like iterator chains and early returns while protecting a specific list of constraints from being simplified away.
rtk-ai/rtk
Audits open GitHub issues, categorizes them, flags duplicates and linked PRs in three phases, with optional deep analysis and comments posted only after validation.
rtk-ai/rtk
Audits a repository's open pull requests, deep-reviews chosen ones and drafts review comments that are only posted after you approve them.
rtk-ai/rtk
Runs issue triage and PR triage in parallel, then cross-analyzes the results to flag duplicate coverage, security gaps, P0 issues with no PR, and PR conflicts.
Works with
Categories
Enforces red-green-refactor for Rust work, with idiomatic test patterns, a naming convention and a pre-commit gate of cargo fmt, clippy and test. The skill applies the three laws of test-driven development to Rust: no production code without a failing test, write only enough test to fail (a compile failure counts), and write only enough production code to pass. Tests go in a cfg(test) module of the same file.
Rust TDD Workflow fits situations like: implementing a new Rust function or feature test-first; fixing a Rust bug starting from a failing test; refactoring Rust code under test coverage; deciding how to test code that touches I/O or spawns commands.
Run `npx skills add rtk-ai/rtk --skill rtk-tdd -a claude-code`. Or copy the skill folder (.claude/skills/rtk-tdd in rtk-ai/rtk) into .claude/skills/rtk-tdd in your project. Claude Code loads it when a task matches its description.
Run `npx skills add rtk-ai/rtk --skill rtk-tdd -a codex`. Or copy the skill folder (.claude/skills/rtk-tdd in rtk-ai/rtk) into .agents/skills/rtk-tdd in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add rtk-ai/rtk --skill rtk-tdd -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/rtk-tdd, .gemini/skills/rtk-tdd, .github/skills/rtk-tdd and .opencode/skills/rtk-tdd in your project.
Going by SKILL.md and its folder, Rust TDD Workflow needs the command-line tools its instructions call (cargo). Our summary lists: A Rust project with cargo, rustfmt and clippy. Its frontmatter pre-approves these tools: Read, Write, Edit, Bash.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.
Rust TDD Workflow is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 753 tokens (SKILL.md is roughly 3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 895 tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Rust TDD Workflow: Rust Testing (kurealnum/dotfiles, 290 stars), MoAI TDD Workflow (modu-ai/moai-adk, 1.2k stars), Test-Driven Development Enforcer (zereight/gitlab-mcp, 2k stars) and Jest Testing Patterns (ChrisWiles/claude-code-showcase, 6.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
rtk-ai (a GitHub organization) maintains it in rtk-ai/rtk, which has 82,728 GitHub stars. The repository holds 7 skills in this directory. The repository was last updated on October 8, 2026.
Source: rtk-ai/rtk on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.