Guide · Agent skill
How to use the Database Migration Patterns agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The database-migrations skill is a set of guidance files that tells your AI agent how to make database structure changes safely. It is written for backend developers who work with PostgreSQL or MySQL and use tools such as Prisma, Drizzle, Kysely, Django, TypeORM or golang-migrate. After this guide you will know how to install the skill, ask for help with a request in plain language, and check the agent's output against the safety rules it follows.
Quick start
- 1Download the ZIP. Get the database-migrations ZIP from this page and unzip it so you have a folder containing SKILL.md.
- 2Place the skill folder. Move it into ~/.claude/skills/ for personal use or into a project's .claude/skills/ folder, or upload it under Settings → Capabilities → Skills in the Claude apps.
- 3Prepare your database tooling. Make sure your project already uses a database and migration tool such as PostgreSQL with Prisma, Drizzle or Kysely, because the skill installs nothing.
- 4Describe your task in plain language. Ask for the change you need and name your database and ORM, for example adding a column or index to a table.
- 5Review the proposed migration. Check that it has a DOWN path, avoids table locks, uses defaults or nullable columns, and keeps schema and data changes separate.
- 6Test against production-sized data. Run the migration on a copy of production data before applying it anywhere important.
- 7Apply and verify. Run the migration with your tool's deploy or migrate command and confirm the result, keeping your rollback plan ready.
What the skill makes the agent do
When the skill is active, the agent follows a set of best practices whenever you ask it to change a database structure, such as adding a column or index, moving data, or planning a deployment with no downtime. It checks each change against a safety checklist: the migration should have an UP and a DOWN (or be explicitly marked irreversible), avoid full-table locks on large tables, give new columns a default or make them nullable, create indexes concurrently on existing tables, and keep schema changes separate from data backfills.
The skill also includes worked examples for PostgreSQL and for the ORMs listed above, including the commands each tool uses to create, apply and revert migrations.
Install the database-migrations skill
Download the ZIP file from this page and unzip it. The skill is a folder that contains a SKILL.md file. Then choose one of the two install locations:
Personal install: unzip the folder into ~/.claude/skills/ so it is available in all your projects.
Project install: unzip the folder into the .claude/skills/ directory of a specific project so it is available only there.
If you use the Claude apps instead, open Settings, go to Capabilities, and upload the skill under Skills.
- Personal: ~/.claude/skills/
- Project: .claude/skills/ inside your project folder
- Claude apps: Settings → Capabilities → Skills
Trigger the skill with natural requests
You do not need a special command. Describe the database task in plain words and mention the database or tool you use. The skill is meant to activate when you create or alter tables, add or remove columns or indexes, run data migrations or backfills, plan zero-downtime changes, or set up migration tooling for a new project.
Be specific about your stack and your table sizes. The skill's own guidance says a migration that works on 100 rows may lock a table with 10 million rows, so mention scale when it matters.
- "Add an avatar_url column to users in our Postgres database using Prisma."
- "Plan a zero-downtime rename of username to display_name in our Drizzle project."
- "Write a batched backfill to lowercase emails in the users table."
- "Add an index on orders.email without locking writes."
Work through a typical example: renaming a column
The skill recommends the expand-contract pattern rather than a direct rename in production. The steps are: add the new column in one migration, backfill data in a separate data migration, update the application to read and write both columns and deploy it, then stop writing to the old column and drop it in a later migration.
Ask the agent to lay out these migrations for your stack. Review each file before you run it, because the agent only advises and does not apply changes for you.
-- Paso 1: Agregar nueva columna (migración 001)
ALTER TABLE users ADD COLUMN display_name TEXT;
-- Paso 2: Backfill de datos (migración 002, migración de datos)
UPDATE users SET display_name = username WHERE display_name IS NULL;Use the safe index pattern on existing tables
On a large existing table, a plain CREATE INDEX blocks writes. The skill shows CREATE INDEX CONCURRENTLY instead. The source notes that CONCURRENTLY cannot run inside a transaction block and that most migration tools need special handling for it. For Prisma, the skill suggests creating an empty migration with --create-only and writing the SQL by hand.
CREATE INDEX CONCURRENTLY idx_users_email ON users (email);Know the commands for each supported tool
The skill lists the common commands for each tool. Use them as a reference and confirm the exact behaviour in your tool's own documentation before running anything against a production database.
- Prisma: migrate dev, migrate deploy (apply pending migrations in production), migrate reset (development only), generate
- Drizzle: drizzle-kit generate, drizzle-kit migrate, drizzle-kit push (development only, creates no migration file)
- Kysely: kysely init, kysely migrate make, kysely migrate latest, kysely migrate down, kysely migrate list
npx prisma migrate deploySafety notes before you use it
The skill runs no scripts and makes no network requests. It installs nothing itself, so you need your own database and migration tooling such as PostgreSQL, Prisma, Drizzle or Kysely already set up.
The skill only gives advice. Running migrations against production can cause data loss or locks if applied incorrectly. Test every migration against a copy of production-sized data, keep a documented rollback plan, and never edit a migration that has already run in production. The guidance is written in Spanish, and its examples cover only the tools it names; advice for other databases or ORMs may not transfer directly.
What people use it for
- Adding a nullable column or an index to a production PostgreSQL table without blocking writes.
- Planning a zero-downtime column rename with the expand-contract pattern across several deployments.
- Writing a batched data backfill, such as normalising email values, that updates rows in chunks.
- Creating Prisma migration files with custom SQL for operations Prisma cannot generate, such as concurrent indexes.
- Setting up Kysely or Drizzle migration files for a new TypeScript project.
Frequently asked questions
Is the database-migrations skill free?
The skill is released under the MIT licence, as stated on this page. Check the licence file in the source repository for the full terms before reuse.
Does the skill install PostgreSQL, Prisma or Drizzle for me?
No. The skill installs nothing itself. You need the database and migration tooling your project uses, such as PostgreSQL, Prisma, Drizzle or Kysely, already in place.
Will the skill run migrations automatically?
No. It only advises. It runs no scripts and makes no network requests, so you or your team must run each migration command yourself.
Which databases and ORMs does it cover?
The guidance covers PostgreSQL, MySQL and the ORMs Prisma, Drizzle, Kysely, Django, TypeORM and golang-migrate. Its detailed examples are for PostgreSQL and the TypeScript tools shown. Projects using other databases may find the advice does not transfer directly.
How do I install the skill in Claude?
Download the ZIP from this page and unzip it into ~/.claude/skills/ for personal use or into a project's .claude/skills/ folder. In the Claude apps, you can instead upload it under Settings → Capabilities → Skills.
Can I use it if I am not a developer?
It is not suited to non-developers. The guidance assumes working knowledge of SQL and ORMs, so beginners may find the migration files hard to review safely.
How does it compare with simply asking an AI for migration code?
The skill gives the agent a fixed safety checklist and pattern set to follow, such as expand-contract renames and concurrent indexes. Without it, the agent may not apply those rules consistently to every change.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
This skill suits backend developers running production PostgreSQL or MySQL who use Prisma, Drizzle or Kysely and want safer schema changes and clearer migration files. It is not a good fit for people without SQL and ORM experience, for anyone who expects automatic execution, or for projects on databases or ORMs it does not cover, where you should pick a guide written for your stack.
Download the skill