Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies, getSession, getUser, getClaims, RLS); Supabase CLI or MCP server; schema changes, migrations, security audits, Postgres extensions (pg_graphql, pg_cron, pg_vector).
.claude/skills/asymmetric-al-supabase/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 112% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 1% | 0% |
| case-08 | ✗→✓ | ▲ Improved | 114% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 87% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 118% | 0% |
These repo-owned sections are intentionally kept on top of the vendored Supabase skill. If upstream refreshes replace this file, reconcile this overlay before running bun run skills:sync.
docs/ai/rules/backend.md; also read supabase/AGENTS.md for migrations, seed, or demo RLS posture.docs/ai/skills/nextjs-supabase-auth/SKILL.md.docs/ai/skills/supabase-postgres-best-practices/SKILL.md.1. Supabase changes frequently — verify against changelog and current docs before implementing. Do not rely on training data for Supabase features. Function signatures, config.toml settings, and API conventions change between versions.
First, fetch https://supabase.com/changelog.md (a lightweight summary index, not a heavy pull), scan for breaking-change tags relevant to your task, and follow the linked page for any that apply. Then look up the relevant topic using the documentation access methods below.
2. Verify your work. After implementing any fix, run a test query to confirm the change works. A fix without verification is incomplete.
3. Recover from errors, don't loop. If an approach fails after 2-3 attempts, stop and reconsider. Try a different method, check documentation, inspect the error more carefully, and review relevant logs when available. Supabase issues are not always solved by retrying the same command, and the answer is not always in the logs, but logs are often worth checking before proceeding.
4. Exposing tables to the Data API. Depending on the user's Data API settings, newly created tables may not be automatically exposed via the Data API. If so, anon and authenticated roles need explicit access grants.
This is separate from RLS, which controls which rows are visible once a table is accessible, not whether the table is accessible at all. When a user reports a SQL-created table is unexpectedly inaccessible, check Data API settings and role grants. When granting public (anon/authenticated) access, always enable RLS too.
5. RLS in exposed schemas. Enable RLS on every table in any exposed schema, especially public. This is critical in Supabase because tables in exposed schemas can be reachable through the Data API. For private schemas, prefer RLS as defense in depth. After enabling RLS, create policies that match the actual access model rather than defaulting every table to the same auth.uid() pattern.
6. Security checklist. When working on any Supabase task that touches auth, RLS, views, storage, or user data, run through this checklist. These are Supabase-specific security traps that silently create vulnerabilities:
user_metadata claims in JWT-based authorization decisions. In Supabase, raw_user_meta_data is user-editable and can appear in auth.jwt(), so it is unsafe for RLS policies or any other authorization logic. Store authorization data in raw_app_meta_data / app_metadata instead.session_id against auth.sessions on sensitive operations.app_metadata or auth.jwt() for authorization, remember JWT claims are not always fresh until the user's token is refreshed.service_role or secret key in public clients. Prefer publishable keys for frontend code. Legacy anon keys are only for compatibility. In Next.js, any NEXT_PUBLIC_ env var is sent to the browser.CREATE VIEW ... WITH (security_invoker = true). In older versions of Postgres, protect your views by revoking access from the anon and authenticated roles, or by putting them in an unexposed schema.auth.role() is deprecated — use the TO clause instead. Supabase has deprecated auth.role() in favour of specifying the target role directly on the policy with TO authenticated or TO anon. Beyond deprecation, auth.role() = 'authenticated' breaks silently when anonymous sign-ins are enabled because anonymous users carry the authenticated Postgres role.TO authenticated alone is authentication without authorization. Combine it with an ownership predicate in USING, such as (select auth.uid()) = user_id.USING and WITH CHECK. Without WITH CHECK, a user can reassign a row's ownership column.SECURITY DEFINER functions bypass RLS. Do not add SECURITY DEFINER to resolve permission errors; it silently removes access control without fixing the underlying cause. Prefer SECURITY INVOKER.SECURITY DEFINER functions in public are callable by all roles. When SECURITY DEFINER is genuinely needed, keep it in a non-exposed schema, include an auth.uid() check in the function body, and run advisors after making changes.For any security concern not covered above, fetch the Supabase product security index: https://supabase.com/docs/guides/security/product-security.md
Always discover commands via --help — never guess. The CLI structure changes between versions.
bashsupabase --help # All top-level commands supabase <group> --help # Subcommands (e.g., supabase db --help) supabase <group> <command> --help # Flags for a specific command
Supabase CLI Known gotchas:
supabase db query requires CLI v2.79.0+ → use MCP execute_sql or psql as fallbacksupabase db advisors requires CLI v2.81.3+ → use MCP get_advisors as fallbacksupabase migration new <name> first. Never invent a migration filename or rely on memory for the expected format.Version check and upgrade: Run supabase --version to check. For CLI changelogs and version-specific features, consult the CLI documentation or GitHub releases.
For setup instructions, server URL, and configuration, see the MCP setup guide.
Troubleshooting connection issues — follow these steps in order:
curl -so /dev/null -w "%{http_code}" https://mcp.supabase.com/mcp A 401 is expected (no token) and means the server is up. Timeout or "connection refused" means it may be down.
.mcp.json configuration:Verify the project root has a valid .mcp.json with the correct server URL. If missing, create one pointing to https://mcp.supabase.com/mcp.
If the server is reachable and .mcp.json is correct but tools aren't visible, the user needs to authenticate. The Supabase MCP server uses OAuth 2.1 — tell the user to trigger the auth flow in their agent, complete it in the browser, and reload the session.
Before implementing any Supabase feature, find the relevant documentation. Use these methods in priority order:
search_docs tool (preferred — returns relevant snippets directly).md to the URL path.To make schema changes, use execute_sql (MCP) or supabase db query (CLI). These run SQL directly on the database without creating migration history entries, so you can iterate freely and generate a clean migration when ready.
Do NOT use apply_migration to change a local database schema — it writes a migration history entry on every call, which means you can't iterate, and supabase db diff / supabase db pull will produce empty or conflicting diffs. If you use it, you'll be stuck with whatever SQL you passed on the first try.
When ready to commit your changes to a migration file:
supabase db advisors (CLI v2.81.3+) or MCP get_advisors. Fix any issues.supabase db pull <descriptive-name> --local --yessupabase migration list --localMUST read when the user reports that this skill gave incorrect guidance or is missing information.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 18,773 | 16,538 | -12% | 1 | 1 | 0% | 3,906 | 4,932 | +26% | 0 | 0 | — |
case-02 | fail→pass | 11,636 | 9,658 | -17% | 1 | 1 | 0% | 2,023 | 4,297 | +112% | 0 | 0 | — |
case-03 | pass→pass | 14,884 | 13,223 | -11% | 1 | 1 | 0% | 2,972 | 5,182 | +74% | 0 | 0 | — |
case-04 | pass→pass | 17,642 | 18,757 | +6% | 1 | 1 | 0% | 3,183 | 6,040 | +90% | 0 | 0 | — |
case-05 | pass→pass | 12,770 | 11,194 | -12% | 1 | 1 | 0% | 2,433 | 4,028 | +66% | 0 | 0 | — |
case-06 | fail→pass | 18,999 | 5,447 | -71% | 1 | 1 | 0% | 3,373 | 3,418 | +1% | 0 | 0 | — |
case-07 | pass→pass | 7,579 | 6,085 | -20% | 1 | 1 | 0% | 1,390 | 3,620 | +160% | 0 | 0 | — |
case-08 | fail→pass | 10,162 | 6,642 | -35% | 1 | 1 | 0% | 1,701 | 3,638 | +114% | 0 | 0 | — |
case-09 | pass→pass | 11,568 | 5,527 | -52% | 1 | 1 | 0% | 2,113 | 3,504 | +66% | 0 | 0 | — |
case-10 | fail→pass | 11,934 | 7,612 | -36% | 1 | 1 | 0% | 2,055 | 3,850 | +87% | 0 | 0 | — |
case-11 | fail→fail | 16,975 | 15,487 | -9% | 1 | 1 | 0% | 2,839 | 5,156 | +82% | 0 | 0 | — |
case-12 | fail→pass | 6,737 | 2,749 | -59% | 1 | 1 | 0% | 1,316 | 2,874 | +118% | 0 | 0 | — |
case-13 | pass→pass | 9,748 | 3,391 | -65% | 1 | 1 | 0% | 1,778 | 2,839 | +60% | 0 | 0 | — |
case-14 | fail→pass | 11,919 | 4,742 | -60% | 1 | 1 | 0% | 1,871 | 3,265 | +75% | 0 | 0 | — |
case-15 | pass→pass | 12,599 | 8,154 | -35% | 1 | 1 | 0% | 2,041 | 3,914 | +92% | 0 | 0 | — |
case-16 | fail→pass | 13,223 | 1,799 | -86% | 1 | 1 | 0% | 2,153 | 2,721 | +26% | 0 | 0 | — |
case-17 | pass→pass | 11,037 | 7,405 | -33% | 1 | 1 | 0% | 1,691 | 3,597 | +113% | 0 | 0 | — |
case-18 | pass→pass | 12,106 | 8,407 | -31% | 1 | 1 | 0% | 1,947 | 3,873 | +99% | 0 | 0 | — |
case-19 | pass→pass | 8,567 | 7,604 | -11% | 1 | 1 | 0% | 1,498 | 3,870 | +158% | 0 | 0 | — |
case-20 | pass→pass | 7,741 | 2,796 | -64% | 1 | 1 | 0% | 1,247 | 2,943 | +136% | 0 | 0 | — |
case-21 | pass→pass | 10,268 | 1,791 | -83% | 1 | 1 | 0% | 1,444 | 2,715 | +88% | 0 | 0 | — |
case-22 | fail→pass | 9,712 | 1,846 | -81% | 1 | 1 | 0% | 1,495 | 2,735 | +83% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +36 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.