Claude Marketplaces
SkillsMCP serversMarketplacesDigestTools
Submit

This week in Claude

Every Monday: Claude Code, Agent SDK, MCP, and the Anthropic platform moves worth your time.

Skills by category
Frontend DevelopmentBackend & APIsTesting & QASecurityDevOps & CI/CDGit & Pull RequestsDocumentationCode Review & QualityAI & Agent BuildingSkill Development
MCP servers by category
Sales & MarketingWeb & Browser AutomationDatabasesAI & LLM ToolsCloud & InfrastructureCommunication & MessagingDeveloper ToolsDesign & CreativeDocuments & KnowledgeSearch & Web Crawling
Marketplaces by category
AI Agents & OrchestrationLLM IntegrationDevelopment ToolsFrontend & UIBackend & APIsDatabasesTesting & Code QualityDevOps & CloudSecurity & ComplianceGit & Version Control
Claude Marketplaces

An independent directory of skills, plugins and MCP servers for Claude Code. Not affiliated with Anthropic.

Browse

  • Skills
  • MCP servers
  • Marketplaces
  • Weekly digest
  • Skill index
  • MCP index
  • Marketplace index

Site

  • About
  • Tools
  • Submit
  • Feedback
  • Privacy
  • llms.txt
  • Plugins reference

Maker

  • Snug
  • Agent Caffeine
  • knobs
  • Wax
  • Vectoys
  • mertduzgun.com
Crafted at
Skills/Frontend Development
sickn33 avatar

Nextjs Supabase Auth

sickn33/antigravity-awesome-skills

The nextjs-supabase-auth skill provides expert-level integration patterns for implementing Supabase authentication in Next.js applications using the App Router, including client and server Supabase client setup, route protection middleware, and OAuth callback handling. It solves the problem of securely managing user authentication and session refresh across server and client contexts in modern Next.js projects. This skill is for developers building authenticated Next.js applications who need proven patterns for Supabase Auth integration.

installs
5.8K
GitHub stars
43.1K
last updated
Jul 14, 2026
View on GitHubSave

Install

$ npx -y skills add sickn33/antigravity-awesome-skills --skill nextjs-supabase-auth --agent claude-code

Installs into .claude/skills of the current project.

Files

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.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! ) }

// 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.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, { cookies: { getAll() { return cookieStore.getAll() }, setAll(cookiesToSet) { // This helper is for a Route Handler/Server Action with writable cookies. // In a Server Component use the official read-only client pattern and // refresh sessions in middleware/proxy; do not attempt cookie writes here. 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.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, { cookies: { getAll() { return request.cookies.getAll() }, setAll(cookiesToSet) { cookiesToSet.forEach(({ name, value }) => request.cookies.set(name, value)) response = NextResponse.next({ request }) 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('/login', request.url)) }

return response }

export const config = { matcher: ['/((?!_next/static|_next/image|favicon.ico).*)'], }

Auth Callback Route

Handle OAuth callback and exchange code for session

When to use: Using OAuth providers (Google, GitHub, etc.)

// app/auth/callback/route.ts import { createClient } from '@/lib/supabase/server' import { NextResponse } from 'next/server'

