Migration gen

From berkcangumusisik/claude-code-practices · View interactive version

Migration gen is an AI agent skill from the GitHub repository berkcangumusisik/claude-code-practices. Generates a database migration file for schema changes

How to use this skill

Skill file

Generate Database Migration

Change: $ARGUMENTS

  1. Detect ORM/migration tool:
cat package.json | grep -E '"prisma"|"drizzle"|"typeorm"|"knex"|"sequelize"|"migrate"'
ls prisma/ migrations/ db/migrations/ 2>/dev/null | head -10
  1. Read the current schema:
cat prisma/schema.prisma 2>/dev/null || ls migrations/ 2>/dev/null | tail -3 | xargs -I{} cat migrations/{}
  1. Generate the migration based on the requested change:
  1. For Prisma: generate migration name and schema change, then ask to run:
npx prisma migrate dev --name $ARGUMENTS

For raw SQL: generate up/down migration files.

  1. Always generate a down migration (rollback).
  1. Flag any changes that require a deployment strategy (e.g., add-then-backfill, not rename directly).
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.