protagonistss/ithinku-plugins
Overview
This skill generates mock data and stub functions for tests to isolate external dependencies and speed up development. It creates typed mock objects, realistic datasets, API responses, database stubs, and time/random controls. The skill supports Jest and Vitest templates and offers configurable generation options for edge cases and error scenarios. It is focused on TypeScript projects and produces reusable, test-friendly mocks.
How this skill works
The skill analyzes module exports, function signatures, return types, and common external interactions (DB, HTTP, timers, randomness) to determine what to mock. It generates typed mock objects, factory-based data generators, API response shapes, and stub implementations with sync/async behaviors. Templates for Jest, Vitest, and Python show how to wire mocks into test suites, and utilities provide boundary, invalid, and paginated responses. Call-history, custom return values, and error simulation are supported for detailed behavior control.
When to use it
- When tests rely on external APIs, databases, or system time and need isolation.
- When generating realistic but deterministic datasets for unit or integration tests.
- When you need reusable factories for complex nested objects or lists.
- When testing error handling: network, timeout, validation, or database edge cases.
- When you want consistent mock templates for Jest, Vitest, or cross-language examples.
Best practices
- Only mock external dependencies; keep business logic unmocked to avoid false confidence.
- Use factory/generator patterns to produce reusable, consistent test data.
- Include boundary and invalid-data generators to validate error paths.
- Reset or clear mocks between tests (beforeEach/afterEach) to avoid cross-test leakage.
- Prefer partial mocks over full module replacements when you want to preserve real behavior selectively.
Example use cases
- Auto-generate mocks for a user service module with typed return values and spies for Vitest.
- Create stubbed database methods (findById, create, update) that return realistic user fixtures, including not-found cases.
- Mock fetch/XHR to return paginated API responses, success, and error scenarios for frontend tests.
- Produce time-controlled tests using fake timers for delayed callbacks and scheduled jobs.
- Generate sequences of async stub behaviors to test retry and promise-chain logic.
FAQ
Yes. It supports async stubs, mockResolvedValue/mockRejectedValue sequences and configurable multi-call behaviors.
How do I control generated values or provide custom returns?
You can pass customReturnValues per export or provide override objects to generators to shape returned fixtures.
5 skills
This skill generates realistic mock data and stub functions to isolate tests, speeding up development and improving test reliability.
This skill helps you audit and fix web accessibility issues for WCAG compliance, providing actionable code fixes and guidance.
This skill performs in-depth performance analysis to identify bottlenecks, assess efficiency, and propose practical optimization strategies for code, systems,
This skill analyzes code for security vulnerabilities, assesses risk using OWASP and CVE data, and offers actionable remediation guidance.
This skill analyzes code changes and generates conventional commit messages, performs quality checks, and creates clean, standardized commits.