GE

generating-database-seed-data

Automatically creates realistic seed data and SQL scripts based on your database schema and foreign key relationships.

Install

mkdir -p .claude/skills/generating-database-seed-data && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1203" && unzip -o skill.zip -d .claude/skills/generating-database-seed-data && rm skill.zip

Installs to .claude/skills/generating-database-seed-data

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Process this skill enables AI assistant to generate realistic test data
71 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Analyze database schema to catalog tables, columns, and relationships.
  • Determine seeding order by topologically sorting the dependency graph.
  • Map columns to Faker generators based on name and data type.
  • Generate foreign key values by referencing previously inserted parent records.
  • Handle unique constraints by tracking generated values and regenerating on collision.
  • Generate seed scripts in SQL, TypeScript, Python, or JavaScript format.

How it works

The skill analyzes a database schema to build a dependency graph, then uses Faker libraries to generate data according to column types and constraints.

Inputs & outputs

You give it
Database schema definition, target data volume per table
You get back
Seed script files, Faker configuration, dependency order, validation queries, volume configuration

When to use generating-database-seed-data

  • Generate test data for dev environments
  • Create SQL seed scripts
  • Populate tables based on schema constraints
  • Maintain referential integrity in mock data

About this skill

Data Seeder Generator

Overview

Generate realistic database seed scripts that populate development and testing environments with representative data. This skill creates seed data that respects foreign key relationships, unique constraints, check constraints, and data type validations using Faker libraries (faker.js, Faker for Python, or raw SQL with random functions).

Prerequisites

  • Database schema definition (SQL DDL, ORM models, or Prisma schema) to understand table structures
  • Target database connection for schema introspection (optional, can work from DDL files)
  • Faker library available: @faker-js/faker (Node.js), faker (Python), or Bogus (.NET)
  • Knowledge of referential integrity constraints (foreign keys, cascades)
  • Target data volume per table (e.g., 100 users, 1000 orders, 5000 line items)

Instructions

  1. Analyze the database schema to catalog all tables, columns, data types, constraints, and foreign key relationships. Build a dependency graph where parent tables (referenced by foreign keys) must be seeded before child tables.

  2. Determine the seeding order by topologically sorting the dependency graph. Tables with no foreign keys are seeded first (users, categories, products), then tables referencing them (orders, reviews), then junction tables and deeply nested tables last.

  3. Map each column to an appropriate Faker generator based on column name and data type:

    • first_name, last_name -> faker.person.firstName(), faker.person.lastName()
    • email -> faker.internet.email() with unique enforcement
    • phone -> faker.phone.number()
    • address, city, state, zip -> faker.location.*
    • created_at, updated_at -> faker.date.between({ from: '2023-01-01', to: '2024-12-31' })
    • price, amount -> faker.commerce.price({ min: 1, max: 999 })
    • description, bio -> faker.lorem.paragraph()
    • status -> Random selection from CHECK constraint values or enum values
    • uuid -> faker.string.uuid()
  4. Generate foreign key values by referencing previously inserted parent records. Store parent IDs in arrays during generation and randomly select from them for child records. Ensure every parent has at least one child (if the relationship is expected) and distribute children realistically (e.g., Zipf distribution where some users have many orders, most have few).

  5. Handle unique constraints by tracking generated values in a Set and regenerating on collision. For email addresses, append a counter or use faker.internet.email({ firstName, lastName }) with unique names.

  6. Respect CHECK constraints and ENUM types by reading the allowed values from the schema and restricting random selection to valid options. For range constraints (CHECK (age >= 18 AND age <= 120)), configure Faker to generate within the valid range.

  7. Generate the seed script in the appropriate format:

    • Raw SQL: INSERT INTO users (name, email, ...) VALUES ('John Doe', '[email protected]', ...); with proper escaping
    • TypeORM/Prisma: TypeScript seed file using prisma.user.createMany() or repository.save()
    • Django: Python fixtures in JSON format or management command
    • Knex: JavaScript seed file using knex('users').insert([...])
  8. Make seed scripts idempotent: wrap in a transaction, truncate target tables in reverse dependency order before inserting, or use upsert operations (ON CONFLICT DO NOTHING).

  9. Add configurable volume control: accept a scale factor parameter that multiplies base counts (scale=1: 100 users, scale=10: 1000 users). Maintain consistent ratios between related tables (1 user : 5 orders : 15 line items).

  10. Validate the generated seed data by running it against an empty database, then checking: all foreign key references resolve, unique constraints hold, check constraints pass, and row counts match expectations.

