mock-generation

Generate typed test doubles in Go using mockery, gomock, or moq.

1|Updated Jun 20, 2026
One-click install
npx skills add https://github.com/shafibabar/SDLC-Artifact-Factory --skill mock-generation-shafibabar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mock-generation
Source: https://github.com/shafibabar/SDLC-Artifact-Factory/tree/main/skills/mock-generation
Command: npx skills add https://github.com/shafibabar/SDLC-Artifact-Factory --skill mock-generation-shafibabar

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill eliminates brittle, hand-written mocks and over-mocking by providing a standardized, type-safe approach to creating test doubles in Go.

Core Features & Use Cases

  • Five-Type Taxonomy: Implements the correct double (dummy, stub, spy, mock, or fake) based on the specific testing need.
  • Managed vs. Unmanaged Logic: Provides a clear decision framework to ensure only unmanaged dependencies are mocked, preventing implementation-detail coupling.
  • Generation Tooling: Automates the creation of mocks using industry-standard tools like mockery, gomock, and moq to ensure compile-time compliance.

Quick Start

Use the mock-generation skill to generate a typed mock for the DataAssetRepository interface in the internal domain package.

Frequently Asked Questions about mock-generation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate typed Go test doubles for interface isolation?

Generate typed Go test doubles by applying a five-type taxonomy to isolate unmanaged dependencies. This ensures compile-time interface compliance and refactor-safe test suites using automated generation tools like mockery, gomock, or moq.

What is the difference between a stub, spy, and fake in Go mocking?

In Go mocking, stubs return predefined data, spies record interactions, and fakes provide working in-memory implementations. Selecting the correct test double type ensures you avoid over-mocking and prevent coupling your tests to internal implementation details.

Does mockery or gomock work with the Classical school of testing?

Yes, mockery and gomock work with the Classical school of testing by isolating only unmanaged dependencies. This standardized approach prevents implementation-detail coupling and ensures your test suite remains maintainable during refactoring.

When should I not use mocks in Go unit testing?

You should not use mocks in Go unit testing for managed dependencies that can be tested with real implementations. Over-mocking managed dependencies creates brittle tests that break during refactoring and couple your test suite to internal implementation details.

How do I automate mock generation in Go to prevent brittle tests?

Automate mock generation in Go by using industry-standard tools like mockery, gomock, or moq to enforce compile-time interface compliance. This eliminates hand-written mocks and ensures type-safe test doubles that resist breaking during refactoring.