Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Zero-Downtime DB Migration Safety Gate

    1

    Block table-locking PostgreSQL/MySQL DDL and breaking schema drops before they take down production during rolling deploys—with a read-only analyzer, Expand-and-Contract rewrites, and rollback runbooks.

    $7

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    Zero-Downtime DB Migration Safety Gate

    Zero-Downtime DB Migration Safety Gate

    Example session with this skill installed

    Review our pending Postgres migration migrations/20261124_alter_orders.sql and k8s/deployment.yaml for zero-downtime release safety on a 50M-row orders table. Give me a GO/NO-GO verdict and rewrite it into a safe Expand-and-Contract plan before modifying any files.

    • Read your context and instructions
    • Compiled the zero-downtime db migration

    Zero-Downtime DB Migration & Release Safety Gate

    Release Verdict: NO-GO · Findings: 4 Critical · 4 High · 1 Medium (Postgres dialect)

    RuleSeverityLocationLock / Risk ImpactZero-Downtime Fix
    DBM-001Criticalalter_orders.sql:4CREATE INDEX holds SHARE lock (blocks all INSERT/UPDATE/DELETE)Use CREATE INDEX CONCURRENTLY outside transaction
    DBM-002Criticalalter_orders.sql:9DROP COLUMN legacy_status breaks N-1 app pods mid-rolloutStop reading column in Release N; drop in Release N+1
    DBM-004Criticalalter_orders.sql:12ALTER COLUMN total TYPE numeric(12,2) rewrites entire 50M-row tableAdd new column, dual-write, batch-backfill, swap
    DBM-006Highalter_orders.sql:16ADD CONSTRAINT ... CHECK scans full table under ACCESS EXCLUSIVEUse ADD CONSTRAINT ... NOT VALID, then VALIDATE CONSTRAINT
    DBM-007Highalter_orders.sql:1No SET lock_timeout guard (risks connection-pool lock pileup)Prepend SET lock_timeout = '3s'; SET statement_timeout = '30s';
    REL-001Highdeployment.yaml:22App container runs alembic upgrade head on pod startupMove to pre-deploy Kubernetes Job + set maxUnavailable: 0

    Safe 3-Phase Expand-and-Contract Rewrite (Phase 1 — Expand)

    SET lock_timeout = '3s';
    SET statement_timeout = '30s';
    
    -- 1. Non-blocking index build (run outside transaction block)
    CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_orders_customer_created
      ON orders (customer_id, created_at DESC);
    
    -- 2. Non-blocking constraint addition (metadata-only lock, then SHARE UPDATE EXCLUSIVE)
    ALTER TABLE orders
      ADD CONSTRAINT chk_orders_total_nonneg CHECK (total_cents >= 0) NOT VALID;
    ALTER TABLE orders VALIDATE CONSTRAINT chk_orders_total_nonneg;
    

    Next Steps (Approval Required)

    • Phase 1 (Safe Now): Deploy expand migration + dual-read/write app code.
    • Phase 2 (After Backfill): Validate constraints and remove reads of legacy_status.
    • Phase 3 (Contract): Drop legacy_status after all old pods drain.
      Reply "Generate Phase 1 migration & rollback SQL" to write the files.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Never Lock Production Tables or Break Rolling Deploys Again

    Zero-Downtime DB Migration Safety Gate pairs a strictly read-only Python static analyzer (scripts/check_migrations.py) with senior database reliability playbooks (PostgreSQL lock matrix, MySQL 8 Online DDL matrix, and Expand-and-Contract recipes). It inspects your SQL, Prisma, Alembic, Flyway, Goose, and Kubernetes rollout manifests before merge and gives a clear GO / CONDITIONAL-GO / NO-GO release verdict.

    What It Blocks (11 Production-Outage Rules)

    • Database Lock & Breaking-Change Rules (DBM-001–010):
      • CREATE INDEX / DROP INDEX without CONCURRENTLY (blocks writes/reads under SHARE / ACCESS EXCLUSIVE locks)
      • Single-step DROP TABLE / DROP COLUMN and RENAME COLUMN / RENAME TABLE (crashes N-1 running pods during rolling deploys)
      • Full-table rewrite ALTER COLUMN ... TYPE under ACCESS EXCLUSIVE lock
      • ADD COLUMN ... NOT NULL without safe default, and ADD CONSTRAINT ... CHECK / FOREIGN KEY without NOT VALID
      • Missing lock_timeout / statement_timeout guards (prevents lock-queue pileups that take down the whole app)
      • Unbounded UPDATE / DELETE backfills inside migration files, TRUNCATE, and empty/missing rollback (downgrade()) paths
    • Rollout Coordination (REL-001): Detects migrations run inside app container startup commands and Kubernetes Deployments missing maxUnavailable: 0, readinessProbe, or terminationGracePeriodSeconds.

    How to Use

    Ask your AI agent before merging any schema change or production release:

    • "Run a zero-downtime migration safety gate on migrations/ and k8s/ before we deploy."
    • "Check if our Prisma / Alembic migration will lock our Postgres orders table or break running pods."
    • "Rewrite this risky migration into a safe multi-phase Expand-and-Contract plan with rollback SQL."

    Or invoke the bundled read-only analyzer directly:

    python3 scripts/check_migrations.py --path . --dialect auto --format markdown
    

    What's Inside (17 Files)

    • SKILL.md — Deterministic 5-step release-safety workflow with GO / CONDITIONAL-GO / NO-GO gating and approval rules
    • scripts/check_migrations.py — Pure Python 3 stdlib static analyzer (11 rules, --dialect postgres|mysql|auto, --fail-on-nogo CI gate)
    • references/ — PostgreSQL lock matrix, MySQL 8 Online DDL matrix, Expand-and-Contract playbook, and rollback/rollout checklist
    • templates/ — Migration safety review card & copy-paste incident rollback runbook
    • examples/ — Worked review converting a blocking 50M-row orders table migration into a safe 3-phase Expand-and-Contract plan
    • tests/ — Risky & safe SQL/Alembic/K8s fixtures + runnable unit tests

    Security & Privacy Guarantee

    • 100% read-only & offline — NEVER connects to live databases, NEVER executes DDL, zero network calls, zero subprocess, zero os.environ.
    • Automatically skips .env*, key, and credential files.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Data & Databases.

    Static analysis of SQL, Alembic Python, and Kubernetes YAML files; does not inspect live database table sizes, query plans, or active runtime locks.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 2 days ago

    Software
    Python 3.9+ (stdlib only)

    Permissions

    Terminal / Shell
    Read Files
    Write Files

    Bundled analyzer is 100% offline and read-only; never connects to any live database or runs DDL. Write Files is only used after explicit user approval to write safe migration phases or rollback runbooks.

    Listed2 days ago

    What's inside

    Frequently Asked Questions

    This skill prevents production outages by identifying 'hidden' migration risks, such as long-running table locks or schema changes that would crash your old application pods during a rolling Kubernetes deployment.

    The skill provides comprehensive support for PostgreSQL and MySQL 8, including migration frameworks like Prisma, Alembic, Flyway, Liquibase, and Goose, as well as Kubernetes Deployment manifests.

    No, this skill operates as a Staff DBRE via static file analysis; it never requires access to your live production environment or credentials, ensuring your data remains secure and isolated.

    If a migration is flagged as high-risk, the skill automatically generates a multi-phase 'Expand-and-Contract' plan, providing you with the specific additive and cleanup SQL steps needed to achieve the change safely.

    You receive the core agent skill, the proprietary DBM/REL risk classification logic, and the pre-built lock-impact matrices for PostgreSQL and MySQL.

    Yes, it is specifically designed to be integrated into CI/CD pipelines to provide automated GO/NO-GO verdicts on Pull Requests before they are merged.

    New in Data & Databases