setup-rls

Configure Supabase Row Level Security policies for table data access.

1|Updated Oct 19, 2025
One-click install
npx skills add https://github.com/rdimascio/supabase-marketplace --skill setup-rls
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: setup-rls
Source: https://github.com/rdimascio/supabase-marketplace/tree/main/plugins/database-operations/.claude/skills/setup-rls
Command: npx skills add https://github.com/rdimascio/supabase-marketplace --skill setup-rls

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill configures Row Level Security policies for Supabase tables, enabling fine-grained access control across datasets.

Core Features & Use Cases

  • Enable RLS: Turn on RLS on target tables.
  • Policy Creation: Create per-operation policies with clear naming.
  • Test & Validate: Validate access for different roles.

Quick Start

Define an RLS policy for a sample table 'projects' to allow SELECT for authenticated users but restrict UPDATE to the owner, with test steps.

Frequently Asked Questions about setup-rls

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

FAQPage Schema
How do I set up Row Level Security policies in Supabase?

Row Level Security policies control data access at the row level in Supabase tables. Enable RLS on your target table, then create per-operation policies for SELECT, INSERT, UPDATE, and DELETE that check user authentication and authorization rules. Test policies with different roles to verify access restrictions work as intended.

Can I use RLS to restrict data access by user role in a multi-tenant application?

Yes. RLS policies evaluate auth checks for each operation, allowing you to restrict SELECT, UPDATE, and DELETE based on user roles and tenant context. Define policies that match rows to authenticated users or role-based conditions, enabling fine-grained access control across multi-tenant datasets.

What's the best way to test Row Level Security policies before deployment?

After creating RLS policies, validate access by testing each policy with different authenticated roles. Verify that SELECT policies return only authorized rows, INSERT policies accept or reject based on rules, UPDATE policies enforce ownership or role checks, and DELETE policies block unauthorized removal.

How do I structure RLS policies for owner-based access control?

Create UPDATE and DELETE policies that wrap auth checks in SELECT statements, comparing the authenticated user's ID against an owner column. This pattern ensures only the row owner can modify or delete records, a common requirement for permission-based access in applications.

Does Row Level Security support permission-based access for different operations?

Yes. RLS supports separate policies for each operation—SELECT, INSERT, UPDATE, DELETE—with distinct permission checks. Use descriptive policy names and role-specific auth logic to implement granular permission-based access for each operation type.

Why should I wrap auth checks in SELECT statements within RLS policies?

Wrapping auth checks in SELECT improves policy performance by allowing the database to optimize query execution. This approach reduces computational overhead when evaluating complex authorization logic across large datasets.

Related Skills