mock-gen

Generate typed mock factories and MSW handlers for TypeScript projects.

11|Updated Apr 16, 2026
One-click install
npx skills add https://github.com/berkcangumusisik/claude-code-practices --skill mock-gen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mock-gen
Source: https://github.com/berkcangumusisik/claude-code-practices/tree/main/skills/mock-gen
Command: npx skills add https://github.com/berkcangumusisik/claude-code-practices --skill mock-gen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Automates the creation of mock data factories and API mocks to accelerate testing and ensure consistent fixtures.

Core Features & Use Cases

  • Generate a factory function for a given TypeScript interface or type.
  • Create MSW handlers and realistic mock data that mirror API responses.
  • Organize generated mocks in standard project locations (e.g., src/mocks/ or src/testing/factories/).

Quick Start

Create a mock factory for a type named by your input and generate corresponding MSW handlers with example data.

Frequently Asked Questions about mock-gen

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

FAQPage Schema
How do I generate mock data factories for TypeScript interfaces?

Generate mock data factories by providing a TypeScript type or interface, which produces typed factory functions and realistic fixtures to reduce boilerplate in testing.

Can I automatically create MSW handlers for API responses in my test suite?

Yes, you can create MSW handlers that mirror API responses by generating standard mock data alongside typed factories to streamline API testing.

What is the best way to reduce boilerplate when creating test fixtures?

The best way to reduce boilerplate is to auto-generate test fixtures using factories that respect existing project conventions and organize mocks in standard locations.

Do I need external dependencies to generate typed mock factories?

No external dependencies are required beyond your project's testing stack; the tool respects existing typings and testing frameworks to generate mocks natively.

How does mock generation handle standard project directory placements?

Mock generation respects existing project conventions by placing generated factories and handlers in standard directories like src/__mocks__/ or src/testing/factories/.