Output

  • Seed script files in SQL, TypeScript, Python, or JavaScript format
  • Faker configuration mapping columns to appropriate generators
  • Dependency order listing the correct table insertion sequence
  • Validation queries to verify seed data integrity after insertion
  • Volume configuration with scale factor and per-table row counts

Error Handling

ErrorCauseSolution
Foreign key constraint violation during seedingChild records reference parent IDs that do not existVerify seeding order follows dependency graph; ensure parent seed completes before child seed starts
Unique constraint violationFaker generated duplicate values for unique columnsTrack generated values in a Set; use faker.helpers.unique() wrapper; append sequential suffix for high-volume unique fields
CHECK constraint violationGenerated value outside allowed range or not in enum listRead CHECK constraints from schema; configure Faker min/max ranges; restrict enum selection to valid values
Seed script too slow for large volumesIndividual INSERT statements instead of batch operationsUse batch inserts (INSERT INTO ... VALUES (...), (...), (...)); use COPY command for PostgreSQL; disable indexes during bulk insert
Unrealistic data distributionAll records have uniform random valuesUse weighted random selection for status fields; apply Zipf distribution for popularity-based relationships; generate time-series data with realistic patterns

Examples

Seeding an e-commerce database with 10,000 orders: Generate 500 users, 200 products across 15 categories, 10,000 orders (distributed over 12 months with higher volume in November-December), and 35,000 line items. Each order has 1-5 line items, prices follow a realistic distribution ($5-$500 with most under $50), and order statuses follow a funnel pattern (70% delivered, 15% shipped, 10% processing, 5% cancelled).

Creating test data for a multi-tenant SaaS application: Generate 5 tenants, each with 20-100 users, organization settings, and tenant-specific data. Tenant isolation is maintained in seed data by assigning all records to a specific tenant_id. One "demo" tenant has curated showcase data with meaningful names and descriptions.

Populating a social media prototype: Generate 1,000 users with profile photos (sample image URLs from picsum.photos), 5,000 posts with timestamps following a realistic posting pattern (more activity on weekdays, peak at noon), 15,000 comments with reply threading (30% of comments are replies to other comments), and 50,000 likes distributed by post popularity.

Resources

Prerequisites

Database schema definition (SQL DDL, ORM models, or Prisma schema)Target database connection for schema introspection (optional)Faker library available: @faker-js/faker (Node.js), faker (Python), or Bogus (.NET)Knowledge of referential integrity constraints

Limitations

  • Foreign key constraint violation during seeding if order is incorrect.
  • Unique constraint violation if Faker generates duplicates.
  • CHECK constraint violation if generated values are outside allowed ranges.

How it compares

This skill automates the creation of realistic, referentially-sound seed data and scripts, unlike manual data entry or simple random generation.

Compared to similar skills

generating-database-seed-data side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
generating-database-seed-data (this skill)1026dReviewIntermediate
database-design66moReviewIntermediate
vector-database-engineer84moNo flagsAdvanced
database-schema-designer66moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

generating-trading-signals

jeremylongshore

Generate trading signals using technical indicators (RSI, MACD, Bollinger Bands, etc.). Combines multiple indicators into composite signals with confidence scores. Use when analyzing assets for trading opportunities or checking technical indicators. Trigger with phrases like "get trading signals", "check indicators", "analyze for entry", "scan for opportunities", "generate buy/sell signals", or "technical analysis".

725

You might also like

database-design

davila7

Database design principles and decision-making. Schema design, indexing strategy, ORM selection, serverless databases.

648

vector-database-engineer

sickn33

Expert in vector databases, embedding strategies, and semantic search implementation. Masters Pinecone, Weaviate, Qdrant, Milvus, and pgvector for RAG applications, recommendation systems, and similar

846

database-schema-designer

davila7

Design robust, scalable database schemas for SQL and NoSQL databases. Provides normalization guidelines, indexing strategies, migration patterns, constraint design, and performance optimization. Ensures data integrity, query performance, and maintainable data models.

628

analyzing-query-performance

jeremylongshore

Execute use when you need to work with query optimization. This skill provides query performance analysis with comprehensive guidance and automation. Trigger with phrases like "optimize queries", "analyze performance", or "improve query speed".

18

databases

mrgoonie

Work with MongoDB (document database, BSON documents, aggregation pipelines, Atlas cloud) and PostgreSQL (relational database, SQL queries, psql CLI, pgAdmin). Use when designing database schemas, writing queries and aggregations, optimizing indexes for performance, performing database migrations, configuring replication and sharding, implementing backup and restore strategies, managing database users and permissions, analyzing query performance, or administering production databases.

16

schema-designer

clidey

Help design database schemas, create tables, and plan data models. Activates when users ask to create tables, design schemas, or model data relationships.

15

Search skills

Search the agent skills registry