rust-testing

rust-testing is a skill for Claude Code from xobotyi/cc-foundry. It costs 70 tokens per session (2,312 once invoked), scanned A, original, MIT.

A Rust testing guide covering built-in tests, integration tests, documentation tests, and several testing libraries. It also explains the cargo-nextest test runner and related tools.

In plain words
What is it for?
It is for Rust unit, integration, documentation, property, snapshot, benchmark, fixture, and mocking work.
Why use it?
It gives the agent conventions for writing, running, configuring, and debugging tests in Rust files.

Skill for Claude Code

Written for Claude Code: ${CLAUDE_SKILL_DIR} variable.

Part of the rust plugin — 2 skills shipped together

Good fit It is for Rust unit, integration, documentation, property, snapshot, benchmark, fixture, and mocking work.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/xobotyi/cc-foundry/rust-testing
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add xobotyi/cc-foundry --skill rust-testing
Clone the repo
git clone --depth 1 https://github.com/xobotyi/cc-foundry

Made for: Claude Code.

Or install rust, the plugin that ships this one along with the rest of its 2 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for rust-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/xobotyi/cc-foundry/rust-testing/github.svg)](https://agentmods.dev/skills/xobotyi/cc-foundry/rust-testing)
Your own site
<a href="https://agentmods.dev/skills/xobotyi/cc-foundry/rust-testing"><img src="https://agentmods.dev/badge/skills/xobotyi/cc-foundry/rust-testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for rust-testing

Your own site · 80×15
<a href="https://agentmods.dev/skills/xobotyi/cc-foundry/rust-testing"><img src="https://agentmods.dev/badge/skills/xobotyi/cc-foundry/rust-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 70 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,312 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00070 $0.02312
Opus 5.5 $0.00028 $0.00925
Sonnet 5.5 $0.00014 $0.00462
Haiku 4.5 $0.00007 $0.00231

Measured 1mo ago against content hash 2e4d27bd2d9c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

rust-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/rust/skills/rust-testing/SKILL.md · 145 lines

How it starts

The opening of the file, as written. The whole thing — 145 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Rust Testing

Prefer real implementations and hand-written fakes over heavy mocking — a test wired to a mock asserts how the code calls its collaborators, not what the code does. Tests are documentation that runs: a reader should learn the intended behavior from the test name, the arrange/act/assert shape, and the doctest examples on public items. Test the public contract, not the private call graph.

Route to Reference

  • Test layout depth — ${CLAUDE_SKILL_DIR}/references/layout.md Unit vs integration vs doctest mechanics, tests/ crate-per-file model, tests/common/mod.rs shared-helper pattern, binary-crate lib.rs split, doctest attributes (no_run, should_panic, ignore, hidden # lines), assert_matches! and pretty_assertions usage
  • Property and snapshot testing, benchmarks — ${CLAUDE_SKILL_DIR}/references/property-and-snapshot.md proptest vs quickcheck strategy authoring and shrinking, insta inline/file snapshots and cargo insta review, criterion harness setup and std::hint::black_box
  • Mocking and fixtures — ${CLAUDE_SKILL_DIR}/references/mocking-and-fixtures.md mockall #[automock] vs mock!, predicates and call counts, the trait-seam pattern for in-memory fakes, rstest #[case]/#[fixture] params, serial_test, assert_cmd + predicates for CLI integration
  • Async tests — ${CLAUDE_SKILL_DIR}/references/async-tests.md #[tokio::test] flavors, tokio::time::pause/ advance for deterministic timers, tokio-test macros; cross-references the rust skill async reference for runtime semantics
  • Pinned crate versions — ${CLAUDE_SKILL_DIR}/references/versions.md date-stamped dev-dependency versions for the testing ecosystem crates ("as of 2026-06")

Read the relevant reference before writing non-trivial tests in that area.

Test Layout

  • Place unit tests in a #[cfg(test)] mod tests block in the same file as the code under test; bring the parent into scope with use super::*. #[cfg(test)] keeps test code (and its helpers) out of the build artifact.
  • Use unit tests to exercise private items — Rust's privacy rules let a child tests module reach its ancestors, so testing internals is possible. Reserve this for genuinely tricky private logic; prefer driving private code through the public API.
  • Place integration tests in the top-level tests/ directory, next to src/. Cargo compiles each file as its own crate, so they reach only the public API via use my_crate::... — exactly as an external consumer would.
  • Share integration-test helpers from tests/common/mod.rs, not tests/common.rs. The mod.rs form is not compiled as a separate test crate, so it produces no spurious empty "running 0 tests" section. Import it with mod common;.
  • For a binary crate, keep main.rs a thin shell that calls into lib.rs; integration tests then exercise the library crate, since only library crates expose items to external use.
  • Write doctests as /// examples on public items. They double as compiled documentation and run under cargo test --doc. Hide setup lines with a leading # and use ```no_run for examples that must compile but not run.

Read the full file on GitHub · 145 lines

Files

What ships with it

6 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 145 lines · 70 tokens per session scan A 2e4d27bd2d9c

Subscribe to this mod's changes

rust-testing is a skill published in the GitHub repository xobotyi/cc-foundry (22 stars, last pushed 7d ago), licensed MIT. It adds 70 tokens to every session and 2,312 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.

Related

Other skills, from other repositories

rust-development

Idiomatisk Rust-utvikling med cargo, clippy, error handling, async/tokio, unsafe og testing.

navikt/copilot · 27 tokens

rust-testing-quality

Use when writing, organizing, or running Rust tests — unit, integration, doc-tests, proptest, criterion benchmarks, or cargo-mutants. Not for CI pipeline wiring (rust-tooling-cicd).

fusengine/agents · 46 tokens

testing-rust

Writes tests following TDD (using cargo test, proptest, and insta) best practices. Use when writing unit tests, integration tests, or property-based tests in Rust.

qte77/claude-code-plugins · 39 tokens

rust-best-practices

Write, review, refactor, or optimize Rust, including ownership, errors, Tokio, traits, tests, benchmarks, Clippy, and documentation. Excludes other languages and architecture unrelated to Rust idioms.

pedronauck/skills · 48 tokens

testing

Rust testing — unit/integration layout, mocking with mockall, async test patterns, property testing, snapshot testing. Use whenever writing or reviewing Rust tests, setting up test infrastructure, choosing mocking strategies, organizing test modules, debugging test failures, or when the user asks about testing…

napalmpapalam/skills · 68 tokens

rust-testing

Design Rust tests that catch real regressions — unit, integration, doc, property, snapshot, and golden tests, and differential tests that prove a port matches its source. Use when writing or reviewing Rust tests, when a change lands without tests, when deciding what form a test should take, when a port needs parity…

rewrite-rs/skills · 86 tokens