SupabaseRule
by DUOMReport
Rules for apps on Supabase: row level security on every table, keys, migrations and generated types.
DatabasesLicense: CC0-1.0Updated yesterdayrule/supabase
Install
Run in your project folder (DuoM CLI: risk check, then write; undo with npx duom@1 undo)
npx duom@1 add rule/supabase --client claude-code
Writes to CLAUDE.md in your project (where Claude Code reads it). If the project has an AGENTS.md but no CLAUDE.md, DuoM creates CLAUDE.md starting with @AGENTS.md so Claude Code keeps reading it. Only the marked block is added; the rest of the file is left alone, and remove takes out only that block.
Manual: paste into CLAUDE.md
CLAUDE.md
<!-- duom:rule/supabase --> ## Supabase - Every table in an exposed schema has row level security enabled with explicit policies. No table ships without RLS. - The anon key is public and is fine in the browser. The service_role key bypasses RLS: server only, never in client code or NEXT_PUBLIC_ vars. - Change the schema with migrations (supabase migration new), not by hand in the dashboard, so every environment matches. - Regenerate types after a schema change (supabase gen types) and use them in queries. - Use the SSR helpers for auth cookies in server code; do not trust a user id sent by the client. <!-- /duom:rule/supabase -->
The rule
Supabase
- Every table in an exposed schema has row level security enabled with explicit policies. No table ships without RLS.
- The anon key is public and is fine in the browser. The service_role key bypasses RLS: server only, never in client code or NEXT_PUBLIC_ vars.
- Change the schema with migrations (supabase migration new), not by hand in the dashboard, so every environment matches.
- Regenerate types after a schema change (supabase gen types) and use them in queries.
- Use the SSR helpers for auth cookies in server code; do not trust a user id sent by the client.