supabase-rls-policy

Generate Supabase PostgreSQL row-level security policies with per-operation rules.

4|Updated Dec 13, 2025
One-click install
npx skills add https://github.com/linehaul-ai/linehaulai-claude-marketplace --skill supabase-rls-policy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: supabase-rls-policy
Source: https://github.com/linehaul-ai/linehaulai-claude-marketplace/tree/main/.claude-plugin/supabase/skills/supabase-rls-policy
Command: npx skills add https://github.com/linehaul-ai/linehaulai-claude-marketplace --skill supabase-rls-policy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides expert guidance for writing Supabase PostgreSQL Row-Level Security policies, ensuring correct syntax, role usage (anon, authenticated), and production-ready patterns.

Core Features & Use Cases

  • Policy Structure: separate policies for SELECT, INSERT, UPDATE, DELETE
  • Supabase Roles: anon and authenticated and how to apply TO clause
  • Helper Functions: auth.uid() and auth.jwt()
  • MFA & Performance: MFA checks and indexing recommendations

Quick Start

Create a policy example on a table to restrict access to authenticated users using their user id.

Frequently Asked Questions about supabase-rls-policy

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

FAQPage Schema
How do I write row-level security policies for Supabase PostgreSQL tables?

Row-level security policies in Supabase enforce per-operation access control using separate policies for SELECT (USING clause), INSERT (WITH CHECK), UPDATE (both clauses), and DELETE (USING). Use auth.uid() to restrict rows to authenticated users and apply policies to tables via the TO clause, specifying roles like authenticated or anon.

What's the difference between USING and WITH CHECK in Supabase RLS policies?

USING filters which rows a user can see or delete; WITH CHECK validates rows before insert or update. UPDATE policies use both: USING filters existing rows, WITH CHECK validates new data. SELECT and DELETE use only USING; INSERT uses only WITH CHECK.

Can I enforce MFA checks in Supabase row-level security policies?

Yes. Supabase RLS policies can leverage auth.jwt() to access JWT claims and verify MFA status. Optional MFA checks can be added to policy conditions to require multi-factor authentication before granting row access, enhancing security for sensitive operations.

How do I set up policies for anonymous vs authenticated users in Supabase?

Create separate policies with the TO clause specifying role: TO authenticated for logged-in users and TO anon for unauthenticated access. Use auth.uid() in authenticated policies to restrict rows to the current user; anon policies typically grant read-only access to public data.

What indexing and performance practices improve Supabase RLS policy speed?

Create indexes on columns used in policy conditions—especially those referenced in auth.uid() comparisons and WHERE clauses. Indexing reduces query overhead by enabling efficient row filtering, critical for production workloads where policies are evaluated per row.

Do I need to write separate policies for each operation on a Supabase table?

Yes. Production-ready Supabase security requires distinct policies per operation: SELECT, INSERT, UPDATE, and DELETE each enforce different access patterns. Separate policies ensure correct clause usage (USING vs WITH CHECK) and granular control over read, write, and modification permissions.