/dev-backend:supabasefrom dev-backend
This skill should be used when the user is working with Supabase, mentions PostgreSQL with Supabase, Row Level Security (RLS), Supabase Auth, Supabase Storage, supabase CLI, database migrations, RLS policies, auth.users, storage buckets, or any Supabase-related development. Also triggers on keywords: supabase, rls, row level security, supabase auth, supabase storage, storage.objects, service_role, anon key, supabase client, createClient, supabase-js.
Ships in dev-backend. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are a Supabase expert specializing in PostgreSQL, Row Level Security (RLS), Authentication, and Storage. You help developers build secure, performant Supabase applications.
auth.uid() — Never trust user_metadata for authorization; use raw_app_meta_data or auth.uid()supabase CLI for structural changes; keep migrations in version controlsupabase gen types typescriptsupabase/config.toml — if not, suggest supabase initsupabase/migrations/@supabase/supabase-js in package.jsonReference: references/rls-guide.md — load this when working on RLS policies.
Critical rules:
ALTER TABLE tablename ENABLE ROW LEVEL SECURITY;TO clause to specify roles (TO authenticated, TO anon)USING (true) without understanding it allows ALL usersauth.uid() for user ownership checks, NOT user_metadataauth.jwt() -> 'app_metadata' ->> 'role' or raw_app_meta_data for role-based accessCommon RLS patterns to suggest:
-- Owner-only access
CREATE POLICY "Users can access own data"
ON public.profiles
FOR ALL
TO authenticated
USING (auth.uid() = user_id)
WITH CHECK (auth.uid() = user_id);
-- Role-based access
CREATE POLICY "Admins can access all"
ON public.orders
FOR ALL
TO authenticated
USING (auth.jwt() -> 'app_metadata' ->> 'role' = 'admin');
-- Organization-based access
CREATE POLICY "Org members can view"
ON public.projects
FOR SELECT
TO authenticated
USING (
EXISTS (
SELECT 1 FROM public.org_members
WHERE org_members.org_id = projects.org_id
AND org_members.user_id = auth.uid()
)
);
Performance tips for RLS:
EXISTSsecurity definer functions for complex authorization logicEXPLAIN ANALYZE to catch slow policiesReference: references/auth-guide.md — load this when working on auth flows.
Critical rules:
supabase.auth.getUser() (server-side, validates via auth API) not getSession() (reads local JWT without validation) for authorization checksAuth patterns:
raw_app_meta_data@supabase/ssr)Reference: references/storage-guide.md — load this when working on storage.
Critical rules:
storage.objectsallowedMimeTypes and maxFileSize on bucketsowner_id matches auth.uid()Storage RLS patterns:
-- Users can upload to their own folder
CREATE POLICY "User uploads"
ON storage.objects
FOR INSERT
TO authenticated
WITH CHECK (
bucket_id = 'avatars'
AND (storage.foldername(name))[1] = auth.uid()::text
);
-- Users can view their own files
CREATE POLICY "User reads own files"
ON storage.objects
FOR SELECT
TO authenticated
USING (
bucket_id = 'avatars'
AND owner_id = auth.uid()
);
Workflow:
supabase db diff --schema public # Capture schema changes as migration
supabase db push # Deploy migrations to remote
supabase gen types typescript --project-id <ref> > types/supabase.ts
Best practices:
supabase db resetsupabase db lint to check for common issuesCommon pitfalls to watch for:
supabase/functions/<function-name>/index.tssupabase/functions/deno.json (not the legacy import_map.json)Deno.serve() for the entry pointsupabase/functions/_shared/ directoryWhen reviewing a Supabase project, check for:
service_role key in client-side codeUSING (true) policies without intentional public accessauth.uid() used instead of user_metadata in policiesanon key policies are minimal (principle of least privilege)Correct client initialization:
// Client-side (browser) — uses anon key
import { createClient } from '@supabase/supabase-js'
import type { Database } from './types/supabase'
const supabase = createClient<Database>(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
)
// Server-side (API route, edge function) — uses service_role ONLY server-side
const supabaseAdmin = createClient<Database>(
process.env.SUPABASE_URL!,
process.env.SUPABASE_SERVICE_ROLE_KEY! // NEVER expose to client
)
For Next.js with SSR, use @supabase/ssr:
import { createServerClient } from '@supabase/ssr'
import { cookies } from 'next/headers'
export async function createSupabaseServer() {
const cookieStore = await cookies()
return createServerClient<Database>(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
{
cookies: {
getAll() { return cookieStore.getAll() },
setAll(cookiesToSet) {
cookiesToSet.forEach(({ name, value, options }) =>
cookieStore.set(name, value, options))
},
},
}
)
}
This skill provides expertise and best practices. For direct database operations (creating tables, running queries, managing functions), use the Supabase MCP server if available. This skill focuses on:
This skill is provided "as is" without warranty of any kind, express or implied. The guidance, code examples, SQL migrations, and security recommendations are for educational and development purposes only. Always review and test generated code thoroughly before deploying to production. The author(s) accept no responsibility or liability for any damages, data loss, security breaches, or other issues arising from the use of this skill. Use at your own risk.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub carriegale2710/skills-library --plugin dev-backend5 skills in this plugin
/deploy-checklistPre-deployment verification checklist. Use when about to ship a release, deploying a change with database migrations or feature flags, verifying CI status and approvals before going to production, or documenting rollback triggers ahead of time./devopsUse when the user needs to deploy, operate, secure, or scale running infrastructure — cloud architecture (multi-region, VPC, FinOps), CI/CD and deployment strategies, secrets/IAM/supply-chain security, observability and SLO alerting, SRE and incident response, Kubernetes vs ECS and autoscaling, Terraform/Pulumi/CDK, or platform engineering and DORA metrics. Also for generating runbooks, pipeline configs, Terraform modules, or Kubernetes manifests. For choosing the system's architecture or stack before it runs (monolith vs microservices, which database), use software-architect./incident-responseOther plugins' skills for the same job