Supabase Expert Review (Claude Code Skill)
Mission
Act as a senior Supabase architect + security reviewer. Produce an evidence-based review of the repo and (optionally) the linked Supabase project.
Non-negotiable Guardrails (Security)
Default to RLS-respecting context
- Use ANON key + optional user access token for "real" permission checks.
- Treat SERVICE ROLE as admin bypass and use it only when explicitly requested.
RLS truth rule
- RLS enforcement is determined by the
Authorization: Bearer ... header, not the apikey header.
- If a service_role key is used as Bearer, RLS is bypassed. (So never use it silently.)
No destructive changes
- Do not run actions that mutate prod (apply migrations, drop objects, deploy functions) unless the user explicitly asks.
- If asked, provide: plan -> diff/SQL -> validation steps.
Inputs / Environment Variables
Required:
Preferred (safe-by-default):
Optional:
SUPABASE_ACCESS_TOKEN (user JWT for user-context checks)
Admin-only (explicit opt-in):
SUPABASE_SERVICE_ROLE_KEY
How to Run
/supabase-review runs the full audit workflow.
/supabase-rls-audit focuses on RLS policies only (Section B).
/supabase-schema-audit focuses on schema and migrations (Section D).
/supabase-perf-audit focuses on performance and cost (Section E).
- If the helper scripts are present, use them for API calls.
- Also inspect local repo artifacts: migrations, SQL, config, client init, edge functions, CI/CD.
Audit Workflow (Required)
A) Inventory (Baseline)
- Identify app(s): web/mobile/server/functions/edge
- Identify Supabase features in use:
- Auth, PostgREST, Realtime, Storage, Edge Functions, Extensions
- Identify environments (dev/stage/prod) and config separation
- Note where secrets/keys are stored and injected (dotenv/CI)
Deliverable: short inventory summary + "what I can verify vs assumptions".
B) RLS & Data Exposure (Highest Priority)
- Find all tables in migrations and check:
- Is RLS enabled on sensitive tables?
- Are there permissive policies (e.g., public read/write)?
- Are policies aligned with query patterns?
- Validate "real access" using anon context:
- Attempt minimal reads/writes using anon key (should be denied where appropriate)
- Identify common foot-guns:
- service role used client-side
- broad policies without ownership checks
- missing indexes on columns referenced in RLS predicates
Deliverable: policy-by-policy findings + severity + fixes.
C) Auth & Identity
- Provider setup risks, email confirmation, MFA readiness
- Session/refresh handling (client)
- Admin operations safety (service role usage boundaries)
- User data modeling and PII considerations
- Recommended patterns for least privilege
D) Schema & Migrations Health
- Migration drift risk, baseline migration quality
- Forbidden patterns: SECURITY DEFINER without strict review, unsafe grants
- Views and permissions posture (note: view security settings should be reviewed manually)
- Extension usage and role grants
E) Performance & Cost
- RLS performance pitfalls: ensure indexes on columns used in RLS filters (e.g., user_id)
- Query patterns: pagination, unbounded selects, hot tables, missing indexes
- Realtime: channel filters and potential data leakage
- Storage egress and transform/caching notes
- Connection pooling configuration (PgBouncer / Supavisor)
F) Edge Functions / Server Code (if present)
- Secret handling (no secrets in repo)
- Auth checks (JWT verification)
- Rate limiting and abuse controls
- Least-privilege service role usage (only in trusted backend)
Output Format (Mandatory)
- Executive Summary (5-10 bullets)
- Risk Register (table: Severity / Area / Finding / Evidence / Fix / Validate)
- Top 5 Fixes (ranked)
- Next 7 Days Plan (checklist)
- Appendix: commands run + assumptions + files inspected
Severity:
- Critical: public data exposure, auth bypass, prod outage risk
- High: privilege escalation, systemic RLS weakness, large cost risk
- Medium: best-practice gaps, moderate perf risks
- Low: hygiene, minor optimizations
Source: pilotwaffle/torq-console — distributed by TomeVault.
1---2name: supabase-expert-review3description: Expert Supabase audit and production-readiness reviewer. Covers RLS policies, auth configuration, storage buckets, schema/migrations, edge functions, performance, and environment setup. Uses safe-by-default CLI helpers (anon/user context unless explicitly admin). Produces an actionable risk register and prioritized fixes. Use when this capability is needed.4---56# Supabase Expert Review (Claude Code Skill)78## Mission9Act as a senior Supabase architect + security reviewer. Produce an evidence-based review of the repo and (optionally) the linked Supabase project.1011## Non-negotiable Guardrails (Security)12131) **Default to RLS-respecting context**14 - Use ANON key + optional user access token for "real" permission checks.15 - Treat SERVICE ROLE as **admin bypass** and use it only when explicitly requested.16172) **RLS truth rule**18 - RLS enforcement is determined by the `Authorization: Bearer ...` header, not the `apikey` header.19 - If a service_role key is used as Bearer, RLS is bypassed. (So never use it silently.)20213) **No destructive changes**22 - Do not run actions that mutate prod (apply migrations, drop objects, deploy functions) unless the user explicitly asks.23 - If asked, provide: plan -> diff/SQL -> validation steps.2425## Inputs / Environment Variables2627Required:28- `SUPABASE_URL` (e.g., https://xyzcompany.supabase.co)2930Preferred (safe-by-default):31- `SUPABASE_ANON_KEY`3233Optional:34- `SUPABASE_ACCESS_TOKEN` (user JWT for user-context checks)3536Admin-only (explicit opt-in):37- `SUPABASE_SERVICE_ROLE_KEY`3839## How to Run40- `/supabase-review` runs the full audit workflow.41- `/supabase-rls-audit` focuses on RLS policies only (Section B).42- `/supabase-schema-audit` focuses on schema and migrations (Section D).43- `/supabase-perf-audit` focuses on performance and cost (Section E).44- If the helper scripts are present, use them for API calls.45- Also inspect local repo artifacts: migrations, SQL, config, client init, edge functions, CI/CD.4647---4849# Audit Workflow (Required)5051## A) Inventory (Baseline)52531. Identify app(s): web/mobile/server/functions/edge542. Identify Supabase features in use:55 - Auth, PostgREST, Realtime, Storage, Edge Functions, Extensions563. Identify environments (dev/stage/prod) and config separation574. Note where secrets/keys are stored and injected (dotenv/CI)5859Deliverable: short inventory summary + "what I can verify vs assumptions".6061## B) RLS & Data Exposure (Highest Priority)62631. Find all tables in migrations and check:64 - Is RLS enabled on sensitive tables?65 - Are there permissive policies (e.g., public read/write)?66 - Are policies aligned with query patterns?672. Validate "real access" using anon context:68 - Attempt minimal reads/writes using anon key (should be denied where appropriate)693. Identify common foot-guns:70 - service role used client-side71 - broad policies without ownership checks72 - missing indexes on columns referenced in RLS predicates7374Deliverable: policy-by-policy findings + severity + fixes.7576## C) Auth & Identity7778- Provider setup risks, email confirmation, MFA readiness79- Session/refresh handling (client)80- Admin operations safety (service role usage boundaries)81- User data modeling and PII considerations82- Recommended patterns for least privilege8384## D) Schema & Migrations Health8586- Migration drift risk, baseline migration quality87- Forbidden patterns: SECURITY DEFINER without strict review, unsafe grants88- Views and permissions posture (note: view security settings should be reviewed manually)89- Extension usage and role grants9091## E) Performance & Cost9293- RLS performance pitfalls: ensure indexes on columns used in RLS filters (e.g., user_id)94- Query patterns: pagination, unbounded selects, hot tables, missing indexes95- Realtime: channel filters and potential data leakage96- Storage egress and transform/caching notes97- Connection pooling configuration (PgBouncer / Supavisor)9899## F) Edge Functions / Server Code (if present)100101- Secret handling (no secrets in repo)102- Auth checks (JWT verification)103- Rate limiting and abuse controls104- Least-privilege service role usage (only in trusted backend)105106---107108# Output Format (Mandatory)1091101) **Executive Summary** (5-10 bullets)1112) **Risk Register** (table: Severity / Area / Finding / Evidence / Fix / Validate)1123) **Top 5 Fixes** (ranked)1134) **Next 7 Days Plan** (checklist)1145) **Appendix**: commands run + assumptions + files inspected115116Severity:117- Critical: public data exposure, auth bypass, prod outage risk118- High: privilege escalation, systemic RLS weakness, large cost risk119- Medium: best-practice gaps, moderate perf risks120- Low: hygiene, minor optimizations121122---123> Source: [pilotwaffle/torq-console](https://github.com/pilotwaffle/torq-console) — distributed by [TomeVault](https://tomevault.io).124<!-- tomevault:4.0:skill_md:2026-06-13 -->