api-response-mocker

Generate realistic mock API responses with fake data. Use for testing, prototyping, or creating sample data for frontend development.

16 stars

Best use case

api-response-mocker is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Generate realistic mock API responses with fake data. Use for testing, prototyping, or creating sample data for frontend development.

Teams using api-response-mocker should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/api-response-mocker/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/backend/api-response-mocker/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/api-response-mocker/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How api-response-mocker Compares

Feature / Agentapi-response-mockerStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Generate realistic mock API responses with fake data. Use for testing, prototyping, or creating sample data for frontend development.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# API Response Mocker

Generate realistic mock API responses with fake data using Faker.

## Features

- **Schema-Based Generation**: Define response structure
- **Faker Integration**: Realistic fake data
- **Nested Objects**: Complex nested structures
- **Arrays**: Generate lists of objects
- **Relationships**: Reference other mock data
- **Multiple Formats**: JSON, XML output

## Quick Start

```python
from api_mocker import APIMocker

mocker = APIMocker()

# Generate user response
user = mocker.generate({
    "id": "uuid",
    "name": "name",
    "email": "email",
    "created_at": "datetime"
})

# Generate list of users
users = mocker.generate_list({
    "id": "uuid",
    "name": "name",
    "email": "email"
}, count=10)
```

## CLI Usage

```bash
# Generate from schema file
python api_mocker.py --schema user_schema.json --output user.json

# Generate list
python api_mocker.py --schema product.json --count 50 --output products.json

# Generate with seed (reproducible)
python api_mocker.py --schema order.json --seed 42 --output order.json

# Preview without saving
python api_mocker.py --schema customer.json --preview
```

## Schema Format

Define fields using Faker provider names:

```json
{
    "id": "uuid",
    "first_name": "first_name",
    "last_name": "last_name",
    "email": "email",
    "phone": "phone_number",
    "company": "company",
    "address": {
        "street": "street_address",
        "city": "city",
        "state": "state",
        "zip": "zipcode",
        "country": "country"
    },
    "created_at": "date_time_this_year",
    "is_active": "boolean"
}
```

## Available Data Types

### Personal
- `name`, `first_name`, `last_name`
- `email`, `safe_email`
- `phone_number`
- `ssn`

### Address
- `address`, `street_address`
- `city`, `state`, `state_abbr`
- `zipcode`, `postcode`
- `country`, `country_code`
- `latitude`, `longitude`

### Internet
- `url`, `domain_name`
- `ipv4`, `ipv6`
- `user_name`, `password`
- `uuid`, `uuid4`
- `mac_address`

### Business
- `company`, `company_suffix`
- `job`, `job_title`
- `bs`, `catch_phrase`

### Financial
- `credit_card_number`
- `iban`, `bban`
- `currency_code`
- `price` (custom: returns float)

### Date/Time
- `date`, `time`
- `date_time`, `date_time_this_year`
- `date_of_birth`
- `iso8601`

### Text
- `text`, `sentence`, `paragraph`
- `word`, `words`
- `slug`

### Numeric
- `random_int`, `random_number`
- `random_float` (use `{"type": "float", "min": 0, "max": 100}`)
- `boolean`

## Advanced Schemas

### Arrays
```json
{
    "id": "uuid",
    "name": "name",
    "tags": {
        "_array": true,
        "_count": 3,
        "_item": "word"
    },
    "orders": {
        "_array": true,
        "_count": 5,
        "_item": {
            "order_id": "uuid",
            "amount": "random_int",
            "date": "date"
        }
    }
}
```

### Custom Values
```json
{
    "id": "uuid",
    "status": {
        "_choice": ["pending", "active", "completed"]
    },
    "priority": {
        "_range": [1, 5]
    },
    "score": {
        "_float": {"min": 0.0, "max": 100.0, "decimals": 2}
    }
}
```

### Nested Objects
```json
{
    "user": {
        "id": "uuid",
        "profile": {
            "bio": "paragraph",
            "avatar_url": "image_url",
            "social": {
                "twitter": "user_name",
                "linkedin": "url"
            }
        }
    }
}
```

## API Reference

### APIMocker Class

