seed

Generate FK-aware, deterministic sample/seed data from a database schema, ORM model, or migrations — INSERT statements emitted in dependency order (parents first), values derived from row index so output is stable and reviewable. Read-only; never writes to a database. For dev/test fixtures only. Use when the user asks to seed, generate sample/test/fixture/dummy/fake data, populate tables, or create starter rows for Postgres, MySQL, SQLite, and friends.

hainrixz/claude-db57 installsMITSynced Aug 27

Works with

Claude CodeCursorCodex CLIGitHub CopilotGemini CLI
---
name: seed
description: Generate FK-aware, deterministic sample/seed data from a database schema, ORM model, or migrations — INSERT statements emitted in dependency order (parents first), values derived from row index so output is stable and reviewable. Read-only; never writes to a database. For dev/test fixtures only. Use when the user asks to seed, generate sample/test/fixture/dummy/fake data, populate tables, or create starter rows for Postgres, MySQL, SQLite, and friends.
license: MIT
---

# /claude-db:seed

Generates **FK-aware, deterministic** sample/seed `INSERT`s from a schema. **Read-only** — it never connects to or writes to a database. The output is **dev/test data only**: predictable values derived from the row index (no RNG), suitable for fixtures, local development, and CI — never for production.

`$ARGUMENTS` = `<path-to-schema> [flags]`. The target is a schema/DDL, ORM model, or migration file. If no path is given, detect one in the working directory (look for `*.sql`, `schema.prisma`, `models.py`, migration dirs). If nothing is found, say so plainly and suggest pointing at a file or running `/claude-db:design` to create one.

## What to do
1. Resolve the schema path (from `$ARGUMENTS` or detection above).
2. Run the generator:
   ```bash
   node scripts/gen-seed.mjs --file <schema> --rows N [--format sql|json]
   ```
   - `--rows N` defaults to 5 (clamped 1–1000). `--format` defaults to `sql`; `json` returns the statements as an array plus metadata.
   - The script topologically sorts tables so each table's FK parents are inserted **first**, fills FK columns with valid parent ids, and skips auto-increment/identity PKs.
3. Present the result:
   - The **insert order** (dependency order, parents → children) and per-table row counts.
   - The generated **`INSERT` statements**, grouped by table in that order.
   - The parser **confidence** and any tables skipped or cycles ignored.
4. Offer to **save to a file** (e.g. `seed.sql` or `fixtures.json`) — only write if the user confirms a path. Otherwise leave it inline.

## Notes
- Deterministic by design: re-running with the same `--rows` yields byte-identical output, so seeds are diff-friendly and reproducible.
- Values are illustrative placeholders (emails like `user1@example.com`, fixed timestamps, sequential ids) — **not** realistic or privacy-safe production data.
- Cyclic FKs are ignored for ordering; deferred-constraint or self-referential cases may need a manual pass after generation.

For **dev/test fixtures only**. Never run generated seeds against a production database. Respond in the user's language (EN/ES).

More Database skills

supabase-postgres-best-practices

supabase/agent-skills

Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pg_cron, pgmq), vector/semantic search (pgvector), and restoring dumps (pg_restore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.

372.5k

prisma-database-setup

prisma/skills

Guides for configuring Prisma with different database providers (PostgreSQL, MySQL, SQLite, MongoDB, etc.). Use when setting up a new project, changing databases, or troubleshooting connection issues. Triggers on "configure postgres", "connect to mysql", "setup mongodb", "sqlite setup".

241.5k

prisma-postgres

prisma/skills

Prisma Postgres setup and operations guidance across Console, create-db CLI, Management API, and Management API SDK. Use when creating Prisma Postgres databases, working in Prisma Console, provisioning with create-db/create-pg/create-postgres, or integrating programmatic provisioning with service tokens or OAuth.

235.0k

← All Database skills

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY