mock-generator_skill

This skill generates test mocks, stubs, and fixtures for Jest, Vitest, pytest and more to speed up testing.
  • TypeScript

4

GitHub Stars

2

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill dexploarer/claudius-skills --skill mock-generator

  • README.md18.4 KB
  • SKILL.md15.8 KB

Overview

This skill generates test mocks, stubs, and fixtures across popular frameworks (Jest, Vitest, pytest, unittest, MSW, etc.). It produces ready-to-use snippets and small helper factories so you can plug mocks directly into tests and speed up test writing. The output is framework-aware and can target functions, classes, modules, APIs, databases, and React components.

How this skill works

I inspect or ask for the target to mock (function, class, API endpoint, DB client, hook), detect the testing framework and language, then emit a minimal, idiomatic mock or fixture. The skill can create simple return-value mocks, spied methods, partial module mocks, MSW handlers, pytest fixtures, Prisma/MongoDB stubs, and factory helpers. You get code that includes setup/teardown where appropriate.

When to use it

  • You need a mock for a specific function or class
  • Create fixtures or factory data for tests
  • Mock an HTTP/GraphQL API response or WebSocket messages
  • Stub database clients (Prisma, Mongo) for unit tests
  • Replace child components or hooks in React tests

Best practices

  • Keep mocks small and focused—mock only what the test needs
  • Prefer fixtures or factories for repeated test data to avoid duplication
  • Use spies for interaction assertions and simple mocks for return values
  • Reset or restore mocks between tests to avoid state leakage
  • Choose MSW for integration-level API mocking and jest/vi mocks for unit-level isolation

Example use cases

  • Generate a Jest mock for an async fetch module and example test that asserts calls and resolved values
  • Create a pytest fixture that yields a mock database client with connect/disconnect teardown
  • Produce an MSW handler file for REST and GraphQL endpoints and setup server bootstrap
  • Generate a type-safe Vitest/TypeScript mock factory for User objects and a sample test using vi.fn()
  • Create a Prisma client mock using jest-mock-extended and an example of mocking user.create

FAQ

Common JS/TS and Python frameworks: Jest, Vitest, Mocha, unittest, pytest, pytest-mock, plus MSW for HTTP and GraphQL.

Can it generate type-safe TypeScript mocks?

Yes. It can output typed factories and vi/jest mocks that include TypeScript signatures and example usage.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
mock-generator skill by dexploarer/claudius-skills | VeilStrat