write-rust-tests
Generates comprehensive Rust tests following project guidelines. Focuses on testing public APIs and unreachable code paths.
Install
mkdir -p .claude/skills/write-rust-tests && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1733" && unzip -o skill.zip -d .claude/skills/write-rust-tests && rm skill.zipInstalls to .claude/skills/write-rust-tests
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Write Rust tests to verify correctness of Rust code. Use this when you want to write Rust tests.Key capabilities
- →Verify public API correctness
- →Test edge cases and error conditions
- →Identify branch coverage gaps
- →Validate Rust modules
How it works
It requires identifying specific uncovered code branches before writing a test, ensuring each test provides unique coverage.
Inputs & outputs
When to use write-rust-tests
- →Writing unit tests for Rust crates
- →Testing edge cases in data structures
- →Verifying error conditions in Rust modules
- →Checking branch coverage
About this skill
Write Rust Tests
Write new Rust tests for Rust code.
Arguments
<path>: Path to the Rust crate or file.<path 1> <path 2>: Multiple crate/file paths.
If a path doesn't include src/, assume it to be in the src/redisearch_rs directory. E.g. numeric_range_tree becomes src/redisearch_rs/numeric_range_tree.
If a path points to a directory, consider all Rust files in that directory.
Guidelines
The generated tests must follow the guidelines outlined in /rust-tests-guidelines.
What to test
Ensure that all public APIs are tested thoroughly, including edge cases, error conditions and branches.
Use /check-rust-coverage to determine which lines are not covered by tests.
Avoiding redundant tests
Before writing each test, explicitly identify which branch or code path it will cover that no existing test already covers. An uncovered line is not sufficient justification — ask why it is uncovered and whether it is reachable through an already-tested entry point.
Two tests are redundant if they exercise the same set of branches in the code under test. Differing only in input values that don't change control flow is not a distinct scenario.
Do not write standalone tests for:
- Trivial trait delegations —
Default,From, or similar trait impls that are single-line delegations to an already-tested constructor, since they will be covered transitively.
After adding tests, double check that every new test covers at least one branch that no other test (existing or new) covers. Remove any that don't.
When not to use it
- →Testing trivial trait delegations
- →Writing redundant tests for existing branches
Prerequisites
Limitations
- →Must verify branch coverage via check-rust-coverage
- →Tests must cover unique branches
How it compares
It focuses on branch-level coverage and prevents redundant tests, whereas generic testing often focuses on simple functional verification.
Compared to similar skills
write-rust-tests side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| write-rust-tests (this skill) | 9 | 5mo | No flags | Intermediate |
| implementing-cards | 7 | 2mo | Review | Advanced |
| gen-rust | 1 | 6mo | Review | Advanced |
| rocq-simulate-author | 1 | 6mo | Review | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by RediSearch
View all by RediSearch →You might also like
implementing-cards
bcollazo
Fill out the implementation of effects of different attacks, abilities, and trainer cards in this Pokemon TCG Pocket engine codebase.
gen-rust
MoonshotAI
Sync Rust implementation with Python changes (exclude UI/login) by reviewing recent changes, mapping modules, porting logic, and updating tests.
rocq-simulate-author
formal-land
Create or update Rocq simulate files in this repository, including imports, executable definitions, and corresponding _eq lemmas with the project’s proof/admission conventions.
testing-hashql
hashintel
HashQL testing strategies including compiletest (UI tests), unit tests, and snapshot tests. Use when writing tests for HashQL code, using //~ annotations, running --bless, debugging test failures, or choosing the right testing approach.
rust-testing
aaione
Rust 测试模式,包括单元测试、集成测试、异步测试、属性测试、mocking 和覆盖率。遵循 TDD 方法论。
evolve
yologdev
Safely modify your own source code, test changes, and manage your evolution