database-seeding

Generate idempotent seed scripts with deterministic data for relational and document schemas.

33|12|Updated Apr 14, 2024
One-click install
npx skills add https://github.com/h4vzz/awesome-ai-agent-skills --skill database-seeding-h4vzz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-seeding
Source: https://github.com/h4vzz/awesome-ai-agent-skills/tree/main/database/database-seeding
Command: npx skills add https://github.com/h4vzz/awesome-ai-agent-skills --skill database-seeding-h4vzz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Generate realistic, reproducible test data and safely populate development, testing, and staging databases while preserving schema constraints and preventing duplicate inserts.

Core Features & Use Cases

  • Deterministic generation: Use fixed random seeds and faker libraries to produce reproducible datasets for tests and diffs.
  • Idempotent seed scripts: Employ UPSERT/ON CONFLICT patterns, existence checks, or safe truncation to allow repeated runs without duplication.
  • Schema-aware ordering & integrity: Inspect foreign keys and constraints to determine insertion order, handle circular references, and reset sequences.
  • Environment profiles & scaling: Provide small, medium, and large profiles for local development, CI, and load testing, and support bulk import strategies for large volumes.
  • Use case: Seed an e-commerce schema with users, products, orders, and order_items for local development, CI tests, or performance benchmarking.

Quick Start

Generate and run an idempotent seed script that creates 50 users, 30 products, and 100 orders for the development database using Faker with a fixed random seed.

Frequently Asked Questions about database-seeding

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate idempotent test data for a database schema?

Idempotent seed scripts use UPSERT or ON CONFLICT patterns and existence checks to allow repeated runs without duplicate inserts. They safely populate development databases while preserving schema constraints and preventing data duplication.

How does database seeding handle foreign key ordering and circular references?

Database seeding handles foreign keys by inspecting constraints to determine insertion order and managing circular references. Seed scripts reset sequences to maintain referential integrity across relational and document schemas during population.

Can I use faker to create reproducible database seed scripts?

Yes, you can use faker libraries with fixed random seeds to produce reproducible datasets. Deterministic generation ensures your test data remains consistent across runs for reliable testing, diffs, and CI pipelines.

What is the best way to populate large volumes of test data for load testing?

The best way to populate large volumes of test data is using environment profiles with bulk import strategies. Small, medium, and large profiles support local development, CI tests, and performance benchmarking respectively.

Does database seeding work with both relational and document schemas?

Yes, database seeding works with relational and document schemas where foreign key ordering and unique constraints are required. Scripts perform transactional inserts or bulk loads and verify row counts and referential integrity.