Skill library / Claude Code

Database Migration skill for Claude Code

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.

Customise this skill free →

What it's good for

How the skill works

  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

Built-in rules

Example

You: “Add a nullable 'referrer' column to users”
Result: A Prisma migration, updated schema, and a note that it's safe online with no backfill needed.

SKILL.md template

Save as database-migration/SKILL.md.

---
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 in Claude Code

Unzip into .claude/skills/ in your project (or ~/.claude/skills/ for all projects) and invoke it with /skill-name.

Pro tip

Document your production database size in references/ so it can judge locking risk.

Want it tailored to how you work?

Answer a few questions and get a customised version with examples, a Cursor rule and GPT/Gem instructions, emailed free.

Make my version →

FAQ

How do I install the database migration skill 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 this template, or generate a customised version free (5 per day, no login).

Does it work on other platforms?

Yes. The SKILL.md follows the open Agent Skills standard, and every generated package also includes a Cursor rule and ChatGPT/Gemini instructions.

Related skills