What problem does it solve?
This Skill solves the problem of inconsistent, incomplete, or hard-to-maintain tests in Rust projects, which can lead to unreliable code, slow development cycles, and difficulty in reproducing bugs.
Core Features & Use Cases
- Effect Abstraction: Teaches how to model I/O and external dependencies (like clocks, payments, HTTP) as traits, enabling easy injection of real or fake implementations.
- Mocks & Fakes: Provides guidance on when to use hand-rolled fakes/stubs versus expectation-based mocks (
mockall, wiremock) for different testing scenarios.
- Property-Based Testing: Advocates for
proptest to validate non-trivial business logic and invariants, ensuring robust coverage beyond simple unit tests.
- Use Case: An AI agent is tasked with adding comprehensive tests for a new Rust service that interacts with external systems. This skill guides the agent on structuring tests using trait-based dependency injection, implementing fakes for I/O, and applying property tests for core business rules.
Quick Start
Explain how to implement a mockable Clock trait for a Rust service, including a RealClock adapter and a FixedClock fake for testing.