- Home
- Skills
- Data & Databases
- Postgres Migration Safety Check
More screenshots
Works with the AI Agents you already use
Postgres Migration Safety Check
Catch risky Postgres migrations before they lock a table or delete data. Get PASS, REVIEW, or BLOCK with the exact statement, the reason, and a safer approach.
$5
Postgres Migration Safety Check
Example session with this skill installed
Check this migration before I run it on production:
SET lock_timeout = '5s';
ALTER TABLE orders ADD COLUMN reference uuid DEFAULT gen_random_uuid();
CREATE INDEX orders_user_id_idx ON orders (user_id);
ALTER TABLE orders
ADD CONSTRAINT orders_user_id_fk FOREIGN KEY (user_id) REFERENCES users (id);
- Read your context and instructions
- Compiled the postgres migration safety
Result
Verdict: BLOCK. This is the tool output for the migration above.
BLOCK examples/dangerous.sql
line 4 M07 BLOCK ALTER TABLE orders ADD COLUMN reference uuid DEFAULT gen_random_uuid();
Why: This column form rewrites the whole table.
Safer: Add the column without it, then backfill in batches.
line 6 M05 BLOCK CREATE INDEX orders_user_id_idx ON orders (user_id);
Why: Blocks writes to the table until the index build finishes.
Safer: Use CREATE INDEX CONCURRENTLY outside a transaction block.
line 8 M09 BLOCK ALTER TABLE orders ADD CONSTRAINT orders_user_id_fk FOREIGN KEY (user_id) REFERENCES users (id);
Why: Locks both tables and checks every existing row.
Safer: Add it NOT VALID, then VALIDATE CONSTRAINT in a later step.
Verdict: BLOCK
Connects securely to your tools. The creator never sees your data.
About this skill
A migration can pass on your laptop and still block writes on production. This skill makes your coding agent check PostgreSQL migration SQL before it runs. You get a clear verdict, the exact statement, the reason it matters, and a safer approach.
What it does
- Returns PASS, REVIEW, or BLOCK for a file, a folder, or SQL from stdin.
- Finds common statements that can lock a table, rewrite a table, delete data, or fail.
- Covers 20 checks, including non-concurrent indexes, column type changes, foreign keys,
SET NOT NULL, and missinglock_timeout. - Understands that a table created in the same file holds no earlier data.
- Marks statements and
ALTER TABLEactions it does not recognize as REVIEW, not PASS. - Works on raw SQL migrations, including SQL generated by Prisma and Supabase.
How it works
Your agent runs a small Python script on your SQL, then explains the result in your language. It does not connect to your database, run your migration, or use the internet. It does not change your files unless you ask.
Where it stops
This is a static check of SQL text. PASS is not a guarantee. It does not know your table size, live traffic, or application code.
PostgreSQL only, and it assumes PostgreSQL 12 or newer. PASS is not a guarantee. This is a static check of SQL text. It does not know your table size, live traffic, or application code. It does not analyze code inside DO blocks or functions, or read migrations written in other languages.
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 10 days ago
Requires
Permissions
Terminal runs the bundled checker script. Read Files lets it read the SQL files you choose. It does not write files, use the network, or read environment variables.