authentication
SKILL.md
This skill guides implementation of authentication using NextAuth v5, which is pre-configured in the boilerplate.
The user needs to protect routes, verify sessions, implement login/logout, or add role-based access control.
Before You Start
The authentication system is already configured:
- Config file:
src/auth.ts- Contains NextAuth configuration - Prisma adapter: User, Account, Session models in schema
- Credentials provider: Username/password authentication ready
CRITICAL: Always check session before sensitive operations. Never trust client-side auth state for security decisions.
Server-Side Authentication
Use auth() from @/auth for all server-side auth checks: