seed
Installation
SKILL.md
/claude-db:seed
Generates FK-aware, deterministic sample/seed INSERTs 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
- Resolve the schema path (from
$ARGUMENTSor detection above). - Run the generator:
node scripts/gen-seed.mjs --file <schema> --rows N [--format sql|json]--rows Ndefaults to 5 (clamped 1–1000).--formatdefaults tosql;jsonreturns 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.
- Present the result:
- The insert order (dependency order, parents → children) and per-table row counts.
- The generated
INSERTstatements, grouped by table in that order. - The parser confidence and any tables skipped or cycles ignored.
- Offer to save to a file (e.g.
seed.sqlorfixtures.json) — only write if the user confirms a path. Otherwise leave it inline.