# Decide Mock

> When to mock. Real vs fake dependencies.

- Skill: `attac-t/decide-mock` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add attac-t/decide-mock`
- Raw SKILL.md: https://api.skillmd.com/api/skills/attac-t/decide-mock/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: attac-t (https://skillmd.com/u/attac-t)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/attac-t/decide-mock

---


# Skill: Decide Mock

> "Mock at the boundaries, not everywhere."

## The Decision

**Mock when:**
- External service (payment gateway, email provider)
- Slow dependency (file system, network)
- Non-deterministic (time, randomness)
- You don't control it

**Don't mock when:**
- In-process dependency (your own classes)
- Database (use transactions instead)
- The mock is more complex than the real thing
- You're testing integration, not isolation

## The Heuristic

Ask: *"Does this cross a process boundary?"*

Yes → Mock it. No → Use the real thing.

## The Quick Test

| Ask                | Answer | Action             |
|--------------------|--------|--------------------|
| External API?      | Yes    | Mock               |
| Your own class?    | Yes    | Real               |
| Database?          | Yes    | Real + transaction |
| Time-dependent?    | Yes    | Freeze time        |
| Non-deterministic? | Yes    | Mock or seed       |

## Real-World Examples

See [examples.md](examples.md).

