- Home
- Skills
- Data & Databases
- Database Migration Safety Auditor
More screenshots
Works with the AI Agents you already use
Database Migration Safety Auditor
Senior database reliability engineer for auditing SQL migrations for safety, locking, and data loss.
$8.99
Database Migration Safety Auditor
Example session with this skill installed
Audit this PostgreSQL migration for a high-traffic table: ALTER TABLE orders ADD COLUMN status_code TEXT NOT NULL DEFAULT 'pending'; ALTER TABLE orders ADD CONSTRAINT status_check CHECK (status_code IN ('pending', 'shipped', 'delivered'));
- Read your context and instructions
- Compiled the database migration safety
The migration has been audited for PostgreSQL safety. The addition of a NOT NULL column with a default and a CHECK constraint on a high-traffic table presents significant locking risks depending on the PostgreSQL version.
Executive Migration Assessment
- Release Decision: GO WITH CONDITIONS
- Highest-risk changes: Metadata lock acquisition for
NOT NULLaddition andCHECKconstraint validation.
Key Finding: PostgreSQL < 11 will trigger a full table rewrite for the default value. PostgreSQL >= 11 handles this metadata-only, but the CHECK constraint still requires a full scan.
Change Inventory
| Object | Operation | Classification | Data Impact | Lock Exposure |
|---|---|---|---|---|
orders | ADD COLUMN | POTENTIALLY RISKY | Low (New Column) | Access Exclusive (Short) |
orders | ADD CONSTRAINT | POTENTIALLY RISKY | Low (Validation) | Access Exclusive (Long) |
Risk Register
| Risk ID | Risk | Severity | Likelihood | Mitigation |
|---|---|---|---|---|
| R-01 | Table scan lock | High | High | Add constraint as NOT VALID then VALIDATE CONSTRAINT separately. |
| R-02 | Version rewrite | Medium | Inferred | Confirm PG version is 11+. If lower, maintenance window required. |
Migration Sequence
- Expand:
ALTER TABLE orders ADD COLUMN status_code TEXT;(Nullable, no default). - Backfill: Update existing rows in batches to 'pending'.
- Constraint:
ALTER TABLE orders ADD CONSTRAINT status_check CHECK (status_code IN (...)) NOT VALID; - Validation:
ALTER TABLE orders VALIDATE CONSTRAINT status_check;(Does not block writes). - Contract:
ALTER TABLE orders ALTER COLUMN status_code SET NOT NULL;
Next steps
- Confirm the target PostgreSQL version to determine if the
DEFAULTclause triggers a rewrite. - Modify the migration to use the
NOT VALIDpattern for theCHECKconstraint. - Verify the current row count of the
orderstable to estimate backfill duration.
Connects securely to your tools. The creator never sees your data.
About this skill
Database migrations look simple until they reach production.
A single DROP COLUMN, unsafe type change, large-table index, long-running backfill, incompatible schema change, or untested rollback can cause data loss, application failures, locking, downtime, or difficult recovery.
The problem is that migration reviews are often done manually — and important risks can be hidden inside seemingly harmless SQL or ORM-generated changes.
Database Migration Safety Auditor turns a migration into a structured pre-deployment safety review before it reaches production.
What It Does Audits SQL and ORM migrations for destructive and potentially dangerous changes. Detects DROP, TRUNCATE, DELETE, type changes, constraint changes, risky indexes, backfills, renames, and other migration hazards. Analyzes potential data-loss and data-integrity risks. Reviews table locks, table rewrites, index operations, transaction exposure, and performance risks. Checks backward and forward compatibility between old and new application versions. Analyzes rolling-deployment and mixed-version scenarios. Applies the Expand → Migrate → Contract strategy to complex schema changes. Evaluates rollback, backup, recovery, and forward-fix readiness. Builds a dependency-aware migration sequence. Generates an evidence-backed Risk Register with severity and confidence. Calculates a Migration Readiness Score when sufficient evidence is available. Produces a clear GO, GO WITH CONDITIONS, NO-GO, or INSUFFICIENT EVIDENCE release decision. Generates pre-deployment and post-migration validation checklists. Why This Beats Prompting It Yourself
A generic AI prompt may look at a migration and simply say it is “safe” because the SQL is syntactically reasonable.
That is not enough for production database changes.
This skill uses a structured safety framework that checks data loss, compatibility, locking, performance exposure, rollback, recovery, deployment sequencing, and operational readiness separately.
It also follows an evidence-first approach.
If table size, production workload, backup status, migration testing, or application dependencies are not provided, the skill does not invent them. It explicitly identifies the missing evidence.
Most importantly, it does not pretend to have executed the migration or verified a live database.
Core Workflow
Migration Analysis → Destructive Change Detection → Data Safety → Lock & Performance Analysis → Compatibility → Rollback & Recovery → Deployment Sequence → Risk Register → Readiness Assessment → Release Decision
Use Cases Review a database migration before production deployment. Audit risky SQL or ORM-generated migrations. Evaluate schema changes during rolling deployments. Plan zero-downtime database migrations. Review large-table index creation and backfills. Identify potential data-loss scenarios before deployment. Evaluate breaking schema changes. Review rollback and recovery plans. Build migration runbooks and deployment checklists. Establish release gates for database changes. Built For Database Engineers Backend Developers DevOps Engineers Site Reliability Engineers Platform Engineers API Engineers Engineering Leads SaaS Development Teams Teams managing production databases Supported Environments PostgreSQL MySQL / MariaDB SQL Server Common ORM-generated migrations SQL migration files Schema diffs Database deployment plans What Makes It Different
This isn't a SQL syntax checker.
It is designed around the question engineers actually need to answer:
“Is this migration safe enough to deploy, what could go wrong, and what must be resolved first?”
The output gives you a structured technical assessment instead of a generic explanation of database migration concepts.
Known Limitations
The skill does not execute SQL or connect to a live database.
It cannot independently verify production locks, query performance, replication lag, backup integrity, or migration success.
Its assessment depends on the evidence supplied. Missing critical information is reported as an evidence gap rather than assumed to be safe.
Review your migration before production does it for you.
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Data & Databases.
Cannot verify live production state, table sizes, or real-time traffic. Relies entirely on provided SQL, schema diffs, and environment metadata.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 1 month ago
Permissions
No special permissions declared or detected