supabase-patterns

Enforce locked Supabase client factories across Next.js contexts.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/WorkSync-Developement/developertestrepo --skill supabase-patterns-worksync-developement
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: supabase-patterns
Source: https://github.com/WorkSync-Developement/developertestrepo/tree/main/.windsurf/skills/supabase-patterns
Command: npx skills add https://github.com/WorkSync-Developement/developertestrepo --skill supabase-patterns-worksync-developement

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill defines and enforces a locked pattern for using Supabase in coverage-nextjs projects, preventing misconfigurations and unsafe defaults.

Core Features & Use Cases

  • Pattern enforcement: Ensures only the allowed Supabase client factories are used across client, server, and admin contexts.
  • Security boundaries: Maintains RLS discipline for user contexts and prevents exposure of service-role keys to the browser.
  • Guidance & governance: Documents standard file paths, environment variable rules, and hard prohibitions to simplify compliant development.

Quick Start

Reference the documented client factories and environment rules when wiring up Supabase in a Next.js application, then audit code to ensure only getSupabaseClient, createSupabaseServerClient, and createSupabaseAdminClient are used in the correct contexts.

Frequently Asked Questions about supabase-patterns

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

FAQPage Schema
How do I prevent my Supabase service role key from being exposed in a Next.js app?

To prevent your Supabase service role key from being exposed, enforce locked client factories that restrict admin context to server-side API routes. Never import createSupabaseAdminClient in browser pages, ensuring the service role key stays server-only.

What is the safest way to enforce Supabase RLS across browser and server contexts?

Enforcing Supabase RLS across browser and server contexts requires using specific client factories for each environment. Use getSupabaseClient for browser pages and createSupabaseServerClient for API routes to maintain user security boundaries.

Do I need separate Supabase client factories for browser, server, and admin tasks?

Yes, you need separate Supabase client factories for browser, server, and admin tasks to maintain strict security boundaries. Using getSupabaseClient, createSupabaseServerClient, and createSupabaseAdminClient prevents misconfigurations and enforces RLS discipline.

What environment variables are required for secure Supabase patterns in Next.js?

Secure Supabase patterns in Next.js require documented environment variables for browser, server, and admin contexts. You must locate and configure these env-vars correctly before wiring up the allowed client factories to prevent exposing sensitive keys.

Why does my Supabase admin client bypass Row Level Security policies?

Your Supabase admin client bypasses RLS policies because it uses the service role key, which is designed for privileged operations. To maintain safe patterns, restrict createSupabaseAdminClient usage strictly to server-side contexts where RLS is intentionally bypassed.

What's the best way to audit a Next.js project for unsafe Supabase client usage?

The best way to audit a Next.js project for unsafe Supabase client usage is to locate getSupabaseClient, createSupabaseServerClient, and createSupabaseAdminClient imports. Verify each factory operates in its correct browser, server, or admin context.