Skill library / For developers
Claude Code skill for database migrations
For developers changing a production database schema who want every migration to have a way back.
Migrations break production when they lock tables or can't be rolled back. This skill makes Claude Code write migrations that are reversible and safe to deploy.
Use this skill nowSee the SKILL.md
Answer up to 4 quick questions, add your email, and get a version written around you, ready to paste into Claude Code. Free, no account needed.
What it's good for
- Prisma, Drizzle, Rails, Django or Alembic projects
- Adding indexes to large tables
- Renaming columns without downtime
The SKILL.md file
Save as database-migration/SKILL.md. It follows the open Agent Skills format.
---
name: database-migration
description: "Creates safe, reversible database migrations for schema changes using the project's ORM or migration tool. Use when the user asks to add a column, table, index or change the database schema."
---
# Database Migration
## Workflow
1. Detect the migration tool from the repo
2. Generate the migration with up and down steps
3. Flag operations that lock large tables and propose safe alternatives
4. Update models/types to match
5. Run the migration locally and confirm rollback works
## Rules
- Never drop columns or tables without explicit confirmation
- Split risky changes into expand/contract steps
- Never edit already-applied migrations
How to install it in Claude Code
Unzip into .claude/skills/ in your project (or ~/.claude/skills/ for all projects) and invoke it with /skill-name.
Example
Illustrative example. This shows the kind of request and result to expect. It is not a real conversation, and your result will depend on what you give it.
You ask: “Add a nullable 'referrer' column to users”
What you get back: A Prisma migration, updated schema, and a note that it's safe online with no backfill needed.
Pro tip
Document your production database size in references/ so it can judge locking risk.
Make your own version
This prompt is a good start, but it doesn't know you. Answer a few quick questions about your situation and how you like things done, and we'll write a version that does. It appears on screen with a Copy button and setup steps for your AI, and we email you a copy. Free, up to 10 a month.
Make my own version freeQuestions
Will it run migrations on production?
Treat it as a drafting tool. Review every migration and run it in a test environment first.
Does it support my ORM?
It uses the ORM or migration tool your project already has, such as Prisma, Drizzle or Django migrations.
How do I install it in Claude Code?
Unzip into .claude/skills/ in your project (or ~/.claude/skills/ for all projects) and invoke it with /skill-name.
Is it free?
Yes. You can copy the prompt on this page for free, with no sign-up. If you want a version written around you, our generator is free too (up to 10 a month, no account needed): answer a few questions and we email you a copy.