test-doubles-first

test-doubles-first is a skill for Claude Code, Codex from saski/arnesto. It costs 58 tokens per session (768 once invoked), scanned A, original, Unlicense.

A testing guide for choosing between fakes, stubs, spies, and mocks, which are substitutes for real dependencies in tests.

In plain words
What is it for?
Use it when writing or refactoring tests, especially when deciding whether to simulate data, control responses, observe effects, or verify interactions.
Why use it?
It keeps tests focused on observable behavior instead of fragile details about how the code is built internally.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit Use it when writing or refactoring tests, especially when deciding whether to simulate data, control responses, observe effects, or verify interactions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/saski/arnesto/test-doubles-first
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add saski/arnesto --skill test-doubles-first
Clone the repo
git clone --depth 1 https://github.com/saski/arnesto

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for test-doubles-first

README.md
[![agentmods](https://agentmods.dev/badge/skills/saski/arnesto/test-doubles-first/github.svg)](https://agentmods.dev/skills/saski/arnesto/test-doubles-first)
Your own site
<a href="https://agentmods.dev/skills/saski/arnesto/test-doubles-first"><img src="https://agentmods.dev/badge/skills/saski/arnesto/test-doubles-first/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for test-doubles-first

Your own site · 80×15
<a href="https://agentmods.dev/skills/saski/arnesto/test-doubles-first"><img src="https://agentmods.dev/badge/skills/saski/arnesto/test-doubles-first.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 768 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00058 $0.00768
Opus 5.5 $0.00023 $0.00307
Sonnet 5.5 $0.00012 $0.00154
Haiku 4.5 $0.00006 $0.00077

Measured 2mo ago against content hash febddf29ef87, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

test-doubles-first scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/test-doubles-first/SKILL.md · 81 lines

How it starts

The opening of the file, as written. The whole thing — 81 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Test Doubles First

Quick Navigation

Goal

Write tests that describe behavior and state, not implementation details. Avoid mock-by-default.

Default Rule

  1. Prefer state/output assertions first.
  2. Choose the lightest double that makes the test clear.
  3. Use mocks only when interaction contract is the behavior under test.

Decision Tree

  1. Can the test assert state (persisted data, returned value, emitted event)?
    • Yes -> use a Fake (in-memory or lightweight real implementation).
    • No -> continue.
  2. Do you need to force a branch (success/failure/timeout) with controlled responses?
    • Yes -> use a Stub.
    • No -> continue.
  3. Do you need to observe an outbound effect (email, message, metrics) without prescribing internal construction?
    • Yes -> use a Spy.
    • No -> continue.
  4. Do you need to verify interaction contract (never called, called once, call order/protocol)?
    • Yes -> use a Mock, with minimal expectations.

If one test needs many interaction expectations, treat it as a design smell and raise the abstraction of the port.

Naming and Placement

  • Names
    • FakeXxxRepo, InMemoryXxxRepo
    • StubXxxGateway, FailingXxxStub, FixedClockStub
    • SpyXxxPublisher, SpyEmailService
    • MockXxxClient only for contract-driven tests
  • Paths (cross-platform style)
    • Python: tests/doubles/
    • TypeScript: test/doubles/ or __tests__/doubles/

Always use forward slashes in paths.

Style Constraints

  • Prefer state/output assertions over called_with assertions.
  • For spies, assert only relevant facts (for example count, recipient, subject).
  • Keep stubs configurable per scenario; do not build mini-systems.
  • Keep fakes honest to domain invariants; add contract tests for real adapters when needed.

Read the full file on GitHub · 81 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2mo ago First seen · 81 lines · 58 tokens per session scan A febddf29ef87

Subscribe to this mod's changes

test-doubles-first is a skill published in the GitHub repository saski/arnesto (7 stars, last pushed 5d ago), licensed Unlicense. It adds 58 tokens to every session and 768 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

test-doubles-first compared with skills from other repositories

test-doubles-first next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
test-doubles-firstsaski/arnestoSkill75d agoUnlicenseA58Claude Code, Codex
nemo-automodel-model-onboardingNVIDIA/skillsSkill4.2ktodayApache-2.0A33Claude Code
nemo-automodel-recipe-developmentNVIDIA/skillsSkill4.2ktodayApache-2.0A31Claude Code
mcore-testingNVIDIA/skillsSkill4.2ktodayApache-2.0A38Claude Code
i4h-catheter-navigation-e2eNVIDIA/skillsSkill4.2ktodayApache-2.0A49Claude Code, Codex
test-harnessMathews-Tom/armorySkill3467d agoMITA65Claude Code
test-reviewsd0xdev/sd0x-harnessSkill1966d agoMITA56Claude Code