seed-safety

Verify database seed and migration runs with pre-flight and post-run count checks.

Updated Mar 28, 2026
One-click install
npx skills add https://github.com/akirschke15-cmd/Cato-Registry --skill seed-safety
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: seed-safety
Source: https://github.com/akirschke15-cmd/Cato-Registry/tree/main/.claude/skills/seed-safety
Command: npx skills add https://github.com/akirschke15-cmd/Cato-Registry --skill seed-safety

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents accidental data loss, duplicate seeding, and unsafe migration execution by forcing a verified, idempotent, and repeatable pre-flight and post-flight protocol.

Core Features & Use Cases

  • Pre-flight DB baseline checks: Verifies project root, captures an initial row count for the target table, and detects overlap using known identifiers (slugs, names, SKUs).
  • One-time execution with immediate verification: Runs the seed or migration exactly once and re-checks the target row count to confirm the expected delta.
  • Failure-safe behavior: If counts don’t match, it blocks re-runs, directs investigation for duplicates/anomalies, and waits for user direction before any cleanup.

Quick Start

Run the skill before executing your database seed or migration to ensure you verify the working directory, capture a baseline row count, run once, and confirm the exact expected delta.

Frequently Asked Questions about seed-safety

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

FAQPage Schema
How do I prevent duplicate data when running database seeds?

To prevent duplicate database seeding, you need an idempotent execution protocol that checks known identifiers like slugs or SKUs against existing records before running. This ensures scripts only add the expected data delta without creating overlapping entries.

What is idempotent database seeding and how does it work?

Idempotent database seeding is a safe execution method that captures a baseline row count, runs the seed script exactly once, and verifies the post-run count matches the expected delta. This prevents accidental data loss or duplicate insertions during repeated migrations.

How do I safely execute Prisma migrations and seed scripts?

Safe Prisma migration execution requires validating your working directory, capturing a pre-flight row count, running the command once, and immediately verifying the post-run count. If counts mismatch, block re-runs and investigate anomalies before proceeding.

What should I do if my database seed row count doesn't match expectations?

When database seed verification fails and row counts mismatch, block any re-runs immediately. Investigate for duplicate records or data anomalies, and wait for explicit user direction before attempting any cleanup or rollback procedures.

How do I check for existing data overlap before running a database migration?

To check for data overlap before a migration, perform a pre-flight baseline check using known identifiers like slugs, names, or SKUs. This detects existing entries in the target table to prevent duplicate seeding and ensure safe execution.

Can I run database seeds multiple times without corrupting data?

Running database seeds multiple times requires idempotent execution with pre-flight baseline checks and post-run verification to ensure data integrity. If a failure occurs with ambiguous results, block any re-run to prevent corruption until the issue is resolved.