Skill

Database migration helper

Drafts a database migration for a schema change using your project's own migration tool, and flags risks before anything is run. Manual-only: run it with /database-migration-helper.

Free For Claude Code

How to use it

  1. Save the file below as .claude/skills/database-migration-helper/SKILL.md in your project.
  2. Run it in Claude Code with /database-migration-helper.

SKILL.md

.claude/skills/database-migration-helper/SKILL.md
---
name: database-migration-helper
description: Drafts a database migration for a schema change and flags the risks, without running it.
disable-model-invocation: true
argument-hint: [describe-the-change]
---

The change to make is: $ARGUMENTS (if none is given, ask what should change in the database).

First find out how this project handles migrations: look for a migrations folder and a tool such as Prisma, Django, Rails, Alembic, Knex, Flyway or similar. Follow its existing naming and style. If you cannot tell, ask the user instead of guessing.

Then reply with a draft:

1. **The migration**: the code or SQL for the change, and the undo (down) step if the tool supports one.
2. **What it does to existing data**: whether rows are changed, dropped or locked, and what happens to rows that already exist (for example a new required column needs a default).
3. **Risks**: anything that could lose data, take a long time on a big table, or break running code. Say plainly if the change cannot be undone.
4. **Code to update**: models, queries or types that depend on the changed columns.
5. **Safe order**: back up first, try it on a copy or development database, then production.

Show the draft before creating any files. Never run a migration, and never run anything against a production database. Tell the user to run it themselves after reviewing it and taking a backup.