Migration safety
Guardrails, skills, loops, hooks & review agents for database + website builders on Claude Code (Next.js + Supabase).
npx -y skills add m-binimran/dev-pack --skill migration-safetyAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Generate safe, reversible Postgres/Supabase migrations using the expand→backfill→contract pattern, avoiding locks and data loss. Use when altering schema, adding/removing columns, or changing types on tables that already hold data.
SKILL.md
1.6 KB, as published. Nobody here has run it
migration-safety
Every migration must be reversible and must not lock a busy table or drop data by surprise.
(The migration-validate hook checks your output — design to pass it.)
Always produce a pair
up: the change.down: the exact rollback. If a change is truly irreversible (dropping data), say so loudly and require explicit confirmation.
Expand → backfill → contract (for column changes)
- Expand: add the new column/table, nullable, no constraint. Cheap, non-locking.
- Backfill: populate in batches (
update ... where id between ...), not one giant statement. - Contract: add the
NOT NULL/constraint and drop the old column — in a later migration, after the app writes both.
Locking traps to avoid
ADD COLUMN ... NOT NULLwith noDEFAULTon a non-empty table → fails / full rewrite. Add a default.ALTER COLUMN TYPE→ rewrites + locks. Prefer add-new-column + backfill.- Creating an index on a hot table → use
CREATE INDEX CONCURRENTLY(outside a txn).
Output
upSQL,downSQL, and a one-line risk note (lock risk / data-loss risk / safe).- For destructive steps, an explicit "this cannot be undone" line.
Guardrails
- No migration without a rollback path.
- Never combine a destructive drop with the additive change in the same migration — separate them.