export async function GET(request: Request) { const { searchParams, origin } = new URL(request.url) const code = searchParams.get('code') const candidate = searchParams.get('next') ?? '/' const next = candidate.startsWith('/') && !candidate.startsWith('//') && !candidate.includes('\') ? candidate : '/'

if (code) { const supabase = await createClient() const { error } = await supabase.auth.exchangeCodeForSession(code) if (!error) { return NextResponse.redirect(new URL(next, process.env.APP_ORIGIN!)) // validated trusted deployment origin } }

return NextResponse.redirect(${origin}/auth/error) }

Server Action Auth

Handle auth operations in Server Actions

When to use: Login, logout, or signup from Server Components

// app/actions/auth.ts 'use server' import { createClient } from '@/lib/supabase/server' import { redirect } from 'next/navigation' import { revalidatePath } from 'next/cache'

export async function signIn(formData: FormData) { const supabase = await createClient() const { error } = await supabase.auth.signInWithPassword({ email: formData.get('email') as string, password: formData.get('password') as string, })

if (error) { return { error: error.message } }

revalidatePath('/', 'layout') redirect('/dashboard') }

export async function signOut() { const supabase = await createClient() await supabase.auth.signOut() revalidatePath('/', 'layout') redirect('/') }

Get User in Server Component

Access the authenticated user in Server Components

When to use: Rendering user-specific content server-side

// app/dashboard/page.tsx import { createClient } from '@/lib/supabase/server' import { redirect } from 'next/navigation'

export default async function DashboardPage() { const supabase = await createClient() const { data: { user } } = await supabase.auth.getUser()

if (!user) { redirect('/login') }

return (

Welcome, {user.email}

) }

Validation Checks

Using getSession() for Auth Checks

Severity: ERROR

Message: getSession() doesn't verify the JWT. Use getUser() for secure auth checks.

Fix action: Replace getSession() with getUser() for security-critical checks

OAuth Without Callback Route

Severity: ERROR

Message: Using OAuth but missing callback route at app/auth/callback/route.ts

Fix action: Create app/auth/callback/route.ts to handle OAuth redirects

Browser Client in Server Context

Severity: ERROR

Message: Browser client used in server context. Use createServerClient instead.

Fix action: Import and use createServerClient from @supabase/ssr

Protected Routes Without Middleware

Severity: WARNING

Message: No middleware.ts found. Consider adding middleware for route protection.

Fix action: Create middleware.ts to protect routes and refresh sessions

Hardcoded Auth Redirect URL

Severity: WARNING

Message: Hardcoded localhost redirect. Use origin for environment flexibility.

Fix action: Use window.location.origin or process.env.NEXT_PUBLIC_SITE_URL

Auth Call Without Error Handling

Severity: WARNING

Message: Auth operation without error handling. Always check for errors.

Fix action: Destructure { data, error } and handle error case

Auth Action Without Revalidation

Severity: WARNING

Message: Auth action without revalidatePath. Cache may show stale auth state.

Fix action: Add revalidatePath('/', 'layout') after auth operations

Client-Only Route Protection

Severity: WARNING

Message: Client-side route protection shows flash of content. Use middleware.

Fix action: Move protection to middleware.ts for better UX

Collaboration

Delegation Triggers

  • database|rls|queries|tables -> supabase-backend (Auth needs database layer)
  • route|page|component|layout -> nextjs-app-router (Auth needs Next.js patterns)
  • deploy|production|vercel -> vercel-deployment (Auth needs deployment config)
  • ui|form|button|design -> frontend (Auth needs UI components)

Full Auth Stack

Skills: nextjs-supabase-auth, supabase-backend, nextjs-app-router, vercel-deployment

Workflow:

1. Database setup (supabase-backend)
2. Auth implementation (nextjs-supabase-auth)
3. Route protection (nextjs-app-router)
4. Deployment config (vercel-deployment)

Protected SaaS

Skills: nextjs-supabase-auth, stripe-integration, supabase-backend

Workflow:

1. User authentication (nextjs-supabase-auth)
2. Customer sync (stripe-integration)
3. Subscription gating (supabase-backend)

Related Skills

Works well with: nextjs-app-router, supabase-backend

When to Use

  • User mentions or implies: supabase auth next
  • User mentions or implies: authentication next.js
  • User mentions or implies: login supabase
  • User mentions or implies: auth middleware
  • User mentions or implies: protected route
  • User mentions or implies: auth callback
  • User mentions or implies: session management

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

These are separate-file fragments, not a complete auth deployment. Configure and validate the trusted APP_ORIGIN, callback allowlist and exact Next.js/Supabase versions first. Server Components cannot write cookies; use the current official context-specific helper rather than suppressing arbitrary refresh failures. Preserve refreshed cookies on returned redirects. Middleware is not the sole authorization layer: validate sessions/claims and tenant/resource permissions on every server data/action path and enforce RLS. Never expose a service-role key to browsers. See Supabase server-side client guidance.

SKILL.md on GitHub

Sponsors

SnugThe clipboard manager you and your agent can use, safelyAgent CaffeineClose your lid, come back to finished workWaxBlock anything with supervision, without erasing your iPhoneOpen StepsSponsoredFree and open-source skills that make AI coding agents easier to understand, verify, and control.

Details

Repository
github.com/sickn33/antigravity-awesome-skills
Categories
Frontend Development, Backend & APIs, Databases

More from sickn33/antigravity-awesome-skills

All 708
  • Prisma Expert3.8K
  • Playwright Skill3.5K
  • 3d Web Experience3.4K
  • Game Development3.3K
  • Software Architecture3.3K
  • Product Manager Toolkit3.2K
  • Mobile Design3K
  • Telegram Bot Builder3K
  • Ui Ux Pro Max2.8K
  • Bun Development2.5K
  • Web Performance Optimization2.4K
  • I18n Localization2.3K
  • Ui Ux Designer2.3K
  • Nestjs Expert2.2K
  • Powershell Windows2.2K
  • Brainstorming2K
  • Api Documentation Generator1.9K
  • Frontend Design1.9K
  • Senior Architect1.9K
  • Cc Skill Security Review1.8K
  • Senior Fullstack1.8K
  • Agent Memory Systems1.7K
  • Database Design1.7K
  • Scroll Experience1.6K

Recommended

More Frontend Development
1analogjs avatarangular-dianalogjs/angular-skillsImplement dependency injection in Angular v20+ using inject(), injection tokens, and provider configuration. Use for service architecture, providing dependencie5.7Kinstalls
2software-mansion-labs avatarreact-native-best-practicessoftware-mansion-labs/skillsSoftware Mansion's best practices for production React Native and Expo apps on the New Architecture. MUST USE before writing, reviewing, or debugging ANY code i5.7Kinstalls
3samber avatarcopywriting-hookssamber/cc-skillsGenerate opening hooks and post titles for long-form articles in EN or FR — blog posts, Substack/Medium/dev.to, LinkedIn long-form, paid newsletters, opinion es5.5Kinstalls
4julianoczkowski avatarfrontend-designjulianoczkowski/designer-skillsBuild distinctive, production-grade frontend interfaces with high design quality, guided by named aesthetic philosophies. Use when building components, pages, o5.5Kinstalls
5affaan-m avatarfrontend-design-directionaffaan-m/eccSet an ECC-specific frontend design direction for production UI work. Use when building or improving websites, dashboards, applications, components, landing pag5.4Kinstalls
6nexu-io avatarui-ux-pro-maxnexu-io/open-designCatalog-only UI/UX Pro Max entry. The full upstream templates, data, and search workflow are not bundled in OpenDesign.5.4Kinstalls