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.