check-migration

Validate Prisma migrations for destructive SQL operations and generate rollback plans.

Updated Mar 24, 2026
One-click install
npx skills add https://github.com/SumitRajpal/nextjs-claude-architecture --skill check-migration
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: check-migration
Source: https://github.com/SumitRajpal/nextjs-claude-architecture/tree/main/.claude/skills/check-migration
Command: npx skills add https://github.com/SumitRajpal/nextjs-claude-architecture --skill check-migration

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This utility validates Prisma migrations for safety before applying to production by analyzing the migration SQL for destructive operations, providing a rollback plan, and checking for schema drift.

Core Features & Use Cases

  • Destructive operation detection and risk assessment: flags potential data-loss actions such as DROP TABLE, DROP COLUMN, or risky ALTER operations.
  • Index and performance considerations: checks for missing indexes on new foreign keys and commonly queried columns to minimize lock risks.
  • Drift and rollback support: reports drift via prisma migrate diff and generates a manual rollback plan to undo migrations if needed.

Quick Start

Run the migration safety check against the latest migration in prisma/migrations or a specified one to obtain a risk assessment.

Frequently Asked Questions about check-migration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate a Prisma migration for safety before deploying to production?

To validate a Prisma migration, the Skill reads the migration SQL, detects destructive operations like DROP TABLE, estimates lock risk, and outputs a SAFE, NEEDS REVIEW, or DANGEROUS assessment with detailed notes.

What is schema drift in Prisma and how do I check for it?

Schema drift occurs when your database schema diverges from your Prisma schema. This Skill checks for schema drift by running prisma migrate diff between your migrations directory and schema datasource.

How can I detect destructive database operations in my Prisma migration SQL?

You can detect destructive database operations by analyzing the migration SQL for data-loss actions such as DROP TABLE, DROP COLUMN, or risky ALTER operations, which this tool flags automatically during validation.

Can I generate a rollback plan for a specific Prisma migration?

Yes, you can generate a manual rollback plan for either the latest migration or a specific named migration under prisma/migrations, allowing you to undo migrations if needed.

Does this migration check identify missing indexes on new foreign keys?

Yes, the migration check identifies missing indexes on new foreign keys and commonly queried columns to minimize lock risks and highlight performance considerations.

What are the limitations of automated Prisma migration validation?

Automated validation provides risk assessment and manual rollback plans but requires human review for NEEDS REVIEW verdicts, as it cannot automatically execute complex schema reversals.