home / skills / openclaw / skills / ai-mock-data

ai-mock-data skill

/skills/lxgicstudios/ai-mock-data

This skill generates realistic mock data from TypeScript types to speed up tests and development.

npx playbooks add skill openclaw/skills --skill ai-mock-data

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1.3 KB
---
name: mock-data
description: Generate realistic mock data from TypeScript types
---

# Mock Data Generator

Give it your types, get realistic fake data. Perfect for tests and development.

## Quick Start

```bash
npx ai-mock-data ./src/types/User.ts
```

## What It Does

- Reads TypeScript interfaces
- Generates realistic fake data
- Understands field names (email, phone, etc.)
- Creates arrays with varied data

## Usage Examples

```bash
# Generate from type file
npx ai-mock-data ./src/types/Order.ts

# Generate specific count
npx ai-mock-data ./types/User.ts --count 50

# Output as JSON file
npx ai-mock-data ./types/Product.ts --out ./fixtures/products.json

# Generate for specific type
npx ai-mock-data ./types/index.ts --type Customer
```

## Output Example

```json
[
  {
    "id": "usr_8x7k2m",
    "email": "[email protected]",
    "name": "Sarah Chen",
    "createdAt": "2024-01-15T09:23:00Z"
  }
]
```

## Smart Field Detection

- `email` → realistic emails
- `phone` → formatted phone numbers
- `address` → real-looking addresses
- `price` → appropriate currency values

## Requirements

Node.js 18+. OPENAI_API_KEY required.

## License

MIT. Free forever.

---

**Built by LXGIC Studios**

- GitHub: [github.com/lxgicstudios/ai-mock-data](https://github.com/lxgicstudios/ai-mock-data)
- Twitter: [@lxgicstudios](https://x.com/lxgicstudios)

Overview

This skill generates realistic mock data from TypeScript types to speed up testing and development. It reads TypeScript interfaces and produces varied, believable JSON fixtures with smart field detection (emails, phones, addresses, prices). It requires Node.js 18+ and an OPENAI_API_KEY for best results.

How this skill works

The tool parses your TypeScript type files, identifies interfaces and their fields, then maps common field names to realistic generators (email → realistic email, phone → formatted number, etc.). You can request a specific type, control the output count, and write the result to a JSON file for immediate use in tests or dev environments.

When to use it

  • Seed test databases with realistic-looking sample records
  • Create front-end fixtures for UI development and storybooks
  • Generate varied datasets for performance or integration tests
  • Produce example API responses during offline development
  • Quickly mock data for demos and prototypes

Best practices

  • Annotate types clearly and keep names descriptive (email, phone, price) for accurate detection
  • Use --count to generate diverse arrays instead of repeating single entries
  • Point the tool at index files to generate multiple types at once
  • Commit generated fixtures when they serve as stable test data
  • Validate generated data formats in CI if you rely on strict schemas

Example use cases

  • npx ai-mock-data ./src/types/User.ts --count 50 to create a user fixture for integration tests
  • Generate a products.json file for a storefront demo with realistic prices and descriptions
  • Create address-rich datasets to test geolocation and formatting logic
  • Produce varied order records to exercise pagination and sorting in the backend

FAQ

What do I need to run this?

Node.js 18+ and an OPENAI_API_KEY environment variable are required for generation.

Can I target a single type in a file?

Yes — use the --type flag to specify which TypeScript type or interface to generate.