- Home
- Skills
- Data & Databases
- database guardian migration engineer
database guardian migration engineer
Senior database engineer for safe SQL migrations, performance tuning, and zero-downtime schema evolution.
$7
Works with the AI Agents you already use
database guardian migration engineer
Example session with this skill installed
Review this PostgreSQL 15 migration: ALTER TABLE users ADD COLUMN bio text DEFAULT 'none'; ALTER TABLE users ADD COLUMN internal_id uuid NOT NULL;
- Read your context and instructions
- Compiled the database guardian migration
I have analyzed the provided SQL migration for PostgreSQL 15 using scripts/migration_lint.py.
Migration Safety Audit
| Rule ID | Finding | Lock Level | Gravity | Recommendation |
|---|---|---|---|---|
| DB-001 | ADD COLUMN with DEFAULT | ACCESS EXCLUSIVE | Medium | Safe in PG 11+, but ensure no active long transactions. |
| DB-002 | ADD COLUMN NOT NULL | ACCESS EXCLUSIVE | High | CRITICAL: Fails on tables with existing data. Use 3-phase approach. |
| DB-005 | Table Rewrite | Full Rewrite | High | Adding NOT NULL to existing data forces a full table scan and lock. |
Proposed Zero-Downtime Sequence
Phase 1: Expand
ALTER TABLE users ADD COLUMN bio text DEFAULT 'none';(Safe in PG 15)ALTER TABLE users ADD COLUMN internal_id uuid;(Nullable initially)
Phase 2: Migrate
- Backfill
internal_idin batches of 5000 rows to avoid long-held locks and replication lag. - Verify all rows have an
internal_id.
Phase 3: Contract
ALTER TABLE users ALTER COLUMN internal_id SET NOT NULL;(UseNOT VALIDif supported/required to avoid long scans).
Preflight Checklist
- Verify backup is current and restoration is tested.
- Set
SET lock_timeout = '2s';before execution. - Check
pg_stat_activityfor long-running transactions.
Next steps
- Confirm the estimated row count for the
userstable to refine batch sizes. - Implement the batch backfill script for the
internal_idfield. - Schedule Phase 3 during a low-traffic window.
Connects securely to your tools. The creator never sees your data.
About this skill
Database schema changes often cause accidental downtime, table locks, or data loss. This skill provides a specialized engineering framework to audit SQL migrations, optimize query performance, and ensure zero-downtime deployments.
What it does
- Audit migrations using a linting engine to detect dangerous locks, table rewrites, and incompatible schema changes.
- Sequence deployments by breaking breaking changes into "expand, migrate, contract" phases to maintain backward compatibility.
- Analyze performance by diagnosing slow queries through execution plans and identifying missing or redundant indexes.
- Identify security risks by scanning application code for SQL injection vulnerabilities and enforcing least-privilege access.
- Verify recovery plans by validating backup integrity, restoration procedures, and rollback strategies.
How it works
- Scope and Inventory: Provide the database engine, version, schema files, or pending migration scripts for analysis.
- Deterministic Scanning: The agent runs internal linters (e.g.,
migration_lint.py) to categorize lock levels and potential breaking points. - Profile Routing: Depending on the issue, the agent activates specific sub-profiles like
zero-downtimeortransaction-engineer. - Actionable Reporting: Receive a technical report including lock classifications, phased execution steps, and pre-flight checklists.
Frameworks & tools
Primary support for PostgreSQL, with support for MySQL, SQLite, and NoSQL. Compatible with migration tools like Flyway, Liquibase, Alembic, and Prisma.
Why this beats prompting it yourself
Generic prompts often overlook version-specific locking behavior or suggest "reversible" migrations that actually cause data loss. This skill enforces strict safety principles, such as "expand-and-contract" patterns and automated PII redaction, ensuring production stability over raw speed.
Use cases
- Reviewing a complex PostgreSQL migration to avoid
ACCESS EXCLUSIVElocks on large tables. - Converting a blocking
CREATE INDEXinto aCONCURRENTLYoperation for zero-downtime. - Debugging N+1 query patterns and lazy loading issues generated by an ORM.
- Designing a high-availability replication strategy with tested failover steps.
Known limitations
Does not perform direct execution on production databases. Performance gains are estimates based on plans, not live benchmarks. Requires engine version to provide accurate locking analysis.
Requires explicit database engine and version for accurate lock analysis. No direct production execution. Performance gains are theoretical until verified on specific hardware.
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 any payment.
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 3 days ago