agentsclimarketplace

Migration safety

Skill m-binimran/dev-pack/skills/migration-safety

Guardrails, skills, loops, hooks & review agents for database + website builders on Claude Code (Next.js + Supabase).

Install
npx -y skills add m-binimran/dev-pack --skill migration-safety

Assembled 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)

  1. Expand: add the new column/table, nullable, no constraint. Cheap, non-locking.
  2. Backfill: populate in batches (update ... where id between ...), not one giant statement.
  3. 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 NULL with no DEFAULT on 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

  • up SQL, down SQL, 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.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.