RLS Policy Templates

Generate Supabase Row Level Security policies with JWT authentication.

Updated Apr 30, 2026
One-click install
npx skills add https://github.com/bytetalent/docs --skill rls-policy-templates
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: RLS Policy Templates
Source: https://github.com/bytetalent/docs/tree/main/skills/db/rls-policies
Command: npx skills add https://github.com/bytetalent/docs --skill rls-policy-templates

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires supabase, drizzle, clerk, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill automates the generation of Row Level Security (RLS) policies for user-owned and shared resources in Supabase databases, reducing manual configuration efforts and ensuring consistent application of security rules.

Core Features & Use Cases

  • Auto-generated RLS Policies: Create RLS policies based on the configuration of the Supabase database, catering to user-owned tables, org-shared tables, and read-only reference tables.
  • Integration with JWT Authentication: Integrates with Clerk JWT-based authentication for secure user identification in RLS policies.
  • System Catalog and Reference Tables: Provides pre-written policies for system catalog tables and reference tables that can be enabled for read access without write operations.
  • Drizzle Defense-in-Depth: Implements additional application-side filtering to reinforce database-level RLS and ensure security.

Quick Start

Execute the script to generate RLS policies for a user-owned table in the database named 'entities'.

Frequently Asked Questions about RLS Policy Templates

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

FAQPage Schema
How do I automate Row Level Security policies in Supabase for user-owned tables?

Generate Supabase Row Level Security policies automatically by executing a script that analyzes your database schema and creates policies for user-owned and shared tables. This eliminates manual configuration and ensures consistent security rule application.

Can I use Clerk JWT authentication for dynamic role-based access control in Supabase RLS?

Yes, you can integrate Clerk JWT-based authentication into Supabase RLS policies for secure user identification. This enables dynamic role-based access control by mapping authenticated user claims directly to database row access permissions.

Does this RLS generation approach support Drizzle for defense-in-depth database security?

Yes, the approach implements Drizzle defense-in-depth by applying additional application-side query filtering. This reinforces database-level Row Level Security policies, ensuring multiple security layers protect user-owned and shared resources.

What is the best way to configure read-only access for Supabase reference tables without write operations?

Configure read-only access for Supabase reference tables by applying pre-written RLS policies provided for system catalog and reference tables. These policies enable read access while strictly preventing any write operations on the data.

Do I need database schema access and user credentials to generate RLS policies for organization-shared resources?

Yes, generating RLS policies for organization-shared resources requires access to the database schema to identify table structures and user credentials for authentication. This ensures policies accurately reflect dynamic role-based access controls.