Guide · Agent skill
How to use the Rust Testing Patterns agent skill (rust-testing)
Updated · written with AI from the project's own documentation and checked against our catalogue data
The rust-testing skill is a set of Rust testing patterns that an AI agent reads and follows when it writes or changes Rust code. It covers unit tests, integration tests, async tests with Tokio, parameterized tests with rstest, property-based tests with proptest, mocks with mockall, and coverage checks. This guide explains what the skill changes, how to install it, how to ask for it, and what to check before relying on it.
Quick start
- 1Download the ZIP. Download the rust-testing skill ZIP from this page.
- 2Unzip the skill. Unzip the download so the skill folder containing SKILL.md is ready to copy.
- 3Place the skill folder. Put it in ~/.claude/skills/ for personal use, or in .claude/skills/ inside your Rust project.
- 4Or upload it in the Claude apps. In the Claude apps, go to Settings → Capabilities → Skills and upload the skill.
- 5Confirm your Rust toolchain. Make sure cargo is installed, and install cargo-llvm-cov if you want coverage checks.
- 6Ask for tests in natural language. Describe the Rust function or module and ask for tests, TDD or coverage.
- 7Review the result. Check the failing test, the implementation and the coverage output before accepting the changes.
What the rust-testing skill makes the agent do
An agent skill is a folder with a SKILL.md file that gives an agent extra instructions for a specific kind of task. When this skill is active, the agent approaches Rust testing in a structured way: it identifies the target code, writes a test first, mocks dependencies where needed, and works through a red-green-refactor cycle.
The skill asks the agent to run the tests and confirm they fail before writing the implementation (RED), write minimal code to make them pass (GREEN), then improve the code while keeping tests green (REFACTOR). At the end it suggests checking coverage with cargo-llvm-cov, targeting 80% or more.
Install the skill from the ZIP
Download the ZIP for the skill from this page and unzip it. The skill is a single file, SKILL.md. Put the unzipped skill folder in one of these locations:
- Personal skills: ~/.claude/skills/
- Project skills: .claude/skills/ inside your Rust project
- Claude apps: upload the skill under Settings → Capabilities → Skills
Check what you need before you start
The skill assumes a Rust toolchain with cargo is installed. The examples reference the crates rstest, proptest, mockall and tokio, and cargo-llvm-cov is optional and only needed for coverage checks. The skill does not run scripts and does not use the network.
- Rust toolchain with cargo
- rstest, proptest, mockall, tokio (referenced in examples)
- cargo-llvm-cov (optional, for coverage)
Ask for Rust tests in natural language
You do not need a special command. Describe the Rust work you want and mention tests, TDD or coverage. The skill is most useful when the request matches its scope: writing new functions, adding coverage to existing code, property tests for input validation, or following a TDD workflow.
- Write a failing test for a new add function in src/math.rs, then implement it using TDD.
- Add unit tests for User::new in src/user.rs, including the invalid email case.
- Add property-based tests with proptest for my encode and decode functions.
- Mock the UserRepository trait with mockall and test UserService::get_user.
- Parameterize this string length test with rstest for empty, short and long inputs.
- Check test coverage for this crate with cargo-llvm-cov and aim for 80%.
Patterns the agent will follow
The skill includes reference examples for each testing style. The agent uses them as a consistent pattern rather than inventing a new layout each time.
- Unit tests in a #[cfg(test)] module with #[test], and assertion macros such as assert_eq! and assert!.
- Error and panic tests: checking Result errors with matches!, returning Result from tests, and #[should_panic] with an expected message.
- Integration tests in a tests/ folder, where each file is a separate test binary, with shared helpers in tests/common/.
- Async tests using #[tokio::test] and tokio::time::timeout.
- rstest for #[case] parameterized tests and #[fixture] fixtures.
- proptest for property tests and custom strategies, and mockall's #[automock] for trait mocks.
cargo testTips for getting good results
The skill gives the agent a pattern, but you still review the tests. Ask the agent to show the failing test output before implementation, since the skill's RED step depends on it. If you only need a syntax reminder, the file is mostly examples, so reading the reference directly may be faster.
- Name the file and function you want tested so the agent knows the target code.
- Ask for the RED step explicitly if you want to see the failing test first.
- Request cargo-llvm-cov only if it is installed, since it is optional.
- Review mocks and property tests to confirm they check behaviour you care about.
Safety notes
The skill runs no scripts and makes no network calls, according to its own listing. Tests you ask the agent to run still execute code in your project through cargo, so read the test and code changes before running them on sensitive data or production systems.
What people use it for
- Adding unit tests with #[test] to a new Rust function in a src module.
- Writing parameterized rstest cases for string or input-handling functions.
- Adding proptest roundtrip or ordering checks to encoding and collection code.
- Mocking a repository trait with mockall to test a service layer in isolation.
- Adding Tokio async tests with timeouts to an existing Rust crate.
Frequently asked questions
How do I install the rust-testing agent skill?
Download the ZIP from this page and unzip it. Place the skill folder in ~/.claude/skills/ for personal use or in .claude/skills/ inside a project, or upload it in the Claude apps under Settings → Capabilities → Skills.
What do I need to use the rust-testing skill?
You need a Rust toolchain with cargo. The examples reference rstest, proptest, mockall and tokio, and cargo-llvm-cov is optional for coverage checks. The skill runs no scripts and uses no network.
Is the rust-testing skill free?
The item is listed under the MIT licence. Check the licence file in the source repository for the full terms before redistributing it.
Does the skill work for non-Rust projects?
No. The patterns are specific to Rust and its cargo tooling, so it is not useful for other languages.
How does it compare to just asking an agent to write Rust tests?
The skill gives the agent a consistent structure: a red-green-refactor cycle, specific crates for each test type, and a coverage target of 80% or more. Without it, the agent may choose a different style each time.
Why doesn't the agent use the skill when I ask for tests?
The skill is most likely to be used when your request matches its scope, such as writing Rust tests, adding coverage or following TDD. Mention Rust, tests and the file or function you want covered to make the match clearer.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use the rust-testing skill if you write Rust and want an agent to follow a consistent TDD pattern with rstest, proptest, mockall and coverage checks. Skip it for non-Rust work, or if you only need a quick syntax reminder, since the file is mostly reference examples.
Download the skill