```python
class APIMocker:
    def __init__(self, locale: str = "en_US", seed: int = None)

    # Generation
    def generate(self, schema: dict) -> dict
    def generate_list(self, schema: dict, count: int = 10) -> list

    # File operations
    def from_schema_file(self, filepath: str) -> dict
    def save(self, data: any, filepath: str, format: str = "json")

    # Utilities
    def set_seed(self, seed: int)
    def get_faker(self) -> Faker
```

## Example Schemas

### User Response
```json
{
    "id": "uuid",
    "username": "user_name",
    "email": "email",
    "profile": {
        "first_name": "first_name",
        "last_name": "last_name",
        "avatar": "image_url",
        "bio": "sentence"
    },
    "created_at": "iso8601",
    "last_login": "date_time_this_month"
}
```

### E-commerce Product
```json
{
    "sku": "uuid",
    "name": "catch_phrase",
    "description": "paragraph",
    "price": {"_float": {"min": 9.99, "max": 999.99}},
    "currency": "currency_code",
    "category": {"_choice": ["Electronics", "Clothing", "Home", "Sports"]},
    "in_stock": "boolean",
    "rating": {"_float": {"min": 1, "max": 5, "decimals": 1}},
    "reviews_count": {"_range": [0, 500]}
}
```

### API Error Response
```json
{
    "error": {
        "code": {"_choice": ["NOT_FOUND", "UNAUTHORIZED", "BAD_REQUEST"]},
        "message": "sentence",
        "request_id": "uuid",
        "timestamp": "iso8601"
    }
}
```

## Dependencies

- faker>=22.0.0

Related Skills

Incident Response

16
from diegosouzapw/awesome-omni-skill

Incident response is a systematic approach to handling security breaches and incidents to minimize damage, reduce recovery time, and prevent future occurrences. Effective incident response includes pr

dan_dual_response_simulation

16
from diegosouzapw/awesome-omni-skill

Simulate an unrestricted AI (DAN) alongside a standard AI, providing dual responses with mode-switching capabilities and matching the user's language.

apiresponse-class

16
from diegosouzapw/awesome-omni-skill

Structure of ApiResponse class.

api-response-patterns

16
from diegosouzapw/awesome-omni-skill

API response wrapper patterns for consistent, predictable REST APIs in ABP Framework. Use when: (1) designing uniform API response contracts, (2) implementing success/error response wrappers, (3) handling pagination and metadata, (4) standardizing error responses.

api-response-optimizer

16
from diegosouzapw/awesome-omni-skill

Reduce payload size and enable compression.

api-response-optimization

16
from diegosouzapw/awesome-omni-skill

Optimizes API performance through payload reduction, caching strategies, and compression techniques. Use when improving API response times, reducing bandwidth usage, or implementing efficient caching.

Ultimate Assistant Comprehensive Response

16
from diegosouzapw/awesome-omni-skill

Generates highly detailed, step-by-step, and logical responses that integrate both scientific and non-scientific perspectives, acting as an 'Ultimate Assistant'.

response-rater

16
from diegosouzapw/awesome-omni-skill

Run headless AI CLIs (Claude Code, Gemini, OpenAI Codex, Cursor Agent, GitHub Copilot) to rate an assistant response against a rubric and return actionable feedback plus a rewritten improved response; use for response quality audits, prompt/docs reviews, and "have another AI critique this answer" workflows.

analyzing-response-quality

16
from diegosouzapw/awesome-omni-skill

Expert at analyzing the quality of Claude's responses and outputs. Use when evaluating response completeness, accuracy, clarity, or effectiveness. Auto-invokes during self-reflection or when quality assessment is needed.

bgo

10
from diegosouzapw/awesome-omni-skill

Automates the complete Blender build-go workflow, from building and packaging your extension/add-on to removing old versions, installing, enabling, and launching Blender for quick testing and iteration.

Coding & Development

mcp-create-declarative-agent

16
from diegosouzapw/awesome-omni-skill

Skill converted from mcp-create-declarative-agent.prompt.md

MCP Architecture Expert

16
from diegosouzapw/awesome-omni-skill

Design and implement Model Context Protocol servers for standardized AI-to-data integration with resources, tools, prompts, and security best practices