test-double-typelisted
Install: claude install-skill ecoma-io/touchstone
# Test Double Types
Base principles: [test-isolation-base](../test-isolation-base/SKILL.md)
One word — "mock" — is doing duty for four different things:
| Double | What it is | Reach for it |
| -------- | ---------------------------------------------------------------- | ---------------------------------------------------------- |
| **Stub** | canned answers, records nothing | first: most collaborators are only a source of input |
| **Fake** | a real but simplified implementation, e.g. an in-memory store | when the code writes to the collaborator and reads it back |
| **Spy** | a stub that also records how it was called | only when the call itself is the observable effect |
| **Mock** | a spy with expected calls declared up front, failing on the rest | almost never: it asserts choreography by construction |
The last two rows are last on purpose. A double that records calls invites an assertion about calls. Reach for a spy or mock by naming the outcome you could have asserted instead. If you cannot name the outcome, the call is not the behaviour — it is the mechanism.
Default to a hand-written stub or fake. It satisfies only the interface at the point of use and breaks loudly when the contract moves.
Per-language: [TypeScript](references/typescript.md)