mocking-test-generator
Installation
SKILL.md
Mocking Test Generator
Mocks replace real dependencies with controllable fakes. Done right, they isolate the unit and let you test error paths. Done wrong, they test the mock instead of the code.
When to mock
| Dependency | Mock? | Why |
|---|---|---|
| External HTTP API | Yes | Slow, flaky, costs money, rate limits |
| Database | Usually yes (unit), no (integration) | Real DB in unit tests = slow + shared state |
| Filesystem | Yes, or use a temp dir | Test pollution, permission issues |
| Clock / time | Yes | sleep(3600) in a test is not a test |
| Random number generator | Yes (seed it) | Reproducibility |
| Your own pure functions | No | That's what you're testing |
| Your own classes (same module) | Rarely | Over-mocking tests wiring, not behavior |
Rule of thumb: mock at the process boundary (network, disk, clock). Don't mock your own code.