Auth Patterns
Reference guide for authentication in Next.js covering NextAuth.js (Auth.js) setup, middleware-based route protection, and session handling.
- CCM score
- 55 of 100
- skills.sh installs
- 184
- GitHub stars
- 3.8K
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers NextAuth.js v5 setup, session access in server and client components, middleware route protection, and role-based access control
- Includes code for GitHub and credentials providers, a
SessionProviderwrapper, and JWT verification withjosein middleware - Compares JWT and database session strategies and lists five auth libraries: NextAuth.js, Clerk, Lucia, Supabase Auth, and custom JWT
- Designed for Next.js developers implementing login flows, protected routes, or authorization in App Router applications
Install
$ npx -y skills add davepoon/buildwithclaude --skill auth-patterns -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Authentication Patterns in Next.js
Overview
Next.js supports multiple authentication strategies. This skill covers common patterns including NextAuth.js (Auth.js), middleware-based protection, and session management.
Authentication Libraries
| Library | Best For |
|---|---|
| NextAuth.js (Auth.js) | Full-featured auth with providers |
| Clerk | Managed auth service |
| Lucia | Lightweight, flexible auth |
| Supabase Auth | Supabase ecosystem |
| Custom JWT | Full control |
NextAuth.js v5 Setup
Installation
npm install next-auth@beta
Configuration
// auth.ts
import NextAuth from 'next-auth'
import GitHub from 'next-auth/providers/github'
import Credentials from 'next-auth/providers/credentials'
Details
- Repository
- github.com/davepoon/buildwithclaude
- Categories
- Backend & APIs, Frontend & UI Code
- First seen
- Jun 3, 2026
Questions
What does the auth-patterns skill help with in Next.js?
The auth-patterns skill guides you through authentication and authorization in Next.js apps. It covers NextAuth.js (Auth.js) setup, middleware-based route protection, session management, JWT handling, and role-based access control.
How do I install the auth-patterns skill?
Run npx -y skills add davepoon/buildwithclaude --skill auth-patterns -y in your project. Once installed, the agent can walk you through setting up login flows and protected routes in your Next.js application.
Which libraries does the auth-patterns skill cover?
The skill lists NextAuth.js (Auth.js) for full-featured auth with providers, Clerk for a managed service, Lucia for lightweight flexible auth, Supabase Auth, and custom JWT for full control. It then shows NextAuth.js v5 setup in detail.
What does auth-patterns sit alongside in the Backend and APIs category?
auth-patterns is listed in the Backend and APIs category on Claude Marketplaces. It focuses specifically on authentication and authorization patterns for Next.js applications.
More from davepoon/buildwithclaude
All 2Similar to Auth Patterns
More Backend & APIsnextauth-authenticationmindrally/skills1.2K installsSetup guide for NextAuth.js v5 in Next.js covering providers, JWT and database sessions, and route protection.
nextjs-authenticationgiuseppe-trisciuoglio/developer-kit4.1K installsComplete Auth.js 5 setup for Next.js App Router, covering OAuth, route protection, and role-based access.
nextjs-supabase-authdavila7/claude-code-templates411 installsExpert guidance for Supabase Auth in Next.js App Router, covering server, client, and middleware sessions.
clerk-authenticationmindrally/skills729 installsGuidance for Clerk authentication in Next.js covering middleware, hooks, server actions, and route protection.
auth-implementation-patternswshobson/agents21.7K installsCatalog-style summary of authentication and authorization patterns covering JWT, OAuth2, sessions, and RBAC.
nuxt-better-authonmax/nuxt-skills2.2K installsAuthentication guide for Nuxt apps using the Better Auth module, with a reference file for each task.