plugins/rust-dev/skills/testing-rust/SKILL.md
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.
npx skillsauth add qte77/claude-code-utils testing-rustInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Target: $ARGUMENTS
Writes focused, behavior-driven tests following project testing strategy.
TDD methodology (language-agnostic): See tdd-core plugin (testing-tdd skill)
Rust-specific documentation: references/
references/testing-strategy.md — Rust tools (cargo test, proptest, insta, mockall)references/tdd-best-practices.md — Rust TDD examples (extends tdd-core)cargo test (default): Use #[test] for known cases, #[tokio::test] for async. Works at unit/integration levels.
proptest (edge cases): Use for invariants that must hold for ALL inputs.
See references/testing-strategy.md for full methodology comparison.
Cycle: RED (failing test / compile error) -> GREEN (minimal pass) -> REFACTOR (clean up)
Structure: Arrange-Act-Assert (AAA)
#[test]
fn test_order_calculator_sums_item_prices() {
// ARRANGE
let items = vec![Item { price: 10, qty: 2 }, Item { price: 5, qty: 1 }];
let calculator = OrderCalculator::new();
// ACT
let total = calculator.total(&items);
// ASSERT
assert_eq!(total, 25);
}
| Priority | Area | Example | | -------- | ---- | ------- | | CRITICAL | Math formulas | Score always in bounds | | CRITICAL | Parsers | Arbitrary input never panics | | HIGH | Serialization | Round-trip encode/decode lossless | | HIGH | Invariant sums | Total equals sum of parts |
High-Value: Business logic, error paths, integration points, contracts
Avoid: Compiler behavior, derive implementations, trivial assertions, default values
See references/testing-strategy.md -> "Patterns to Remove" for full list.
Format: test_{module}_{component}_{behavior}
test_user_service_creates_new_user()
test_order_processor_validates_items()
test_score_always_in_bounds() // property test
cargo test # All tests
cargo test test_order # Filter by name
cargo test --lib # Unit tests only
cargo test --test integration # Integration tests only
cargo watch -x test # Watch mode (cargo-watch)
cargo test)mockall with .times() constraintsdevelopment
Analyzes industry websites for design patterns, layout, typography, and content strategies using first-principles thinking. Use when researching website design, UI patterns, or competitive design analysis.
development
Audits website usability for UX optimization, covering forms, navigation, validation, and microcopy. Use when reviewing user experience, task completion flows, or interface friction points.
development
Audits website accessibility for WCAG 2.1 AA compliance, generating findings and code fixes. Use when reviewing accessibility, keyboard navigation, screen reader compatibility, or inclusive design.
development
Writes tests following TDD (using vitest and @testing-library/react) best practices. Use when writing unit tests, integration tests, or component tests in TypeScript.