supabase-enterprise-rbac
Skill by jeremylongshore
Implements custom role-based access control in Supabase using JWT claims from app_metadata. It is for developers building admin, editor, member, or viewer permissions with organization-scoped RLS policies.
Install supabase-enterprise-rbac
Built from the published package, never by AI.
git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace /tmp/tons-of-skills-marketplace && mkdir -p ~/.claude/skills && cp -r /tmp/tons-of-skills-marketplace/skills/.curated/supabase-enterprise-rbac ~/.claude/skills/supabase-enterprise-rbacRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install supabase-enterprise-rbac in Claude Code
git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace /tmp/tons-of-skills-marketplace && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/tons-of-skills-marketplace/skills/.curated/supabase-enterprise-rbac ~/.gemini/antigravity-cli/skills/supabase-enterprise-rbacAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install supabase-enterprise-rbac in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill sets up role-based access control (RBAC) in Supabase. Roles are stored in the user's app_metadata with the Admin API, so they appear in the JWT. RLS policies then read those claims through auth.jwt() and helper functions such as get_user_role() and get_user_org_id(). Policies combine an org_id tenant check with a role check for each SELECT, INSERT, UPDATE, and DELETE operation.
The skill also covers application-layer checks, so API routes do not rely on RLS alone. It describes a withRole() middleware that returns 401 or 403 responses, a hasRole() hierarchy check, and admin operations such as listing members, inviting users, and changing roles. It is written for developers building multi-role or multi-tenant applications on Supabase who need custom permissions beyond the built-in anon and authenticated roles.
Written from the project's SKILL.md and checked against it.
What it can do
- Role assignmentSets role and org_id claims in app_metadata using admin.updateUserById().
- JWT claim helpersProvides get_user_role() and get_user_org_id() SQL functions for RLS policies.
- Role-based RLS policiesScopes SELECT, INSERT, UPDATE, and DELETE by role hierarchy: admin, editor, member, viewer.
- Organization-scoped accessUses org_id in JWT claims and RLS policies for multi-tenant isolation.
- Application-layer enforcementProvides a withRole() middleware for API routes with 401 and 403 responses.
- Role hierarchy checksProvides a hasRole() function for comparing role levels during escalation checks.
- Admin panel operationsCovers listing members, inviting users, and changing roles with database and JWT updates.
- Organization onboardingDescribes onboardOrganization(), which creates an org, assigns the creator as admin, and seeds team_members.
- API key scopingCovers scoping API keys per role.
What you need
- Supabase project with authentication configured
- @supabase/supabase-js v2 or later
- Service role key for admin operations
- SQL Editor or psql access for creating RLS policies
- Claude Code
Try asking
- Set up admin, editor, and viewer roles in app_metadata for my Supabase users
- Write RLS policies that limit project inserts to admins and editors in the same org
- Create a withRole() middleware that returns 403 for users without the required role
Good to know
- The service role key bypasses RLS, so use it only in server-side admin code.
- Users must sign out and back in, or refresh their session, before a role change appears in the JWT.
- The skill references several supporting files that are not included in this source.
Security check
B- Allowed to use Write, Edit without limitsIn
SKILL.md
Checked automatically: skills/.curated/supabase-enterprise-rbac/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
Allowed tools: ReadWriteEditBash(npx supabase:*)Bash(supabase:*)Bash(psql:*)
Alternatives to supabase-enterprise-rbac
All alternatives →Creates, configures and manages datasets on the Hugging Face Hub, including SQL-based querying and transformation. Built for people who edit dataset content and metadata directly, alongside the HF MCP server.
Diagnoses and repairs gbrain's Postgres access when a command or MCP result shows a GBRAIN_DB_ACCESS marker, or when the operator reports the brain database is down. It runs the hardcoded gbrain db-repair ladder and verifies the result with a re-probe.
Manages clusters, instances, and backups for AlloyDB for PostgreSQL. Built for creating, configuring, and administering AlloyDB databases, not general PostgreSQL or Cloud SQL instances.
Writes, reviews and migrates Supabase logs queries against the ClickHouse logs table served by the logs.all.otel endpoint. Built for developers who write Logs Explorer SQL or convert older BigQuery logs queries.
Diagnoses and fixes slow Paperclip PostgreSQL queries using Cloud and Neon evidence, local benchmarks, regression tests, and a pull request with passing checks. Built for engineers working on Paperclip.
Guides AI assistants through Prisma 8 projects built on @prisma/orm-postgres, @prisma/orm-sqlite, or @prisma/orm-mongo. It covers data contracts, migrations, typed queries and runtime setup for developers on Prisma 8.
Compare with hugging-face-datasets, db-repair or alloydb-basics
supabase-enterprise-rbac: common questions
Where are the user roles stored in Supabase?
The skill stores roles in the user's app_metadata, which is set with the Admin API. The claims then appear in every JWT the user receives.
Why does my role not show up after I change it?
The JWT is cached with the old claims. The user must sign out and sign in again, or call supabase.auth.refreshSession().
Does this skill enforce roles only in the database?
No. The skill also enforces roles in application code with a withRole() middleware, so API routes do not rely on RLS alone.
How do I install supabase-enterprise-rbac?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is supabase-enterprise-rbac free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is supabase-enterprise-rbac safe to use?
It scores 77 of 100. Grades: maintenance A, licence A, quality A. Security check: grade B (allowed to use write, edit without limits). Review the code before you install. How grades work.
What are alternatives to supabase-enterprise-rbac?
Similar skills: hugging-face-datasets, db-repair, alloydb-basics, clickhouse-logs-queries.
