Agent skill · software engineering · aiskillstore

nextjs-supabase-auth

Expert integration of Supabase Auth with Next.js App Router

Why this skill is useful

Provides specific integration patterns and middleware for Next.js and Supabase Auth that the AI wouldn't reliably generate on its own.

What it needs

Requires @supabase/ssr installed locally. Requires supabase account access. About 4k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.

What this skill does

Next.js + Supabase Auth Expert integration of Supabase Auth with Next.js App Router Capabilities nextjs-auth supabase-auth-nextjs auth-middleware auth-callback Prerequisites Required skills: nextjs-app-router, supabase-backend Patterns Supabase Client Setup Create properly configured Supabase clients for different contexts When to use: Setting up auth in a Next.js project // lib/supabase/client.ts (Browser client) 'use client' import { createBrowserClient } from '@supabase/ssr' export function createClient() { return createBrowserClient( process.env.NEXTPUBLICSUPABASEURL!, process.env.NEXTPUBLICSUPABASEANONKEY! ) } // lib/supabase/server.ts (Server client) import { createServerClient } from '@supabase/ssr' import { cookies } from 'next/headers' export async function createClient() { const cookieStore = await cookies() return createServerClient( process.env.NEXTPUBLICSUPABASEURL!, process.env.NEXTPUBLICSUPABASEANONKEY!, { cookies: { getAll() { return cookieStore.getAll() }, setAll(cookiesToSet) { cookiesToSet.forEach(({ name, value, options }) => { cookieStore.set(name, value, options) }) }, }, } ) } Auth Middleware Protect routes and refresh sessions in middleware When to use: You need route protection or session refresh // middleware.ts import { createServerClient } from '@supabase/ssr' import { NextResponse, type NextRequest } from 'next/server' export async function middleware(request: NextRequest) { let response = NextResponse.next({ request }) const supabase = createServerClient( process.env.NEXTPUBLICSUPABASEURL!, process.env.NEXTPUBLICSUPABASEANONKEY!, { cookies: { getAll() { return request.cookies.getAll() }, setAll(cookiesToSet) { cookiesToSet.forEach(({ name, value, options }) => { response.cookies.set(name, value, options) }) }, }, } ) // Refresh session if expired const { data: { user } } = await supabase.auth.getUser() // Protect dashboard routes if (request.nextUrl.pathname.startsWith('/dashboard') && !user) { return NextResponse.redirect(new URL('/log …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills aiskillstore/nextjs-supabase-auth

View the source on GitHub

Browse the @skills marketplace