migration-safety

migration-safety is a command for Claude Code from sigistry/marketplace. It costs 19 tokens per session (1,049 once invoked), scanned A, original, MIT.

A command that reviews database schema migrations, which change tables, columns, indexes, or constraints, for locking and data-backfill risks.

In plain words
What is it for?
Use it to detect hazardous migration steps and rewrite them into reversible expand-contract stages with a rollback plan.
Why use it?
It helps prevent deployments from blocking application traffic or rewriting large tables while users are relying on the system.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter. Also seen: model in frontmatter.

Part of the sql-safety-net plugin — 3 skills, 5 commands, 2 agents shipped together

Good fit Use it to detect hazardous migration steps and rewrite them into reversible expand-contract stages with a rollback plan.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/sigistry/marketplace/migration-safety
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/sigistry/marketplace

Made for: Claude Code.

Or install sql-safety-net, the plugin that ships this one along with the rest of its 3 skills, 5 commands, 2 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for migration-safety

README.md
[![agentmods](https://agentmods.dev/badge/commands/sigistry/marketplace/migration-safety/github.svg)](https://agentmods.dev/commands/sigistry/marketplace/migration-safety)
Your own site
<a href="https://agentmods.dev/commands/sigistry/marketplace/migration-safety"><img src="https://agentmods.dev/badge/commands/sigistry/marketplace/migration-safety/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for migration-safety

Your own site · 80×15
<a href="https://agentmods.dev/commands/sigistry/marketplace/migration-safety"><img src="https://agentmods.dev/badge/commands/sigistry/marketplace/migration-safety.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,049 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00019 $0.01049
Opus 5 $0.00010 $0.00524
Sonnet 5 $0.00004 $0.00210
Haiku 4.5 $0.00002 $0.00105

Measured 5d ago against content hash 9822b51a9509, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

migration-safety scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/sql-safety-net/commands/migration-safety.md · 60 lines

How it starts

The opening of the file, as written. The whole thing — 60 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Analyze the migration in $ARGUMENTS (or the migration files in the current diff if no path is given) for operations that take blocking table locks, rewrite the hazardous steps into a safe expand-contract sequence, and produce a paired rollback. This is a static analysis, no database connection is used. Load the safe-migrations skill for the lock catalog and expand-contract recipes.

Process

Step 1: Detect dialect and framework

Read the target file. Determine the dialect (Postgres vs MySQL/InnoDB, infer from types like serial/jsonb/text vs AUTO_INCREMENT/ENGINE=InnoDB, or from config). Determine the framework by file path and syntax:

Framework Signal
Raw SQL .sql, V1__*.sql, *.up.sql/*.down.sql
Alembic alembic/versions/, def upgrade()/downgrade(), op.
Django migrations/, class Migration, operations = [...]
Rails/ActiveRecord db/migrate/, class ... < ActiveRecord::Migration, change/up/down
Prisma prisma/migrations/, migration.sql
Flyway V<n>__*.sql, U<n>__*.sql
Liquibase changelog, <changeSet> XML/YAML
Knex / TypeORM / Sequelize / golang-migrate exports.up, queryRunner., queryInterface., *.up.sql

Step 2: Classify every DDL operation by lock

For each operation, look it up in the safe-migrations skill references (postgres-locks.md, mysql-locks.md). Flag the hazardous ones:

Hazard Lock taken Why it hurts
ADD COLUMN ... NOT NULL DEFAULT <volatile> ACCESS EXCLUSIVE + full rewrite Blocks all reads/writes while every row is rewritten
ALTER COLUMN ... TYPE ACCESS EXCLUSIVE + rewrite Full-table rewrite under exclusive lock
ADD CONSTRAINT NOT NULL / CHECK (validated) ACCESS EXCLUSIVE + full scan Blocks writes during validation
CREATE INDEX (non-CONCURRENTLY) SHARE (blocks writes) Writes queued for the whole build
ADD FOREIGN KEY (validated) SHARE ROW EXCLUSIVE on both tables Blocks writes, scans child table
Column rename / drop in one deploy ACCESS EXCLUSIVE + breaks running app code Old deploy still references old name

Read the full file on GitHub · 60 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 60 lines · 19 tokens per session scan A 9822b51a9509

Subscribe to this mod's changes

migration-safety is a command published in the GitHub repository sigistry/marketplace (3 stars, last pushed 4d ago), licensed MIT. It adds 19 tokens to every session and 1,049 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.