migration-guard

Reviews database migrations for reversibility, data loss, and backward compatibility before deployment.

15|22|Updated May 5, 2024
One-click install
npx skills add https://github.com/brayandiazc/project-starter-template-es-ai --skill migration-guard-brayandiazc
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: migration-guard
Source: https://github.com/brayandiazc/project-starter-template-es-ai/tree/main/.claude/skills/migration-guard
Command: npx skills add https://github.com/brayandiazc/project-starter-template-es-ai --skill migration-guard-brayandiazc

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Deploying an unsafe database migration can cause data loss, downtime, or failed rollbacks. This Skill reviews a schema or data migration against the project's database conventions before it ships, flagging destructive or blocking operations. ## Core Features & Use Cases - Reversibility Check: Verifies that a working down/rollback path exists, or that irreversibility is explicitly documented and justified. - Data Loss & Compatibility Analysis: Detects destructive steps (dropped columns, narrowed types, NOT NULL without defaults) and checks whether old and new code can coexist during zero-downtime rollouts using expand-migrate-contract. - Locking & Rollback Planning: Flags long-blocking operations on large tables, suggests safer variants, and confirms idempotency and a rollback plan. - Use Case: Before merging a pull request that adds a NOT NULL column to a large production table, ask for a review and receive a verdict with concrete risks and the minimal changes needed to make the migration safe. ## Quick Start Ask the assistant to review the migration in the current diff and confirm whether it is safe to deploy.

Frequently Asked Questions about migration-guard

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

FAQPage Schema
How do I check if a database migration is safe to deploy?▼

Review the migration for reversibility, data loss, backward compatibility, and table locking before deploying. This Skill reads the project's database conventions, inspects the migration or current diff, and returns a verdict with concrete risks and minimal fixes.

How to make a database migration reversible?▼

Provide a working down/rollback migration that restores the prior schema, or explicitly document the change as irreversible with justification. The review verifies the rollback path exists and that the migration is idempotent and safe to retry.

What is the expand-migrate-contract pattern for zero-downtime deployments?▼

Expand-migrate-contract deploys schema changes in additive stages so old and new code coexist during rollout, instead of one breaking change. The review checks backward compatibility and prefers this pattern for zero-downtime deployments.

Why is adding a NOT NULL column without a default risky on large tables?▼

Adding a NOT NULL column without a default or backfill can rewrite or lock large tables for a long time, causing downtime. The review flags such operations and suggests the safer variant for the project's database.

Does this tool execute or modify the migration?▼

No, it only reviews the migration and never executes it. It also does not relax the project's database rules to make a migration pass; instead it recommends fixing the migration and recording significant decisions as an ADR.