Skip to content

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
View on GitHub

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 SessionProvider wrapper, and JWT verification with jose in 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 -y

Installs 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

LibraryBest For
NextAuth.js (Auth.js)Full-featured auth with providers
ClerkManaged auth service
LuciaLightweight, flexible auth
Supabase AuthSupabase ecosystem
Custom JWTFull 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 2

Similar to Auth Patterns

More Backend & APIs