Works with the AI Agents you already use

    zerodowntime db

    by Cosmo AI Studios

    1

    Detect and remediate dangerous database locks with zero-downtime migration linting and 3-phase deployment patterns.

    Free

    Security scanned
    zerodowntime db

    zerodowntime db

    Example session with this skill installed

    I need to add a UNIQUE constraint to the email column on my production Postgres 15 orders table. It has 50 million rows. Give me the zero-downtime migration steps.

    • Read your context and instructions
    • Compiled the zerodowntime db

    I have analyzed the request to add a UNIQUE constraint to a high-traffic table. A direct ALTER TABLE will acquire an ACCESS EXCLUSIVE lock, blocking all traffic. I have generated a 2-step safe migration plan.

    Zero-Downtime Unique Constraint Plan

    -- Phase 1: Create the unique index concurrently.
    -- This does not block reads or writes but takes longer to run.
    -- Run this OUTSIDE of a transaction block.
    SET lock_timeout = '5s';
    CREATE UNIQUE INDEX CONCURRENTLY idx_orders_email_unique ON orders (email);
    
    -- Phase 2: Attach the constraint using the existing index.
    -- This requires a microsecond ACCESS EXCLUSIVE lock for metadata only.
    SET lock_timeout = '2s';
    ALTER TABLE orders 
      ADD CONSTRAINT uq_orders_email 
      UNIQUE USING INDEX idx_orders_email_unique;
    

    Next steps

    1. Ensure your migration runner (e.g., Flyway or Prisma) is configured for non-transactional execution for Phase 1.
    2. Monitor pg_stat_activity during the concurrent index build to ensure it doesn't conflict with long-running maintenance tasks.
    3. Verify the index status using \d orders after Phase 1 to ensure it is not marked as INVALID.

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

    About this skill

    Database migrations on high-traffic tables are a common source of production outages. A single ALTER TABLE can lock out all application traffic, leading to connection exhaustion and 504 errors. This skill provides an automated linter and architectural advisor to ensure DDL changes execute without downtime.

    What it does

    • Hazard detection identifies dangerous table locks like ACCESS EXCLUSIVE, non-concurrent indexes, and full table rewrites.
    • Migration conversion automatically rewrites breaking DDL into 3-phase Expand-and-Contract deployment scripts.
    • Lock enforcement injects mandatory fail-fast lock timeouts into SQL, Prisma, Alembic, and Rails migrations.
    • Batched backfilling generates throttleable background update logic to populate columns without saturating I/O or replication.
    • ORM guardrails provides specific configurations for ActiveRecord, Prisma, and SQLAlchemy to handle non-transactional DDL.

    How it works

    1. Lint migrations by running the included linter script against your SQL or ORM migration directory.
    2. Review the hazard report to identify statements that will block reads or writes.
    3. Refactor unsafe migrations using the suggested remediations, such as CONCURRENTLY index builds or NOT VALID constraints.
    4. Integrate the pre-commit hook or GitHub Action to catch locking hazards before they reach production.

    Frameworks & tools

    Supports PostgreSQL (12-17) and MySQL (5.7-8.4). Includes specific implementation logic for Prisma, Alembic (SQLAlchemy), Ruby on Rails (ActiveRecord), Flyway, gh-ost, and pt-online-schema-change.

    Why this beats prompting it yourself

    Generic AI often forgets the nuances of lock hierarchies or database-specific version optimizations like Postgres 12+ constraint validation. This skill uses a strict "Three Axioms" framework to ensure every migration is structurally safe for high-concurrency environments.

    Use cases

    • Adding unique constraints or indexes to tables with millions of rows.
    • Renaming columns in production without breaking running application instances.
    • Adding NOT NULL constraints to existing columns without full table scans.
    • Migrating large column types using online schema change tools like gh-ost.

    Known limitations

    Does not support NoSQL databases or older versions of PostgreSQL (sub-12). Requires Python 3.11 for the standalone linter script.

    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

    Free to use

    No account required to browse

    Frequently Asked Questions

    The skill prevents production outages by identifying SQL commands that cause table locks, such as blocking indexes or full table rewrites, and providing safe 3-phase deployment alternatives like Expand-and-Contract patterns.

    The package includes the core migration linter, a suite of 3-phase deployment templates, pre-commit hooks, and specific configuration guides for ORMs like Prisma, ActiveRecord, and Alembic.

    Yes, it is fully compatible with online schema change tools like gh-ost and pt-online-schema-change, and it provides specific logic to handle the nuances of these tools during large-scale migrations.

    Setup involves installing the Python-based linter script and integrating it into your CI/CD pipeline or pre-commit hooks to automatically scan your migration directory for hazards.

    It supports PostgreSQL (versions 12-17) and MySQL (versions 5.7-8.4), focusing on the specific lock hierarchies and optimization features of these modern relational databases.

    New in Data & Databases

    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.

    Free