# Postgres Migration Safety Linter (Supabase Ready)

> Catch Postgres migrations that lock tables, rewrite them, break running code or lose data before they reach production. Flags non-concurrent indexes, NOT NULL adds, renames, unbounded updates and, for Supabase, tables without RLS. Gives the zero-downtime rewrite for each.

Postgres Migration Safety Linter (Supabase Ready) is a paid AI agent skill on Agensi by Hayder Al-Hwaidi, in Data & Databases. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $5 (one-time purchase)
- Creator: [Hayder Al-Hwaidi](https://www.agensi.io/creators/hayder-al-hwaidi)
- Category: [Data & Databases](https://www.agensi.io/skills/data-databases)
- Version: 1.0.0
- Last updated: 2026-12-01
- Security: scan passed (2026-12-01); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/postgres-migration-safety-linter-supabase-ready
- Tags: postgres, migrations, database, supabase, zero-downtime, devops, sql

## About this skill

Database migrations often cause production outages not through syntax errors, but through table locks and breaking changes. One unindexed foreign key or a blocking `NOT NULL` constraint on a large table can halt writes and crash your application. This skill identifies these risks in your SQL files and provides the exact zero-downtime rewrites required for safe deployment.

### What it does
- **Detects locking operations** by flagging statements like `CREATE INDEX` (non-concurrent), `ALTER TABLE` additions, and type changes that trigger table rewrites.
- **Prevents data loss** by identifying `UPDATE` or `DELETE` statements missing a `WHERE` clause.
- **Enforces Supabase security** by checking for missing Row Level Security (RLS) on new tables and insecure `SECURITY DEFINER` functions.
- **Validates application compatibility** by catching renames or dropped columns that break the currently running application code during a rolling deploy.
- **Provides safe rewrites** for every finding, moving blocking operations to the expand-migrate-contract pattern.

### How it works
1. **Source migrations** from your framework's directory, such as Supabase, Prisma, Drizzle, or Rails.
2. **Execute the linter** on specific files or entire folders to generate a report of findings categorized by severity.
3. **Review safe patterns** to replace high-risk SQL with non-blocking alternatives like `NOT VALID` constraints or concurrent index builds.
4. **Assess production impact** by checking table sizes and row counts to determine if a finding is critical.
5. **Coordinate deployment** by following the suggested deploy order to sync database changes with application releases.

### Frameworks & tools
This skill works with Postgres migrations from Supabase, Prisma, Drizzle, Rails, Django, and Knex. It uses a Python-based linting script and standard SQL commands for database inspection.

### Why this beats prompting it yourself
Generic AI prompts often miss the nuances of Postgres locking behavior or framework-specific transaction wrappers. This skill uses a structured approach focused on the expand-migrate-contract pattern and specific severity levels, ensuring you get production-ready SQL rather than just syntactically correct code.

### Use cases
- Auditing a Supabase migration for RLS compliance and lock-free indexes.
- Reviewing Prisma or Drizzle generated SQL for blocking `ALTER TABLE` calls.
- Integrating a safety gate into CI pipelines that fails builds on high-risk SQL.
- Planning a multi-stage migration to add a `NOT NULL` constraint to a million-row table.

### Known limitations
The linter is offline and read-only, meaning it cannot verify actual table sizes without manual SQL execution. Operations on tables created within the same file are ignored.

## Requires

- Python 3
- Postgres SQL migration files

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Postgres Migration Safety Linter (Supabase Ready) skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What specific database issues does this skill help me avoid?

This skill audits Postgres migrations for locking operations like non-concurrent index creation or blocking NOT NULL constraints. It prevents production outages and data loss by identifying SQL that would halt writes or break compatibility with your currently running application code during a deployment.

### What files or information do I need to provide to use this skill?

You should provide the skill with your SQL migration files or folders from frameworks like Supabase, Prisma, Drizzle, Rails, Django, or Knex. The skill uses a Python-based linting script and standard SQL commands to inspect your code without needing to connect to your live database.

### What kind of report or output will I receive after the audit?

The linter provides a report of findings categorized by severity, along with specific zero-downtime rewrites for every risky statement it finds. You also receive a suggested deployment order to help synchronize your database changes with your application releases.

### Are there any types of migrations or data the linter cannot check?

The linter is an offline, read-only tool that cannot automatically verify actual table sizes or row counts. It also ignores operations performed on tables that were created within the same migration file, as new tables do not pose a locking risk.

### How should I instruct my agent to use this skill?

You can ask your agent to audit specific migration folders, such as your Supabase or Prisma directories, or request a check for a specific SQL file. You can also ask for the zero-downtime rewrite of a high-risk finding or request a deploy order for a multi-stage migration.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
