supabase-rls-policies

supabase-rls-policies is a cursor rule for Cursor from squirrelogic/cursor-rules. It costs 0 tokens per session (1,887 once invoked), scanned A, a copy of guidelines-for-writing-postgres-row-level-security-policies-with-supabase, MIT.

Rules for writing PostgreSQL Row Level Security policies in Supabase. Row Level Security controls which database rows each signed-in user may read or change.

In plain words
What is it for?
Use them when generating or revising SELECT, INSERT, UPDATE, or DELETE policies. They guide policy names, access conditions, SQL quoting, and the use of auth.uid().
Why use it?
They reduce common policy mistakes by specifying the allowed SQL forms and the correct conditions for each operation. They also enforce use of the authenticated user's ID when checking access.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Good fit Use them when generating or revising SELECT, INSERT, UPDATE, or DELETE policies. They guide policy names, access conditions, SQL quoting, and the use of auth.uid().

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/squirrelogic/cursor-rules/supabase-rls-policies
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.

Clone the repo
git clone --depth 1 https://github.com/squirrelogic/cursor-rules

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for supabase-rls-policies

README.md
[![agentmods](https://agentmods.dev/badge/rules/squirrelogic/cursor-rules/supabase-rls-policies/github.svg)](https://agentmods.dev/rules/squirrelogic/cursor-rules/supabase-rls-policies)
Your own site
<a href="https://agentmods.dev/rules/squirrelogic/cursor-rules/supabase-rls-policies"><img src="https://agentmods.dev/badge/rules/squirrelogic/cursor-rules/supabase-rls-policies/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for supabase-rls-policies

Your own site · 80×15
<a href="https://agentmods.dev/rules/squirrelogic/cursor-rules/supabase-rls-policies"><img src="https://agentmods.dev/badge/rules/squirrelogic/cursor-rules/supabase-rls-policies.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,887 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 92% copy Near-identical to another mod 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.1 $0.00000 $0.01887
Opus 5.5 $0.00000 $0.00755
Sonnet 5.5 $0.00000 $0.00377
Haiku 4.5 $0.00000 $0.00189

Measured 2mo ago against content hash bd90a2ad0b21, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

supabase-rls-policies 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 2mo ago.

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.

Origin

This is a copy

92% identical to guidelines-for-writing-postgres-row-level-security-policies-with-supabase — 14 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

supabase/supabase-rls-policies.mdc · 249 lines

How it starts

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

Database: Create RLS policies

You're a Supabase Postgres expert in writing row level security policies. Your purpose is to generate a policy with the constraints given by the user. You should first retrieve schema information to write policies for, usually the 'public' schema.

The output should use the following instructions:

  • The generated SQL must be valid SQL.
  • You can use only CREATE POLICY or ALTER POLICY queries, no other queries are allowed.
  • Always use double apostrophe in SQL strings (eg. 'Night''s watch')
  • You can add short explanations to your messages.
  • The result should be a valid markdown. The SQL code should be wrapped in ``` (including sql language tag).
  • Always use "auth.uid()" instead of "current_user".
  • SELECT policies should always have USING but not WITH CHECK
  • INSERT policies should always have WITH CHECK but not USING
  • UPDATE policies should always have WITH CHECK and most often have USING
  • DELETE policies should always have USING but not WITH CHECK
  • Don't use FOR ALL. Instead separate into 4 separate policies for select, insert, update, and delete.
  • The policy name should be short but detailed text explaining the policy, enclosed in double quotes.
  • Always put explanations as separate text. Never use inline SQL comments.
  • If the user asks for something that's not related to SQL policies, explain to the user that you can only help with policies.
  • Discourage RESTRICTIVE policies and encourage PERMISSIVE policies, and explain why.

The output should look like this:

CREATE POLICY "My descriptive policy." ON books FOR INSERT to authenticated USING ( (select auth.uid()) = author_id ) WITH ( true );

Since you are running in a Supabase environment, take note of these Supabase-specific additions below.

Authenticated and unauthenticated roles

Supabase maps every request to one of the roles:

  • anon: an unauthenticated request (the user is not logged in)
  • authenticated: an authenticated request (the user is logged in)

Read the full file on GitHub · 249 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. 2mo ago First seen · 249 lines · 1,887 tokens per session scan A bd90a2ad0b21

Subscribe to this mod's changes

supabase-rls-policies is a cursor rule published in the GitHub repository squirrelogic/cursor-rules (20 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,887 tokens. A static security scan graded it A with 0 findings. It is 92% identical to guidelines-for-writing-postgres-row-level-security-policies-with-supabase, differing in 14 lines, and is treated as a copy.

Related

supabase-rls-policies compared with cursor rules from other repositories

supabase-rls-policies next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
supabase-rls-policiessquirrelogic/cursor-rulesCursor rule201y agoMITA0Cursor
adapter-featuresprest/prestCursor rule4.6ktodayMITA773Cursor
unit-tests-tddprest/prestCursor rule4.6ktodayMITA375Cursor
planning-and-delegationprest/prestCursor rule4.6ktodayMITA912Cursor
integration-testsprest/prestCursor rule4.6ktodayMITA0Cursor
postgresqlPatrickJS/awesome-cursorrulesCursor rule41k5mo agoCC0-1.0A318Cursor
netlify-database-migration-from-extensionnetlify/context-and-toolsCursor rule51yesterdayMITA16Cursor