Agent skill · software engineering · aiskillstore
auth-handler
Manage authentication, authorization, and user sessions. Use when dealing with login, sign-up, API protection, middleware, or user data fetching.
Why this skill is useful
Provides specific middleware patterns and API protection strategies that the AI wouldn't reliably generate on its own.
What it needs
About 1k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.
What this skill does
Auth Handler Instructions 1. API Route Protection Standard Routes: Use withAuthRequired. Super Admin Routes: Use withSuperAdminAuthRequired. Cron Jobs: Use cronAuthRequired. Defense in Depth: Do NOT rely solely on middleware. Always implement individual route protection. 2. Frontend Data Access Client Components: Use useUser() hook (SWR). Restriction: NEVER use useSession from next-auth/react. 3. Server-Side Data Access Check Auth: Import auth from @/auth. Get Plan: Use getUserPlan(session.user.id). session.user is minimal. Reference For architecture details, key files, and debugging tips, see reference.md.
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aiskillstore/auth-handler