supabase-rls-policies

Design and enforce Supabase Row Level Security policies for PostgreSQL tables.

Updated Aug 29, 2023
One-click install
npx skills add https://github.com/SaschaLeh/dotfiles --skill supabase-rls-policies
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: supabase-rls-policies
Source: https://github.com/SaschaLeh/dotfiles/tree/main/dot_claude/skills/supabase-rls-policies
Command: npx skills add https://github.com/SaschaLeh/dotfiles --skill supabase-rls-policies

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Creating and applying Row Level Security policies to protect user data in Supabase PostgreSQL, ensuring per-user and per-role access with scalable, maintainable rules.

Core Features & Use Cases

  • Define per-operation policies for SELECT, INSERT, UPDATE, and DELETE to control access granularity and auditability.
  • Leverage auth.uid() and auth.jwt() to implement user-aware and role-based access controls.
  • Support multi-tenant isolation patterns with tenant-aware policies and admin/service roles.
  • Optimize performance with carefully indexed columns and minimal per-row evaluation.

Quick Start

Define and apply RLS policies for your Supabase tables to restrict data access by user and role.

Frequently Asked Questions about supabase-rls-policies

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

FAQPage Schema
How do I enforce Row Level Security policies in Supabase for multi-tenant apps?▼

Row Level Security policies in Supabase enforce multi-tenant isolation by applying tenant-aware rules and admin service roles to restrict data access per user and per role.

Do I need separate RLS policies for SELECT, INSERT, UPDATE, and DELETE in PostgreSQL?▼

Yes, defining separate RLS policies per operation for SELECT, INSERT, UPDATE, and DELETE using the TO clause controls access granularity and auditability for each specific database action.

How do I use auth.uid() and auth.jwt() to implement role-based access control in Supabase?▼

Role-based access control in Supabase uses auth.uid() and auth.jwt() wrapped in subqueries to evaluate user-aware permissions and enforce precise per-row data access policies.

What's the best way to optimize PostgreSQL RLS policies for performance?▼

Optimizing RLS policies requires carefully indexing columns and minimizing per-row evaluation overhead to maintain scalable and maintainable rules for user data protection in Supabase.

When should I use the TO clause in Supabase RLS policies?▼

The TO clause in Supabase RLS policies should be used when defining separate per-operation policies to explicitly target specific roles and ensure precise access control over SELECT, INSERT, UPDATE, and DELETE operations.