Skip to content
json-schema-faker logo

JSON Schema Faker Skill

json-schema-faker

Generate realistic fake data from JSON schemas, producing 1-50 valid records that conform exactly to the schema. Use when creating sample datasets from schema definitions, populating test databases, or generating example API responses. Returns only valid JSON that passes schema validation.

SKILL.md

Full skill instructions

JSON Schema Faker Skill

Generate realistic fake data from JSON schemas with guaranteed validity.

Quick Start

When you have a JSON schema and need realistic sample data:

node scripts/​generate-fake-data.mjs /​path/​to/​schema.json 25

This generates 25 valid records conforming to your schema.

Requirements

Install dependencies first:

npm install @json-schema-faker/​core ajv

How It Works

  1. Parse schema - Loads and validates your JSON schema
  2. Configure faker - Sets up realistic data generation with custom rules
  3. Generate records - Creates 1-50 records using faker
  4. Validate output - Validates each record against the schema
  5. Return JSON - Outputs only valid records as pretty-printed JSON

Features

Schema Compliance: All generated records are validated against the schema—only valid JSON is returned.

Realistic Data: Uses faker.js with domain-specific extensions (currency codes, country codes, time windows) to produce realistic data beyond simple random strings.

Customizable: Specify 1-50 records. Script auto-caps at 50.

Error Handling: Handles generation failures gracefully; reports warnings for records that couldn't be generated after multiple attempts.

Usage

Basic Generation

node scripts/​generate-fake-data.mjs schema.json 10

Generates 10 records from schema.json, outputs JSON to stdout.

Specify Record Count

node scripts/​generate-fake-data.mjs schema.json 50

Records are capped at 50 maximum. If omitted, defaults to 10.

Save to File

node scripts/​generate-fake-data.mjs schema.json 30 > output.json

Improving Data Quality

The faker library generates realistic data based on schema hints. To improve data quality:

  1. Add format hints: Use "format": "email", "format": "date", "format": "uri"
  2. Add faker directives: Use "faker": "name.firstName" to guide generation
  3. Use enums: For constrained fields, provide valid options
  4. Set constraints: Use minimum, maximum, minLength, maxLength appropriately
  5. Avoid overly restrictive patterns: Very complex regex patterns may cause generation to fail

See references/​faker-customization.md for detailed customization options and available faker methods.

Example: Accommodation Listings

Given a schema for accommodation listings (with faker hints for currency and country), the skill generates realistic data like:

[
  {
    "id": "listing_ashdod_001",
    "title": "Beachfront Apartment",
    "type": "apartment",
    "location": {
      "city": "Ashdod",
      "countryCode": "IL",
      "distanceToBeachMinutes": 5,
      "coordinates": { "lat": 31.8, "lng": 34.65 }
    },
    "rating": { "score": 8.5, "count": 45 },
    "pricePreview": {
      "currency": "USD",
      "nightly": 180,
      "total": 540,
      "nights": 3
    },
    ...
  }
]

Troubleshooting

"Could not generate valid record": The schema may have constraints that conflict (e.g., minLength > maxLength). Review your schema constraints.

"Failed to parse schema": Ensure the schema file is valid JSON.

Too few records generated: Some schemas have tight constraints. Increase attempts or relax schema constraints.

Advanced Customization

To add custom faker methods beyond the built-in ones (currencyCode, countryCode, timeWindow), edit the setupFaker() function in scripts/​generate-fake-data.mjs.

Example: Add a custom "accommodationType" method:

faker.accommodationType = () => {
  const types = ['apartment', 'house', 'hotel', 'bnb']
  return faker.random.arrayElement(types)
}

Then use in your schema:

{
  "type": "string",
  "faker": "accommodationType"
}

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View