Skip to content
Back to skills

Mock Gen

ASecurity

Generates mock data factories and API mocks for testing

  • 10 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 1, 2026
ai-agentsbashtestingapi

Works with

  • api

Security analysis

A100/100

Scanned June 1, 2026

npx -y skills add berkcangumusisik/claude-code-practices --skill mock-gen --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Mock Gen?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Mock Gen
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/berkcangumusisik-mock-gen/badge)](https://www.skillsdirectory.com/skills/berkcangumusisik-mock-gen)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: mock-gen
description: Generates mock data factories and API mocks for testing
argument-hint: <type-or-interface-name>
user-invocable: true
allowed-tools: Read Grep Glob Edit
effort: low
---

## Generate Mocks

Target type/interface: **$ARGUMENTS**

1. Find the type definition:
```bash
grep -rn "interface $ARGUMENTS\|type $ARGUMENTS\s*=" src/ --include="*.ts" | head -5
```

2. Read the full type definition.

3. Generate a factory function:
```ts
// Generated mock factory
export function create$ARGUMENTS(overrides?: Partial<$ARGUMENTS>): $ARGUMENTS {
  return {
    id: faker.string.uuid(),
    name: faker.person.fullName(),
    email: faker.internet.email(),
    createdAt: faker.date.recent(),
    // ...all fields
    ...overrides,
  }
}
```

4. If `faker` or `@faker-js/faker` is not in the project, use inline test data patterns instead.

5. Also generate:
   - MSW handler if the project uses MSW (`src/mocks/`)
   - Array factory: `createMany$ARGUMENTS(n: number)`

6. Place in `src/__mocks__/` or `src/testing/factories/` - match project convention.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.