Supabase

Development guidelines for Supabase, a hosted backend that provides a Postgres database, user login, file storage, live updates, server functions, and vector or AI features.

In plain words
What is it for?
Use them when building or changing Supabase databases, authentication, storage, realtime features, edge functions, or AI and vector functionality.
Why use it?
They give an agent consistent rules for organizing database changes, protecting keys, using the Supabase client, and developing locally with the Supabase command-line tools.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/thesethrose/devrules/supabase
Clone the repo
git clone --depth 1 https://github.com/TheSethRose/DevRules

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,840 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01840
Opus 5 $0.00000 $0.00920
Sonnet 5 $0.00000 $0.00368
Haiku 4.5 $0.00000 $0.00184

Measured yesterday against content hash a0c23539f769, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

Supabase scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/technologies/Supabase.mdc · 131 lines

How it starts

The opening of the file, as written. The whole thing — 131 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Supabase Development Guidelines

You are an expert developer working with Supabase, covering its core features like Database, Auth, Storage, Realtime, Edge Functions, and AI.

General

  • Use Supabase client libraries (@supabase/supabase-js is primary, but libraries exist for Flutter, Python, C#, Swift, Kotlin) for interacting with services.
  • Manage environment variables securely (e.g., .env file with NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEY).
  • Prefer local development using the Supabase CLI (supabase start, supabase db diff, supabase db reset, supabase functions serve, etc.).
  • Consult the official Supabase documentation (https://supabase.com/docs) for detailed API references and guides.

Database (Postgres Migrations)

You are a Postgres Expert creating secure database schemas using Supabase migrations.

Directory: All migration files belong in supabase/migrations/.

Workflow:

  1. Make schema changes locally (e.g., using Supabase Studio at localhost:54323 after supabase start).
  2. Generate a migration file using the CLI: supabase db diff -f "short_description".
  3. Review and potentially edit the generated SQL migration file.
  4. Apply and test locally: supabase db reset.
  5. Commit the migration file to Git.

Migration File Naming:

  • Files MUST be named YYYYMMDDHHmmss_short_description.sql.
  • Timestamp components (YYYY, MM, DD, HH, mm, ss) must use UTC time and have correct padding (e.g., 20240507090530_add_profiles_table.sql).

SQL Guidelines:

  • Write standard, lowercase Postgres-compatible SQL.
  • Header Comment: Include metadata (purpose, affected tables/columns, considerations).
-- Migration: Create user profiles table
--
-- Adds a table to store user profile information linked to auth.users.
--
  • Detailed Comments: Explain the purpose of each significant step.
  • Destructive Operations: Add explicit, clear comments before DROP, TRUNCATE, or ALTER commands that might cause data loss.
  • Row Level Security (RLS):
    • MUST enable RLS on all new tables: alter table your_table enable row level security;
    • MUST create granular RLS policies covering relevant actions (SELECT, INSERT, UPDATE, DELETE).
    • Create separate policies for anon and authenticated roles, even if the logic is identical.
    • For public read access: create policy "Allow public read access" on your_table for select using (true);
    • For user-specific access (example): create policy "Allow individual insert access" on your_table for insert with check (auth.uid() = user_id);
    • Include comments explaining the rationale for each policy.
  • DO NOT use migra limitations: Avoid INSERT/UPDATE/DELETE, complex ALTER POLICY, COMMENT ON, partitions, ALTER PUBLICATION, CREATE DOMAIN directly in schema definitions meant for db diff. Use explicit migration files for these.

Read the full file on GitHub · 131 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 131 lines · 0 tokens per session scan A a0c23539f769

Subscribe to this mod's changes

Supabase is a cursor rule published in the GitHub repository TheSethRose/DevRules (25 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,840 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.