Migration Safety Pro

Production-safe database migrations with zero-downtime strategies, batch backfilling, and multi-ORM support.

Install
cmdop skills install agensi-migration-safety-pro

Migration Safety Pro is a skill that gives an AI agent a structured blueprint for executing database schema changes without causing downtime or data loss. Rather than generating generic migration SQL, it applies industry-standard safety protocols including the Expand-Contract pattern, Ghost Tables, and Batch Backfilling to ensure every change is backward-compatible and safe for production environments.

The skill covers a broad set of frameworks and tools: Prisma, TypeORM, Sequelize, and Knex.js on Node.js; Alembic (SQLAlchemy) and Django Migrations for Python; Rails Active Record and golang-migrate for Ruby and Go; and Liquibase for enterprise environments. Supported databases include PostgreSQL, MySQL, MariaDB, SQLite, and SQL Server.

When an agent uses this skill, it produces structured migration plans that include a safety risk assessment, a multi-step execution strategy separating the Expand phase from the Contract phase, framework-specific code snippets, and a concrete rollback procedure. It identifies risks such as table locks on large tables and suggests non-blocking approaches like creating indexes CONCURRENTLY in PostgreSQL.

This skill is designed for situations where default ORM migration behavior is insufficient — particularly high-traffic environments or databases with large datasets where an unguarded ALTER TABLE could lock tables and cause significant production incidents.

Use cases

  • Generate a zero-downtime migration plan for adding a non-nullable column to a PostgreSQL table with millions of rows
  • Produce an Expand-Contract migration strategy for renaming a column without breaking live application code
  • Get framework-specific safe migration code for Django or Alembic when backfilling large datasets in batches
  • Identify table-lock risks before running a schema change and receive non-blocking index creation alternatives
  • Create a mandatory rollback script alongside each migration step to enable safe reversal if a deployment fails
  • Plan a multi-phase schema migration across Rails Active Record or Liquibase for an enterprise deployment

When to use it

  • When running schema migrations on high-traffic production databases where downtime is not acceptable
  • When working with large tables where naive ALTER TABLE statements would cause table locks
  • When the migration involves multiple frameworks or ORMs and framework-specific safe patterns are needed
  • When a migration must be backward-compatible to support rolling deployments across multiple application versions

When not to use it

  • When the database is not one of the supported targets (PostgreSQL, MySQL, MariaDB, SQLite, SQL Server)
  • When the ORM or migration framework in use is not among the supported list (Prisma, TypeORM, Sequelize, Knex.js, Alembic, Django, Rails Active Record, golang-migrate, Liquibase)
  • When the task is query optimization or general database administration rather than schema migration planning
  • When a NoSQL or document database is in use, as this skill covers relational databases only