← ClaudeAtlas

auth-integrationlisted

Use when implementing authentication - login/signup forms, session management, protected routes, or role-based access control. NOT when non-auth UI, plain data fetching, or unrelated backend logic. Triggers: "login page", "signup form", "auth setup", "protected route", "role-based access", "Better Auth", "NextAuth".
aiskillstore/marketplace · ★ 329 · API & Backend · score 79
Install: claude install-skill aiskillstore/marketplace
# Better Auth Integration Skill ## Overview Expert guidance for authentication implementation using Better Auth/NextAuth v5, including login/signup forms, session management with Zustand, protected routes via middleware, and role-based access control for ERP systems. ## When This Skill Applies This skill triggers when users request: - **Auth Setup**: "Setup Better Auth", "Configure authentication", "Auth providers" - **Auth Forms**: "Login page", "Signup form", "Forgot password", "Email verification" - **Session Management**: "Auth store", "Session handling", "Zustand auth" - **Protected Routes**: "Protected dashboard", "Auth middleware", "Route guards" - **Role-Based Access**: "Role guard", "Permission check", "Admin only", "Teacher access" ## Core Rules ### 1. Provider Setup ```typescript // app/auth/[...auth]/route.ts import { auth } from '@/lib/auth'; import { toNextJsHandler } from 'better-auth/next-js'; export const { GET, POST } = toNextJsHandler(auth); // lib/auth.ts import { betterAuth } from 'better-auth'; import { prismaAdapter } from 'better-auth/adapters/prisma'; export const auth = betterAuth({ database: prismaAdapter(prisma), emailAndPassword: { enabled: true, requireEmailVerification: true, }, socialProviders: { google: { clientId: process.env.GOOGLE_CLIENT_ID!, clientSecret: process.env.GOOGLE_CLIENT_SECRET!, }, }, session: { expiresIn: 60 * 60 * 24 * 7, // 7 days updateAge: 60 * 60 * 24, // 24 hours