Skip to content
Skill

Database migrations

Guides an agent through safe, reversible database schema and data migrations

Database migrations is an open-source agent skill for databases. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

Scripts
None
Platforms
Claude Code, Codex, Cursor
GitHub stars
66
Last commit
License
MIT
Listing updated

Similar skills

About Database migrations

This skill gives an agent a set of production-safe rules for changing database schemas and data. It stresses forward-only migrations in production, keeping schema and data changes in separate migrations, and building indexes concurrently on large tables. It also covers expand-contract sequencing for zero-downtime renames, including dual writes, batched backfills, parity checks before read cutover, and a deferred contract step.

The skill includes concrete SQL and tool-specific examples. PostgreSQL patterns cover column additions and their lock behavior, concurrent index creation, and batched updates. Per-tool workflows are included for Prisma, Drizzle, Kysely, Django and golang-migrate, with commands for generating, applying and rolling back migrations. Two self-checking PostgreSQL example scripts are referenced for testing column additions and renames against psql.

The agent needs a PostgreSQL database for most patterns, and the relevant migration tool installed for the framework in use. Examples are written in SQL, TypeScript, Python and shell commands.

When your agent uses it

Safe, reversible database migration patterns: forward-only production changes, expand-contract zero-downtime renames, concurrent indexes, batched backfills, and per-tool workflows for PostgreSQL, Prisma, Drizzle, Kysely, Django, and golang-migrate. Use when writing a schema or data migration, adding a column or index to a large table, planning a rollback, or preparing a zero-downtime deploy.

From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.

What it can access

From a static check of its 4 files (22 KB) on GitHub on 1 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.

Check another skill before you install it.

Install

This skill ships in the rea-skills plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

/plugin marketplace add smartworldarafath/REA_Skill
/plugin install rea-skills@smartworldarafath

Or copy only this skill to ~/.claude/skills/database-migrations:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/database-migrations &&
cp -R "$tmp/.agents/skills/database-migrations" ~/.claude/skills/database-migrations &&
rm -rf "$tmp"

For one project only, put the folder in .claude/skills/database-migrations inside it instead.

Claude Code docs on skills

Copy the skill folder to ~/.agents/skills/database-migrations to use it in every repository:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/database-migrations &&
cp -R "$tmp/.agents/skills/database-migrations" ~/.agents/skills/database-migrations &&
rm -rf "$tmp"

For one repository only, put the folder in .agents/skills/database-migrations inside it instead.

Codex docs on skills

Copy the skill folder to ~/.cursor/skills/database-migrations to use it in every project:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/database-migrations &&
cp -R "$tmp/.agents/skills/database-migrations" ~/.cursor/skills/database-migrations &&
rm -rf "$tmp"

For one project only, put the folder in .cursor/skills/database-migrations inside it instead.

Cursor docs on skills

Run in a terminal (add --scope workspace to install it for the current workspace only):

gemini skills install https://github.com/smartworldarafath/REA_Skill.git --path .agents/skills/database-migrations

Or copy the folder to ~/.gemini/skills/database-migrations yourself.

Gemini CLI docs on skills

For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/database-migrations:

tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/database-migrations &&
cp -R "$tmp/.agents/skills/database-migrations" ~/.copilot/skills/database-migrations &&
rm -rf "$tmp"

For one project only, put the folder in .github/skills/database-migrations inside it instead.

VS Code docs on skills

Get the folder:

git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git

Then copy REA_Skill/.agents/skills/database-migrations into your agent's skills folder as database-migrations. Agents that support SKILL.md read one folder per skill.

The SKILL.md format

What it does

Forward-only migration rules
Principles for keeping production changes immutable and rolling back through new forward migrations.
Zero-downtime rename sequence
An expand-contract procedure with dual writes, batched backfill and parity validation before cutover.
Safe PostgreSQL column changes
Guidance on lock levels, non-volatile defaults and NOT NULL pitfalls when altering populated tables.
Concurrent index creation
Building indexes without blocking writes and handling the transaction restriction on CONCURRENTLY.
Batched data backfills
Committing large updates in bounded ranges to avoid long locks and support retries.
Per-tool migration workflows
Commands and file patterns for Prisma, Drizzle, Kysely, Django and golang-migrate.

Good for

  • Add a column to a large PostgreSQL table without locking writes
  • Rename a production column with zero downtime
  • Create an index on a big table concurrently
  • Backfill a new column in batches without long transactions
  • Write a Django data migration that fills in a field
  • Set up a golang-migrate up and down migration pair

Database migrations FAQ

What tools does Database migrations cover?

It covers PostgreSQL patterns and workflows for Prisma, Drizzle, Kysely, Django and golang-migrate.

Does Database migrations run any scripts?

It references two self-checking PostgreSQL SQL examples that are run with psql, but the skill itself ships no scripts.

Can I roll back a production migration?

The skill advises against editing deployed migrations and recommends rolling back with a new forward migration, planning for the rollback window in expand-contract changes.

Why are indexes created with CONCURRENTLY?

Because a plain CREATE INDEX blocks writes on large tables, while CONCURRENTLY allows writes during the build, though it cannot run inside a transaction block.

How do I install Database migrations in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/database-migrations to use it in all your projects, or to .claude/skills/database-migrations in one project. Or install the rea-skills plugin, which includes it: /plugin marketplace add smartworldarafath/REA_Skill, then /plugin install rea-skills@smartworldarafath.

Does Database migrations run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

Which AI agents can use Database migrations?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

What are the best alternatives to Database migrations?

The closest alternatives to Database migrations are Db change management, Reviewing oracle to postgres migration, Migrating oracle to postgres data access code, Planning oracle to postgres migration integration testing and Migrating oracle to postgres stored procedures.

Where this comes from

  • Description: from the skill's own SKILL.md.

More from smartworldarafath/REA_Skill

  1. Guides building and auditing UI to WCAG 2.2 AA across web, iOS and Android

    • Open source
    • 66 GitHub stars
    • Developer tools
  2. Diagnoses agent and LLM stacks for hidden failures and ranks the fixes by severity

    • Open source
    • 66 GitHub stars
    • Developer tools
  3. Compare coding agents head-to-head on your own tasks by pass rate, cost and time

    • Open source
    • 66 GitHub stars
    • Developer tools
  4. Guides an agent to design tool sets, observations and error recovery for better completion

    • Open source
    • 66 GitHub stars
    • Developer tools
  5. Lets an AI agent make x402 payments within per-task budgets and spending policies

    • Open source
    • 66 GitHub stars
    • Finance and payments