supabase
Skill3 starsChanged 7 months agoMITView on GitHub
This skill should be used when the user asks to "integrate Supabase", "set up Supabase auth", "write RLS policies", "use Supabase storage", "subscribe to realtime changes", or mentions "supabase", "supabase auth", "RLS", "row level security", "supabase client", "supabase storage", "realtime", "edge function", "supabase migration". Provides Supabase best practices for Next.js applications including auth, database, storage, realtime, and edge functions.
- Reads credentials
- Installs packages
60 other projects use a version of this.
Adopted by
Most recently taken up by
- schornai/schornaitheir own version, first seen Nov 8, 2026
- midudev/bigibai-2025their own version, first seen Nov 1, 2026
- sunavoine-sys/Claude-Skillstheir own version, first seen Nov 1, 2026
- mikilezen/sabatheir own version, first seen Nov 1, 2026
- darknecrocities/SkillBuildertheir own version, first seen Nov 1, 2026
- domhhv/habitracktheir own version, first seen Oct 25, 2026
Used with
Projects with it also use firebase, vercel and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
xfstudioSkillfirebase
Firebase gives you a complete backend in minutes - auth, database, storage, functions, hosting. But the ease of setup hides real complexity. Security rules are your last line of defense, and they're often wrong. Firestore queries are limited, and you learn this after you've designed your data model. This skill covers Firebase Authentication, Firestore, Realtime Database, Cloud Functions, Cloud Storage, and Firebase Hosting. Key insight: Firebase is optimized for read-heavy, denormalized data. I
Also in 5 projects that use this
SentrySkillvercel
Deploy and inspect Vercel apps, assign aliases, delete deployments, investigate logs, and monitor deployment outcomes. Use for Vercel deployment and log requests, not GitHub code changes or other cloud providers.
Also in 4 projects that use this
ffsshhttiikkSkillflutter
Flutter cross-platform framework
Also in 3 projects that use this
VercelSkillreact-native
React Native renderer for json-render that turns JSON specs into native mobile UIs. Use when working with @json-render/react-native, building React Native UIs from JSON, creating mobile component catalogs, or rendering AI-generated specs on mobile.
Also in 3 projects that use this
VercelSkillvercel-optimize
Use for Vercel cost and performance optimization on deployed projects, especially Next.js, SvelteKit, Nuxt, and limited Astro apps. Collect Vercel metrics, usage, project config, and code scan results first; investigate only metric-backed candidates; produce ranked recommendations grounded in verified files and version-aware Vercel/framework docs. Trigger for Vercel bill reduction, slow or expensive routes, caching opportunities, Function Invocations, Build Minutes, Fast Data Transfer, Core Web Vitals, Bot Management, Fluid compute, or cost breakdown requests.
Also in 3 projects that use this
wewpellex21Skillbackend
Servers, routes, APIs, and backend architecture. Activated when Claude creates server-side code, API routes, or Express/Fastify/Next.js API handlers.
Also in 3 projects that use this
- +2 more from vercel-labs
Other versions60 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 60
- openai/plugins★ 7.8ksame name
- supabase/agent-skills★ 2.8ksame name
- FidelusAleksander/ghcertified★ 996same name
- imbhargav5/nextbase-nextjs-supabase-starter★ 827same name
- alinaqi/maggy★ 711same name
- alinaqi/claude-bootstrap★ 708same name
- Heyvhuang/ship-faster★ 337same name
- Mindrally/skills★ 275same name
- magnus919/agent-skills★ 172same name
- midudev/bigibai-2025★ 128same name
50 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- api-designSkill
- auth-patternsSkill
- database-designerSkill
- database-optimizerSkill
- framer-motionSkill
- js-debuggingSkill
- js-testingSkill
- knip-cleanupSkill
- mysql-expertSkill
- nextjs-expertSkill
- nextjs-typescript-engineerSkill
- postgresql-expertSkill
- prisma-ormSkill
- quality-gateSkill
- tailwindSkill
- verificationSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 1 is distinctive, and 5 are very specific to this project.
0
Common
Most of the 58 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 82
Read reference/auth-patterns.md for the full middleware setup, sign-in/sign-up flows, OAuth, and protected route patterns.
- Distinctive: line 86
Always import your generated types for full type safety:
- Very specific: line 118
Read reference/database-patterns.md for RLS policy patterns, migrations, RPC functions, joins, and views.
- Very specific: line 138
Read reference/database-patterns.md for full RLS patterns including multi-tenancy, team-based access, and helper functions.
- Very specific: line 159
Read reference/realtime-storage.md for image transformations, resumable uploads, and storage RLS.
- Very specific: line 177
Read reference/realtime-storage.md for presence, broadcast, and channel cleanup patterns.
“Common” is measured: kept by at least 6 in 10 of the 58 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Supabase Skill
You are a Supabase expert for Next.js applications using the App Router.
Critical Rules
- Always enable RLS on every table — a table without Row Level Security is open to any authenticated user by default
- Use the server-side client for Server Components —
createServerClientfrom@supabase/ssrreads cookies via Next.jscookies(); it never leaks tokens to the browser - Use the browser client for Client Components —
createBrowserClientmanages the session in the browser; it must never be used in Server Components or Route Handlers - Never expose the
service_rolekey on the client — it bypasses RLS entirely; keep it server-only in environment variables prefixedSUPABASE_SERVICE_ROLE_KEY(neverNEXT_PUBLIC_) - Use database migrations for schema changes — never edit schema through the Supabase dashboard in production; use
supabase migration newand commit SQL files to version control - Always use parameterized queries — the Supabase client does this automatically; never interpolate user input into raw SQL strings
- Refresh sessions in middleware — call
supabase.auth.getUser()inmiddleware.tson every request to keep the session cookie fresh
Client Setup
Install the required packages:
npm install @supabase/supabase-js @supabase/ssrServer Component / Route Handler client — reads and writes cookies via Next.js cookies():
// lib/supabase/server.ts
import { createServerClient } from '@supabase/ssr'
import { cookies } from 'next/headers'
import type { Database } from '@/types/supabase'
export async function createClient() {
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) {
try {
cookiesToSet.forEach(({ name, value, options }) =>
cookieStore.set(name, value, options)
)
} catch {} // Safe to ignore in Server Components; middleware handles refresh
},
},
}
)
}Client Component client — manages the session in the browser:
// lib/supabase/client.ts
import { createBrowserClient } from '@supabase/ssr'
import type { Database } from '@/types/supabase'
export function createClient() {
return createBrowserClient<Database>(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
)
}Read reference/auth-patterns.md for the full middleware setup, sign-in/sign-up flows, OAuth, and protected route patterns.
Database
Always import your generated types for full type safety:
import type { Database } from '@/types/supabase'
// Generate: npx supabase gen types typescript --local > types/supabase.tsCommon query patterns:
const supabase = await createClient()
// Select with filter
const { data, error } = await supabase
.from('posts')
.select('id, title, created_at')
.eq('user_id', userId)
.order('created_at', { ascending: false })
// Insert
const { data, error } = await supabase
.from('posts')
.insert({ title, body, user_id: userId })
.select()
.single()
// Upsert
const { error } = await supabase
.from('profiles')
.upsert({ id: userId, display_name: name })Read reference/database-patterns.md for RLS policy patterns, migrations, RPC functions, joins, and views.
RLS Policies — Quick Reference
-- Authenticated users can read all rows
CREATE POLICY "authenticated read" ON posts
FOR SELECT TO authenticated USING (true);
-- Users can only modify their own rows
CREATE POLICY "owner write" ON posts
FOR ALL TO authenticated USING (auth.uid() = user_id)
WITH CHECK (auth.uid() = user_id);
-- Role-based access using JWT claims
CREATE POLICY "admin only" ON admin_logs
FOR SELECT TO authenticated
USING (auth.jwt() ->> 'role' = 'admin');Read reference/database-patterns.md for full RLS patterns including multi-tenancy, team-based access, and helper functions.
Storage
// Upload a file
const { data, error } = await supabase.storage
.from('avatars')
.upload(`${userId}/avatar.png`, file, { upsert: true })
// Get a public URL (public bucket)
const { data: { publicUrl } } = supabase.storage
.from('avatars')
.getPublicUrl(`${userId}/avatar.png`)
// Get a signed URL (private bucket, expires in 60 seconds)
const { data, error } = await supabase.storage
.from('documents')
.createSignedUrl(`${userId}/file.pdf`, 60)Read reference/realtime-storage.md for image transformations, resumable uploads, and storage RLS.
Realtime
'use client'
// Subscribe to table changes
const channel = supabase
.channel('posts-changes')
.on('postgres_changes',
{ event: 'INSERT', schema: 'public', table: 'posts' },
(payload) => setItems(prev => [payload.new as Post, ...prev])
)
.subscribe()
return () => { supabase.removeChannel(channel) }Read reference/realtime-storage.md for presence, broadcast, and channel cleanup patterns.
Anti-Patterns
- Do not disable RLS — even temporarily; attackers do not wait for you to re-enable it
- Do not use
service_roleon the client — it bypasses all security policies; it belongs only in trusted server environments - Do not skip migrations — dashboard edits to schema are not tracked in version control and will diverge between environments
- Do not store auth state in localStorage — the
@supabase/ssrclient handles sessions via HttpOnly cookies; localStorage is not accessible server-side and is vulnerable to XSS - Do not call
getSession()on the server — usegetUser()instead;getSession()does not revalidate the token against the Supabase server - Do not use
createClientfrom@supabase/supabase-jsin Next.js App Router — use@supabase/ssr; the base client does not integrate with Next.js cookie handling
Related
reference/auth-patterns.md— Sign up, sign in, OAuth, magic link, middleware, protected routes, RBACreference/database-patterns.md— Schema design, RLS policies, migrations, RPC functions, joins, viewsreference/realtime-storage.md— Realtime subscriptions, presence, broadcast, storage upload/download, signed URLs- Supabase docs: https://supabase.com/docs
@supabase/ssrdocs: https://supabase.com/docs/guides/auth/server-side/nextjs
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

