Test Doubles Strategy

Choosing between mocks, stubs, fakes, spies, and dummies based on testing needs.

48 stars 10 forksTesting & QA Plugin marketplace

Install

Claude Code plugin
/plugin marketplace add sethdford/claude-skills

The repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add sethdford/claude-skills --skill test-doubles-strategy
Manual install
git clone --depth 1 https://github.com/sethdford/claude-skills.git /tmp/claude-skills
mkdir -p ~/.claude/skills
cp -r /tmp/claude-skills/engineer/testing/skills/test-doubles-strategy ~/.claude/skills/test-doubles-strategy

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Test Doubles Strategy

Strategies for replacing real objects with test doubles.

## Context

You are selecting the right test double for the job. Understand the tradeoffs of each approach.

## Domain Context

- **Stub**: Returns canned answers; doesn't care how many times it's called
- **Mock**: Expects specific calls; verifies behavior
- **Fake**: Lightweight working implementation; slower but more realistic than stub
- **Spy**: Records calls; can verify and allow through to real object
- **Dummy**: Placeholder; passed but never used

## Instructions

1. **Stub**: Use when you need predictable return values; database returning test data
2. **Mock**: Use when you need to verify that a dependency was called correctly
3. **Fake**: Use for database or third-party service; test containers are modern fakes
4. **Spy**: Use when you need both verification and real behavior
5. **Dummy**: Use when dependency is required by signature but not used
6. **Avoid Over-Mocking**: If everything is mocked, you're not testing integration
7. **Prefer Fakes**: Modern practice uses test containers over mocks for external services

## Anti-Patterns

- Mocking everything; you need at least some real code to test
- Over-specifying mocks; brittle tests that fail on implementation changes
- Mocking your own code; mock external dependencies, not your logic
- Complex mock setup that's harder than the test; use factories or test builders
Read the full skill on GitHub

Details

Skill name
test-doubles-strategy
Path
engineer/testing/skills/test-doubles-strategy/SKILL.md
License
MIT
Repo updated
11 March 2026

FAQ

What does the Test Doubles Strategy skill do?

Choosing between mocks, stubs, fakes, spies, and dummies based on testing needs.

How do I install the Test Doubles Strategy skill?

Claude Code plugin: /plugin marketplace add sethdford/claude-skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Test Doubles Strategy popular?

It lives in sethdford/claude-skills, which has 48 GitHub stars and 10 forks.

Related skills

Browse the most popular Claude skills, all testing & qa skills, or write your own with the skills generator.