supabase-rls-specialist

Enforce Row Level Security policies on Supabase tables to prevent unauthorized row access.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/Whaleylaw/llm-lawyer --skill supabase-rls-specialist
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: supabase-rls-specialist
Source: https://github.com/Whaleylaw/llm-lawyer/tree/main/.claude/skills/supabase-rls-specialist
Command: npx skills add https://github.com/Whaleylaw/llm-lawyer --skill supabase-rls-specialist

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps teams implement and debug Row Level Security policies in Supabase/Postgres to prevent unauthorized row access, eliminate data leaks between users or tenants, and fix common permission errors that block application functionality.

Core Features & Use Cases

  • Policy authoring: Provides ready-to-use SQL patterns for SELECT, INSERT, UPDATE, DELETE, ALL, and time-based or hierarchical access rules.
  • Multi-tenant and role support: Shows how to enforce tenant_id or organization_id constraints and combine role checks (admin, editor) with ownership.
  • Testing and debugging: Explains how to simulate sessions, inspect policies, detect infinite recursion, and safely use the service role for admin operations.
  • Use Case: Harden a personal-injury case management app so clients see only their documents, editors see organization documents, and admins retain full access while preventing service role exposure.

Quick Start

Audit the documents table and propose RLS policies that ensure users and tenants can only access their permitted rows while providing safe admin bypass procedures.

Frequently Asked Questions about supabase-rls-specialist

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

FAQPage Schema
How do I enforce row level security in Supabase to prevent unauthorized data access?

To enforce row level security (RLS) in Supabase, you enable RLS on tables and create SQL policies using auth.uid() and request.jwt.claims to validate user identity and permissions, preventing unauthorized row access.

What is the best way to set up multi-tenant RLS policies in PostgreSQL?

The best way to set up multi-tenant RLS policies in PostgreSQL is by creating SQL constraints that filter rows based on tenant_id or organization_id, combined with role checks for admins and editors to ensure proper data isolation.

How do I test and debug Supabase RLS permission errors?

You can test and debug Supabase RLS permission errors by simulating user sessions, inspecting active policies, and checking for infinite recursion. Operational checks validate RLS behavior using request.jwt.claims and auth.uid().

Can I use the Supabase service role to bypass row level security policies?

Yes, the Supabase service role bypasses row level security policies, but it must be used safely for admin operations to prevent service role exposure. Guidance is provided for secure admin bypass procedures.

Why does my Supabase RLS policy cause infinite recursion?

Supabase RLS policies cause infinite recursion when policy queries reference the same table being protected. Debugging involves inspecting policies and simulating sessions to detect and resolve the recursive loop.