Select and implement the right test double with a default preference for fakes, stubs, and spies over mocks. Use when writing or refactoring tests, especially when users mention test doubles, mocking strategy, interaction assertions, or flaky tests caused by over-mocking.
93%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Write tests that describe behavior and state, not implementation details. Avoid mock-by-default.
Fake (in-memory or lightweight real implementation).Stub.Spy.Mock, with minimal expectations.If one test needs many interaction expectations, treat it as a design smell and raise the abstraction of the port.
FakeXxxRepo, InMemoryXxxRepoStubXxxGateway, FailingXxxStub, FixedClockStubSpyXxxPublisher, SpyEmailServiceMockXxxClient only for contract-driven teststests/doubles/test/doubles/ or __tests__/doubles/Always use forward slashes in paths.
called_with assertions.See references/examples.md for Jest-based JavaScript and TypeScript templates for fake, stub, spy, and contract-focused mock. See references/usage.md for trigger prompts and copy-paste templates. See references/quick.md for single-page fast reference.
saski/arnesto
752f690
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.