Skip to content

Add skill - test-mocking-patterns #30

Description

@miroslavpojer

Summary

Add a test-mocking-patterns skill that gives Copilot structured guidance on choosing, implementing, and reviewing test doubles (mocks, stubs, spies, fakes) across Python, TypeScript, and Scala.

Motivation

Three existing skills — test-unit-write, test-unit-standards, and test-unit-review — all explicitly redirect mocking questions to a test-mocking-patterns skill that does not yet exist. Users asking "how do I mock an HTTP client in pytest?", "should I use a spy or a stub here?", or "why is my mock not being called?" fall into a gap with no skill to catch them.

Proposed scope

The skill should cover:

  • Pattern selection — when to use a mock, stub, spy, fake, or dummy; decision table by dependency type (HTTP, DB, clock, env, file I/O, randomness)
  • Implementation guidance — language-specific recipes:
    • Python: unittest.mock, pytest-mock, responses, freezegun
    • TypeScript/Jest: jest.fn(), jest.spyOn(), manual mocks, __mocks__ folder
    • Scala/MUnit: scalamock, mockito-scala
  • Anti-patterns — over-mocking, mocking what you don't own, brittle verify chains, leaking mock state between tests
  • Boundary rules — what should never be mocked (pure functions, value objects, simple data classes)
  • Interaction with test-unit-write — the writer skill delegates Step 3 (mock strategy) here; this skill must be compatible with that handoff

Acceptance criteria

  • SKILL.md with frontmatter (name, description, license, compatibility)
  • Description triggers correctly on mocking/stubbing/spy/fake/double intent, and does NOT trigger on general write/review/standards requests
  • Language reference files under references/ for at least Python and TypeScript
  • evals/evals.json with ≥ 5 trigger and ≥ 3 body evals
  • Cross-skill NOT: pointers updated in test-unit-write, test-unit-standards, and test-unit-review to reference this skill by name

Related skills

  • test-unit-write (upstream delegator — Step 3)
  • test-unit-standards (peer — isolation rules)
  • test-unit-review (peer — flags mocking violations)
  • test-data-management (sibling new skill)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions