testing-patterns
Installation
SKILL.md
Testing Patterns & Effect Abstraction
Short version: model your “effects” as traits, inject them, keep core logic pure, and provide real + fake implementations. That’s the idiomatic Rust way; free monads aren’t a thing here.
Pattern
- Define algebras as traits (ports).
- Implement adapters for prod (HTTP, DB, clock, FS) and for tests (fakes/mocks).
- Inject via generics (zero-cost, monomorphized) or trait objects (
dyn Trait) when you need late binding. - Keep domain functions pure; pass in effect results or tiny capability traits.
Minimal sync example
use std::time::{SystemTime, UNIX_EPOCH};
pub trait Clock {
Related skills
More from lambdamechanic/sk
rust-guidelines
Pragmatic Rust conventions to keep code readable, testable, and performant for this project.
5dumbwaiter-mcp
Provider-agnostic wait-for-change skill that uses the Dumbwaiter MCP server to wait on PR events (GitHub first) via wait.start/status/cancel/await, with progress notifications and durable state.
5bd-workflow
How to use bd (beads) for issue tracking, ready work, status updates, and comments in this repo.
4template-skill
Replace with description of the skill and when Claude should use it.
4sk
How to use the repo-scoped sk CLI to manage Claude Skills in this codebase.
1