supabase-migrations

Creates and reviews Supabase SQL migrations with RLS policies, pgvector indexes, and rollback blocks.

Updated Apr 13, 2026
One-click install
npx skills add https://github.com/rymqan/staple-tech --skill supabase-migrations-rymqan
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: supabase-migrations
Source: https://github.com/rymqan/staple-tech/tree/main/.claude/skills/supabase-migrations
Command: npx skills add https://github.com/rymqan/staple-tech --skill supabase-migrations-rymqan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing Supabase migrations by hand often leads to missing RLS policies, wrong column types, and no rollback path, which silently breaks security and makes schema changes hard to reverse. ## Core Features & Use Cases - Standardized Migration Workflow: Enforces timestamped snake_case file naming in supabase/migrations/ and documents how to apply migrations locally or via the Supabase dashboard. - RLS Policy Templates: Provides copy-ready row-level security policy blocks for SELECT, INSERT, UPDATE, and DELETE, including join-through-parent patterns for tables without a direct user_id column. - pgvector and Type Conventions: Supplies IVFFlat index configuration for embeddings and a column type reference covering UUID keys, timestamptz, jsonb, and status enums. - Use Case: When adding a new campaigns table, generate the migration with RLS policies, FK indexes, and a rollback comment block in one pass instead of assembling each piece from documentation. ## Quick Start Ask the assistant to create a Supabase migration for a new table with RLS policies and a rollback block.

Frequently Asked Questions about supabase-migrations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a Supabase migration with RLS policies?

Create a timestamped SQL file in supabase/migrations/, enable row level security on the table, then add SELECT, INSERT, UPDATE, and DELETE policies using auth.uid() = user_id. Include a rollback comment block with the inverse DDL at the bottom.

How do I set up pgvector indexes in Supabase?

Enable the extension with CREATE EXTENSION IF NOT EXISTS vector, add a vector(1536) column, then create an IVFFlat index using vector_cosine_ops with lists = 100. IVFFlat is sufficient under 1M vectors; switch to HNSW beyond that scale.

Why is my Supabase table returning no rows after enabling RLS?

Enabling RLS without adding policies silently blocks all access. You must create policies for each operation (SELECT, INSERT, UPDATE, DELETE) immediately after enabling RLS, typically checking auth.uid() against the row's user_id.

Should I use timestamp or timestamptz in Postgres?

Always use timestamptz. Plain timestamp loses timezone information and causes bugs for users in different timezones, while timestamptz stores an absolute point in time with DEFAULT now().

Does the Supabase service-role key bypass RLS?

Yes, the service-role key bypasses all row-level security policies. Never use it in frontend code; frontend clients must use the anon key so RLS policies are enforced per user.

How do I roll back a Supabase migration?

Supabase does not auto-rollback migrations. Each migration file should include a commented rollback block with the inverse DDL, such as DROP POLICY and DROP TABLE statements, which you execute manually to reverse the change.