- Home
- Skills
- Data & Databases
- Enterprise Schema Migration Shield
Works with the AI Agents you already use
Enterprise Schema Migration Shield
DDL risk auditor & zero-downtime Expand/Contract blueprint synthesizer for PostgreSQL 12+.
$14.99
Enterprise Schema Migration Shield
Example session with this skill installed
Audit this SQL migration file for production database risks and generate a zero-downtime Expand/Contract blueprint:
-- migrations/20261102_user_refactor.sql
ALTER TABLE users ADD COLUMN phone_number VARCHAR(20) NOT NULL;
ALTER TABLE users DROP COLUMN legacy_status;
CREATE INDEX idx_users_email ON users(email);
- Read your context and instructions
- Compiled the enterprise schema migration
DATABASE MIGRATION AUDIT: migrations/20261102_user_refactor.sql
Migration Risk Score: 95/100 [CRITICAL (Destructive / Breaking Change)]
Deployment Clearance: [REJECTED] (Violations: 3)
1. Detected DDL Risks & Lock Class
| Line | Statement | Risk Finding | PostgreSQL Lock |
|---|---|---|---|
| 1 | ADD COLUMN ... NOT NULL | Table rewrite & default freeze on Postgres < 11; instant lock on active tables | ACCESS EXCLUSIVE |
| 2 | DROP COLUMN legacy_status | Immediate breaking change for running application instances | ACCESS EXCLUSIVE |
| 3 | CREATE INDEX idx_users_email | Missing CONCURRENTLY; blocks all concurrent reads/writes on table | SHARE (Blocks INSERT/UPDATE) |
2. Zero-Downtime Expand/Contract Blueprint Synthesized
- Phase 1 (Expand):
- Add column without NOT NULL:
ALTER TABLE users ADD COLUMN phone_number VARCHAR(20); - Add NOT NULL as NOT VALID constraint:
ALTER TABLE users ADD CONSTRAINT check_phone_not_null CHECK (phone_number IS NOT NULL) NOT VALID; - Create index concurrently:
CREATE INDEX CONCURRENTLY idx_users_email ON users(email);
- Add column without NOT NULL:
- Phase 2 (Dual-Write): Deploy application dual-writing to
phone_number. Backfill background worker.
Phase 3 (Contract): Validate constraint concurrently: ALTER TABLE users VALIDATE CONSTRAINT check_phone_not_null; Safely drop old column after old service versions decommission.
Connects securely to your tools. The creator never sees your data.
About this skill
Enterprise PostgreSQL Schema Migration Shield (v2.2.0)
When AI coding agents or development teams modify production databases, naive DDL statements trigger severe table locks, connection pool exhaustion, and unexpected production downtime.
Common hazards include:
- Adding
NOT NULLcolumns without backfills or default lock avoidance. - Dropping or renaming live columns before retiring application versions.
- Creating indexes synchronously without
CONCURRENTLY, halting all transactional writes.
This skill equips your AI coding agent with a preflight DDL risk auditor (33 codified rules) and an automated 3-phase Expand/Contract zero-downtime migration blueprint synthesizer.
Key Capabilities:
- Offline DDL Preflight Scanner: Audits raw SQL migration scripts for 33 distinct dangerous operations, assigning risk scores from 0-100 and determining exact PostgreSQL lock modes (
ACCESS EXCLUSIVE,SHARE UPDATE EXCLUSIVE). - Expand/Contract Blueprint Synthesizer: Deconstructs hazardous migrations into safe 3-phase blueprints:
- Phase 1 (Expand): Add backward-compatible nullable columns, concurrent indexes, and unvalidated check constraints.
- Phase 2 (Dual-Write & Backfill): Application reads old, writes both; batch backfills run in small chunks.
- Phase 3 (Contract): Validate constraints concurrently, drop obsolete columns and old indexes.
- Backward-Compatibility Verification: Includes automated contract tests ensuring database clients continue reading seamlessly during rollout.
Included Production Assets:
SKILL.md: Universal agent instructions adhering to open skill standards.scripts/audit_migration.py: Standalone CLI auditor checking 33 DDL invariants (Python 3.8+ stdlib).scripts/generate_expand_contract.py: Automated zero-downtime SQL migration generator.templates/backward_compatibility_test.py: In-memory dual-client simulation test template.references/destructive_ddl_catalog.md: Exhaustive index of Postgres locks and hazards.references/expand_contract_playbook.md: Operational guide for phased schema evolution.
Built by Conversionlogic (https://conversion-logic.github.io/)
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.
Does not audit dynamic SQL inside DO blocks. Connection poolers in transaction mode require direct session port access for certain phases. Requires Python 3 standard library.
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 15 days ago
- Software
Pythonprisma
Node.jsdrizzle-kittypeorm