Change your Supabase schema safely with AI

Designs the migration with RLS policies and indexes, applies it on a branch first when you use branching, checks Supabase's security and performance advisors, and regenerates your TypeScript types. Every change waits for your yes.

Asks before writingUses 9 Supabase toolsWorks in RevampKey, Claude Code, Codex and Cursor

Use in RevampKey

Get RevampKey to connect Supabase

RevampKey is a free desktop app for Mac, Windows and Linux. Install it, sign in, and Supabase is one click away with its skills already attached.

Download RevampKey

Not now? Use the skills in your current tool

curl -fsSL --create-dirs -o .claude/skills/supabase-schema-change/SKILL.md https://revampkey.com/marketplace/supabase/skills/schema-change/SKILL.md
Other agents
Other agents

When to use it

  • Adding a table or column
  • Writing RLS policies
  • Shipping a schema change without breaking production

What it looks like

You

Add an invoices table linked to teams, where only team members can read their invoices.

list_tableslist_migrationsget_costconfirm_cost+5 more
Agent

Migration add_invoices_table: invoices (id, team_id → teams on delete cascade, amount_cents, status, due_at, created_at), RLS on, a SELECT policy for team members via team_members, and an index on team_id. Apply it to the "dev" branch first?

The SKILL.md file

View raw
name: supabase-schema-change

Make a database schema change in Supabase safely by designing the migration with RLS policies and indexes, applying it on a branch first, regenerating TypeScript types and checking advisors. Use when the user asks to add a table or column, change the schema, write a migration or add RLS policies in Supabase.

Steps

  1. Read the current state with list_tables, including the columns of related tables, and list_migrations.
  2. Write the migration SQL:
    • tables with a primary key, created_at timestamptz default now(), and foreign keys with explicit on delete behaviour;
    • alter table … enable row level security on every new table in an exposed schema, plus policies for each role and action, usually tied to auth.uid();
    • indexes on foreign keys and on columns used in filters;
    • no destructive changes, such as dropping or renaming a column, without calling them out.
  3. Prefer a branch. If the project uses branching, apply there first. Creating a branch has a cost: show it with get_cost, and only after the user accepts it run confirm_cost and create_branch.
  4. Show the SQL and the target. After the user's yes, apply it with apply_migration, using a snake_case name such as add_invoices_table.
  5. Check the result with get_advisors for security and performance, for example missing RLS or unindexed foreign keys, and fix what it flags with another approved migration.
  6. Regenerate types with generate_typescript_types and update the app's types file when the repo is open.
  7. To ship a branch, use merge_branch, after the user approves.

Supabase tools it uses

  • list_tables
  • list_migrations
  • get_cost
  • confirm_costAsks first
  • create_branchAsks first
  • apply_migrationAsks first
  • get_advisors
  • generate_typescript_types
  • merge_branchAsks first

Tool list from supabase-community/supabase-mcp source.

FAQ

Does it add Row Level Security?

Yes. Every new exposed table gets RLS enabled and explicit policies, and the advisors check confirms it.

Can it test on a branch first?

Yes, if your project uses Supabase branching. It shows the branch cost before creating one.