Auth handler
全球最大的 Claude Code 技能聚合库 · 收录 3900+ 来自 12+ 来源的技能,提供在线搜索与趋势分析看板 / The world's largest Claude Code skill aggregation hub — 3900+ skills from 12+ sources with online search and trend dashboard
npx -y skills add bg-szy/TOP-SKILLS --skill auth-handlerAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Manage authentication, authorization, and user sessions. Use when dealing with login, sign-up, API protection, middleware, or user data fetching.
SKILL.md
1.0 KB, as published. Nobody here has run it
Auth Handler
Instructions
1. API Route Protection
- Standard Routes: Use
withAuthRequired.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
useSessionfromnext-auth/react.
3. Server-Side Data Access
- Check Auth: Import
authfrom@/auth. - Get Plan: Use
getUserPlan(session.user.id).session.useris minimal.
Reference
For architecture details, key files, and debugging tips, see reference.md.