Skip to content
Back to skills

Auth Handler

ASecurity

Manage authentication, authorization, and user sessions. Use when dealing with login, sign-up, API protection, middleware, or user data fetching.

  • 509 stars
  • 0 votes
  • 2 copies
  • 14 views
  • Added February 7, 2026
developmenttypescriptreactdebuggingapifrontend

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned February 12, 2026

npx -y skills add aiskillstore/marketplace --skill auth-handler --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Auth Handler?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Auth Handler
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aiskillstore-auth-handler/badge)](https://www.skillsdirectory.com/skills/aiskillstore-auth-handler)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: auth-handler
description: Manage authentication, authorization, and user sessions. Use when dealing with login, sign-up, API protection, middleware, or user data fetching.
tools: Read, Write, Edit
model: inherit
---

# Auth Handler

## Instructions

### 1. API Route Protection
- **Standard Routes**: Use `withAuthRequired`.
  ```typescript
  export default withAuthRequired(async (req, { session, getUser }) => { ... })
  ```
- **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](reference.md).

Files in this skill

  • SKILL.md1 KB
  • reference.md786 B
  • skill-report.json8.9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.