More screenshots

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    Zero-Downtime Django Migrations

    1

    Ship Django + PostgreSQL migrations without locking prod: timeouts, concurrent indexes, expand/contract, batched backfills.

    Free

    1 useSecurity scanned
    Zero-Downtime Django Migrations

    Zero-Downtime Django Migrations

    Example session with this skill installed

    Add a NOT NULL status column with a default to our 80M-row orders table and index it. How do we ship this without downtime?

    • Read your context and instructions
    • Compiled the zero-downtime django migrations

    Summary

    Ship it in three releases. A single AddField(null=False, default=...) plus a normal AddIndex would take heavy locks on a hot table. Example output; names are illustrative.

    Plan

    ReleaseMigrationWhy it is safe
    1. ExpandAddField(status, null=True) with no defaultMetadata-only, no table rewrite
    1. ExpandApp code starts writing status on every saveOld rows are still NULL, which is fine
    2. BackfillRunPython in batches of 5,000 ids, one transaction per batchNo long transaction, replicas keep up
    2. IndexAddIndexConcurrently in a non-atomic migrationBuilds without blocking writes
    3. ContractCHECK (status IS NOT NULL) NOT VALID, then VALIDATE CONSTRAINT, then SET NOT NULLValidation takes a weak lock, SET NOT NULL skips the scan

    Guard rails on every migration

    class Migration(TimeoutAwareMigration):
        lock_timeout = timedelta(seconds=15)
        statement_timeout = timedelta(seconds=20)
    

    Next steps

    1. Run the migration linter (--fix) on the generated files.
    2. Deploy release 1 and wait for old pods to drain before release 2.
    3. Confirm zero NULLs before adding the constraint in release 3.

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

    About this skill

    Never take production down with a migration again

    Migrations run before the new code rolls out, so for a few minutes old code talks to the new schema. This skill teaches your agent to write Django and PostgreSQL migrations that survive that window: no long locks, no table rewrites, nothing the running code still needs gets removed.

    How it helps

    • No surprise outages. Every migration gets a lock timeout and a statement timeout, so it fails fast instead of blocking traffic.
    • Safe indexes and constraints. Concurrent index creation, and NOT VALID then VALIDATE for new constraints.
    • Safe multi-release changes. Expand, migrate, contract: split risky changes across releases so old and new code both keep working.
    • Safe backfills. Batched data migrations that don't hold a transaction open on a hot table.
    • Fewer review debates. A per-operation lock reference and checklists tell reviewers what is safe and what is not.

    What's inside

    A short SKILL.md with the two golden rules and the migration toolkit pattern, plus 4 reference guides: Postgres locks, indexes, columns/keys/constraints, and data backfills and deployment.

    Use it when

    Adding or changing columns, indexes, constraints or foreign keys, writing RunPython/RunSQL backfills, reviewing makemigrations output, or setting up migration safety in a new Django service.

    Requires PostgreSQL. Only works with the TimeoutAwareMigration base class. Does not support MySQL or SQLite migration syntax.

    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 any payment.

    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

    1 use

    Times used to date

    Free forever

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 1 month ago

    • Free with an Agensi account

    Permissions

    Read Files
    Write Files
    Listed1 month ago

    What's inside

    Frequently Asked Questions

    This skill prevents the table-level locks and service outages often caused by standard Django migrations on high-traffic PostgreSQL databases by enforcing safe patterns like concurrent indexing and mandatory timeouts.

    The skill is specifically optimized for Django environments using PostgreSQL; it is not compatible with MySQL, SQLite, or other database backends due to its reliance on Postgres-specific locking logic.

    You will receive a specialized toolkit including the `TimeoutAwareMigration` base class, custom concurrent operation overrides, and a dedicated linter to identify production hazards.

    The skill guides you through the 'expand-contract' pattern, which involves a multi-release process to ensure that your application code remains compatible with the database state at every step of the migration.

    Yes, it integrates directly with standard Django migration commands, replacing risky default operations with safety-first alternatives like `AddIndexConcurrentlyWithRetry`.

    The skill identifies 'hidden' risks that generic AI prompts often miss, such as the 'one concurrent operation per file' rule and the necessity of two-step validation for foreign keys.

    New in APIs & Backend