db-seed

Applies idempotent SQL seed files to a Supabase database with validation, snapshots, and verification.

3|Updated Feb 7, 2026
One-click install
npx skills add https://github.com/gabrielnsmnto/kord-aios --skill db-seed-gabrielnsmnto
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: db-seed
Source: https://github.com/gabrielnsmnto/kord-aios/tree/main/src/features/builtin-skills/kord-aios/database/db-seed
Command: npx skills add https://github.com/gabrielnsmnto/kord-aios --skill db-seed-gabrielnsmnto

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Applying seed data to a database is risky: non-idempotent scripts fail on re-runs, destructive statements can wipe data, and there is often no rollback plan. This Skill enforces a safe, repeatable seeding workflow with pre-flight checks, snapshots, and verification. ## Core Features & Use Cases - Idempotency Validation: Scans the seed file for dangerous patterns like TRUNCATE or DELETE and confirms ON CONFLICT usage before execution. - Snapshot and Rollback: Creates a timestamped pg_dump snapshot before seeding so you can restore if the seed fails. - Verification and Logging: Runs row-count verification queries and appends an entry to a SEED_LOG.md audit file after each run. - Use Case: You have a new categories seed file for your Supabase project. Run the skill to validate it is idempotent, snapshot the current schema, apply the seed in a transaction, and log the operation. ## Quick Start Ask the agent to apply the seed file at supabase/seeds/categories.sql to the database using the db-seed workflow.

Frequently Asked Questions about db-seed

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

FAQPage Schema
How do I safely apply a SQL seed file to a Supabase database?▼

Validate the seed file for idempotent patterns like ON CONFLICT, create a pg_dump snapshot, then apply it with psql using ON_ERROR_STOP so failures abort the transaction. Verify row counts afterward and log the operation.

How do I make a database seed script idempotent?▼

Use INSERT ... ON CONFLICT (id) DO UPDATE for upserts, or INSERT ... WHERE NOT EXISTS for conditional inserts. Avoid plain INSERT statements that fail on re-runs and never use TRUNCATE in production seeds.

Can I roll back a failed database seed?▼

Yes. The workflow creates a timestamped pg_dump schema snapshot before seeding, stored under supabase/snapshots. If the seed fails, you can restore from that snapshot to recover the prior state.

Why does my seed script fail when run a second time?▼

The script likely uses plain INSERT statements without conflict handling, causing unique constraint violations on re-run. Rewrite it with ON CONFLICT clauses or WHERE NOT EXISTS guards to make it idempotent.

Is it safe to run seed scripts against a production database?▼

Seeding production requires explicit confirmation and should never include TRUNCATE or DELETE statements. Always test seeds in dev or staging first and keep a pre-seed snapshot for rollback.