Claude Skill

rust-testing

Behavior. Use when writing or reviewing Rust tests: assertions, proving layer, real dependencies, time control, and defect detection.

LLM Mart · 0 points · 0 views 0 listing impressions 0 install-command copies
Download dankosik-cargo-modernize-.agents_skills_rust-testing-6f540c3.zip · 1 KB

Install

skills CLI npx skills add https://github.com/Dankosik/cargo-modernize/tree/main/.agents/skills/rust-testing
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install dankosik-cargo-modernize@llmmart
Git git clone https://github.com/Dankosik/cargo-modernize.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole dankosik/cargo-modernize collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

Rust Testing

Behavior first. Name the observable contract a defect would break, select the smallest layer able to watch it fail, and assert concrete user-visible outcomes (reported finding id and span, rendered replacement, .fixed.rs output, report JSON, stderr bytes, exit code, or untouched working tree) against independent expected values.

Smallest proving layer. Match the harness to the boundary under test: unit tests beside pure logic in cargo-modernize-core, paired catalog fixtures (<id>.rs with //~ <id> markers and <id>.fixed.rs) plus a negative twin for every rule, metamorphic property tests (metamorphic_proptest.rs) for matcher and renderer invariants, and binary-level tests in crates/cargo-modernize/tests over tempfile workspaces for discovery, MSRV/edition resolution, --diff, --verify, --fix, --check, and exit codes. Assert public behavior so internal refactors stay green.

Real inputs versus doubles. Exercise real cargo, git, and parser behavior whenever their semantics belong to the claim (generated workspaces, real repositories for VCS diffs, real cargo check for --verify/--fix); reserve doubles such as the test-only panic detector for injected faults. Cover every supported edition (2015–2024), no_std/alloc/std variants, MSRV boundaries one release below and at requires, and const and macro contexts when a rule's admission depends on them.

Determinism. Keep output order, paths, and fingerprints independent of thread scheduling, filesystem iteration order, host path separators, and environment; normalize only what the contract declares unstable, and never sleep to synchronize.

Defect reproduction and discovery. Organize tests by behavior with small fixtures and explicit boundary limits. Reproduce bugs with a failing test first, verify non-zero executed test counts, and use cargo mutants, property tests, Miri, cargo xtask stress-ui, or fuzzing selectively as discovery aids rather than mandatory gates.

Files (cargo-modernize)
  • LICENSE 1 KB · in bundle
  • SKILL.md 2.2 KB
    ---
    name: rust-testing
    description: "Behavior. Use when writing or reviewing Rust tests: assertions, proving layer, real dependencies, time control, and defect detection."
    ---
    
    # Rust Testing
    
    **Behavior first.** Name the observable contract a defect would break, select the smallest layer able to watch it fail, and assert concrete user-visible outcomes (reported finding id and span, rendered replacement, `.fixed.rs` output, report JSON, `stderr` bytes, exit code, or untouched working tree) against independent expected values.
    
    **Smallest proving layer.** Match the harness to the boundary under test: unit tests beside pure logic in `cargo-modernize-core`, paired catalog fixtures (`<id>.rs` with `//~ <id>` markers and `<id>.fixed.rs`) plus a negative twin for every rule, metamorphic property tests (`metamorphic_proptest.rs`) for matcher and renderer invariants, and binary-level tests in `crates/cargo-modernize/tests` over `tempfile` workspaces for discovery, MSRV/edition resolution, `--diff`, `--verify`, `--fix`, `--check`, and exit codes. Assert public behavior so internal refactors stay green.
    
    **Real inputs versus doubles.** Exercise real `cargo`, `git`, and parser behavior whenever their semantics belong to the claim (generated workspaces, real repositories for VCS diffs, real `cargo check` for `--verify`/`--fix`); reserve doubles such as the test-only panic detector for injected faults. Cover every supported edition (`2015`–`2024`), `no_std`/`alloc`/`std` variants, MSRV boundaries one release below and at `requires`, and `const` and macro contexts when a rule's admission depends on them.
    
    **Determinism.** Keep output order, paths, and fingerprints independent of thread scheduling, filesystem iteration order, host path separators, and environment; normalize only what the contract declares unstable, and never sleep to synchronize.
    
    **Defect reproduction and discovery.** Organize tests by behavior with small fixtures and explicit boundary limits. Reproduce bugs with a failing test first, verify non-zero executed test counts, and use `cargo mutants`, property tests, Miri, `cargo xtask stress-ui`, or fuzzing selectively as discovery aids rather than mandatory gates.
    

Comments

Sign in to join the conversation.

No comments yet. Start the conversation.

Reviews (0)

No reviews yet.