Skip to main content
rule CX Codex

supabase-migrations — Claude Code rule for Supabase migrations

This rule guides Claude Code when creating Supabase SQL migrations, from timestamped filenames to RLS policies. It applies to files under supabase/migrations/.

AGPL-3.0 ★ 267 updated 2026-02-20

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/supabase-migrations.mdc
Open on GitHub

What supabase-migrations does

When asked to create a migration, Claude Code is directed to put it in supabase/migrations/ and use a UTC timestamp followed by a short description in the filename, such as 20240906123045_create_profiles.sql. The timestamp needs to use UTC, which determines the migration’s ordering.

The rule calls for lowercase SQL and comments describing the migration’s purpose, affected tables, and steps. New tables must have RLS enabled. Policies should be separate for each operation and for the anon and authenticated roles, with comments explaining their intent. Destructive changes, including dropping tables or columns, also need detailed comments.

What it helps with

  • create a migration in the expected directory
  • name a migration with a UTC timestamp
  • enable RLS on a new table
  • separate access policies by operation and role
  • document destructive schema changes

Example prompts for the agent

  • Create a Supabase migration for a profiles table in supabase/migrations/.
  • Add separate RLS policies for anon and authenticated on the new table.
  • Write a migration that drops a column and explain the change in comments.

How to install supabase-migrations

Manually: put the files in place

.cursor/rules/supabase-migrations.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about supabase-migrations

How do I install supabase-migrations in Claude Code?

Add the rule file at .claude/rules/supabase-migrations.md.

What does supabase-migrations do?

It guides Claude Code in writing Supabase migrations, including their file names, SQL style, documentation, and RLS policies.

How should RLS policies be organized?

Use separate policies for each operation and for each of the anon and authenticated roles. Add comments that explain each policy’s purpose.

Similar IDE rules

All IDE rules for Data and databases →

From the same set24

The whole set →
github-action Guides Claude Code in generating GitHub Actions workflows with scoped secrets, composite steps, and upstream version checks. CX Codex +1 ★ 267repo stars shadcn-resume-implementation shadcn-resume-implementation is a Claude Code command that resumes frontend work from a saved status. It uses the implementation plan, frontend rules, and type definitions. CX Codex +1 ★ 267repo stars shadcn-plan-summary shadcn-plan-summary — a command that captures decisions from UI architecture sessions. Extracts choices about layout, flows, API integration, and state management, then compiles them into a structured report for the next development phase. CX Codex +1 ★ 267repo stars test-plan test-plan is a Claude Code rule that builds a project-specific test plan from the codebase and tech stack. It writes the result in Polish as Markdown. CX Codex +1 ★ 267repo stars generate-types-from-supabase generate-types-from-supabase analyzes Supabase schema and generates TypeScript types for DTOs and Command Models. Cuts down manual type definition work by deriving structures from your database. CX Codex +1 ★ 267repo stars vitest-unit-testing vitest-unit-testing is a Claude Code rule for writing Vitest unit tests. It guides module mocking and React component test structure. CX Codex +1 ★ 267repo stars project-prd The project-prd command turns project plans into a structured PRD and saves it as a Markdown file. Use it to draft requirements, user stories, and acceptance criteria. CX Codex +1 ★ 267repo stars 10x-implement 10x-implement — a command to implement approved technical plans step-by-step in Claude Code. Reads the plan, tracks progress, and verifies each phase before moving on. CX Codex +1 ★ 267repo stars

Project sponsors

Companies that keep this analytics open