rust-write-tests

rust-write-tests is a skill for Claude Code, Codex from pproenca/dot-skills. It costs 64 tokens per session (2,344 once invoked), scanned C, original, MIT.

A guide to writing Rust tests that check the conditions code must keep true, including edge cases and platform differences. Rust is a programming language focused on speed and safety.

In plain words
What is it for?
Use it when adding or reviewing Rust tests, designing test cases, investigating flaky tests, and checking whether assertions protect the intended behaviour.
Why use it?
It helps replace shallow happy-path tests with tests that can catch real regressions, flaky behaviour, and mistakes introduced by future refactoring.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when adding or reviewing Rust tests, designing test cases, investigating flaky tests, and checking whether assertions protect the intended behaviour.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/pproenca/dot-skills/rust-write-tests
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 pproenca/dot-skills --skill rust-write-tests
Clone the repo
git clone --depth 1 https://github.com/pproenca/dot-skills

Made for: Claude Code, Codex.

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-write-tests

README.md
[![agentmods](https://agentmods.dev/badge/skills/pproenca/dot-skills/rust-write-tests/github.svg)](https://agentmods.dev/skills/pproenca/dot-skills/rust-write-tests)
Your own site
<a href="https://agentmods.dev/skills/pproenca/dot-skills/rust-write-tests"><img src="https://agentmods.dev/badge/skills/pproenca/dot-skills/rust-write-tests/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-write-tests

Your own site · 80×15
<a href="https://agentmods.dev/skills/pproenca/dot-skills/rust-write-tests"><img src="https://agentmods.dev/badge/skills/pproenca/dot-skills/rust-write-tests.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,344 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.00064 $0.02344
Opus 5.5 $0.00026 $0.00938
Sonnet 5.5 $0.00013 $0.00469
Haiku 4.5 $0.00006 $0.00234

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

Security

Grade C, and why

rust-write-tests scanned grade C with 1 finding 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 3mo 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

assert_eq!(cmd.to_string(), "rm -rf /tmp/workspace/build");
skills/.curated/rust-write-tests/SKILL.md · 247 lines

How it starts

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

Rust Test Writing Skill

Write tests that catch real bugs. Every test must guard a specific invariant -- not just prove the code "works."

The "What Could Break?" Framework

Before writing any test, answer these four questions:

  1. What invariant does this code maintain? (e.g., "deserialized config always has a default profile")
  2. What edge case would violate it? (e.g., "empty TOML table, missing key, extra unknown key")
  3. What platform difference could surface? (e.g., "path separators, case sensitivity, symlink behavior")
  4. What would a future refactor accidentally break? (e.g., "field added to struct but not to Display impl")

If you can only answer #1, your test is a happy-path test. Answer all four and you have a regression suite.

The 5 Test Transformations

Each transformation shows a superficial test pattern and its expert replacement.

Transformation 1: Weak assertions -> whole-object comparison

// BEFORE: proves nothing about the rest of the struct
let result = parse_config(input)?;
assert!(result.is_ok());

// AFTER: catches any unexpected field change
use pretty_assertions::assert_eq;
let result = parse_config(input)?;
assert_eq!(result, Config {
    name: "default".into(),
    timeout: Duration::from_secs(30),
    retries: 3,
    verbose: false,
});

Transformation 2: Single happy-path -> targeted test suite

// BEFORE: one test, one path
#[test]
fn test_parse_config() {
    let cfg = parse("valid input").unwrap();
    assert!(cfg.is_valid());
}

// AFTER: 3-6 tests covering happy, error, edge, platform
#[test]
fn parse_config_returns_defaults_for_minimal_input() { .. }
#[test]
fn parse_config_rejects_negative_timeout() { .. }
#[test]
fn parse_config_preserves_unknown_fields_as_extensions() { .. }
#[test]
fn parse_config_handles_empty_string_gracefully() { .. }
#[cfg(windows)]
#[test]
fn parse_config_normalizes_backslash_paths() { .. }

Transformation 3: Inline test module -> sibling _tests.rs file

Read the full file on GitHub · 247 lines

Files

What ships with it

2 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. 3mo ago First seen · 247 lines · 64 tokens per session scan C ac7751514914

Subscribe to this mod's changes

rust-write-tests is a skill published in the GitHub repository pproenca/dot-skills (231 stars, last pushed 3mo ago), licensed MIT. It adds 64 tokens to every session and 2,344 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

rust-write-tests compared with skills from other repositories

rust-write-tests next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
rust-write-testspproenca/dot-skillsSkill2313mo agoMITC64Claude Code, Codex
rust-best-practicespedronauck/skillsSkill6605d agoMITA48Claude Code
rust-developmentnavikt/copilotSkill65yesterdayMITA27Claude Code, Codex
rust-testingxobotyi/cc-foundrySkill23todayMITA70Claude Code
rust-testingrewrite-rs/skillsSkill3310d agoBSD-3-ClauseA86Claude Code, Codex
rust-testing-qualityfusengine/agentsSkill341mo agoMITA46Claude Code
testing-rustqte77/claude-code-pluginsSkill3yesterdayApache-2.0A39Claude Code