auth-handler

auth-handler is a skill for Claude Code from Indie-Kit/nextjs-saas-starter. It costs 28 tokens per session (312 once invoked), scanned A, original, MIT.

A guide for adding Better Auth login and user-session handling to an application, including protecting API routes and reading user data.

In plain words
What is it for?
Use it for sign-up and login flows, protecting API endpoints, checking sessions, and fetching current user information.
Why use it?
It helps prevent unprotected server routes and keeps client-side and server-side authentication checks consistent.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

Good fit Use it for sign-up and login flows, protecting API endpoints, checking sessions, and fetching current user information.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/indie-kit/nextjs-saas-starter/auth-handler
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Indie-Kit/nextjs-saas-starter --skill auth-handler
Clone the repo
git clone --depth 1 https://github.com/Indie-Kit/nextjs-saas-starter

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for auth-handler

README.md
[![agentmods](https://agentmods.dev/badge/skills/indie-kit/nextjs-saas-starter/auth-handler/github.svg)](https://agentmods.dev/skills/indie-kit/nextjs-saas-starter/auth-handler)
Your own site
<a href="https://agentmods.dev/skills/indie-kit/nextjs-saas-starter/auth-handler"><img src="https://agentmods.dev/badge/skills/indie-kit/nextjs-saas-starter/auth-handler/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for auth-handler

Your own site · 80×15
<a href="https://agentmods.dev/skills/indie-kit/nextjs-saas-starter/auth-handler"><img src="https://agentmods.dev/badge/skills/indie-kit/nextjs-saas-starter/auth-handler.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 28 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 312 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00028 $0.00312
Opus 5.5 $0.00011 $0.00125
Sonnet 5.5 $0.00006 $0.00062
Haiku 4.5 $0.00003 $0.00031

Measured 1mo ago against content hash 21a965cecd1e, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

auth-handler scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/auth-handler/SKILL.md · 38 lines

What it actually says

Auth Handler

Instructions

1. API Route Protection

  • User Routes: Use withAuthRequired.
    import { withAuthRequired } from "@/lib/auth/withAuthRequired";
    
    export const GET = withAuthRequired(async (req, { session, user, getDbUser }) => {
       // getDbUser() is available to fetch fresh user data from DB if needed
       const dbUser = await getDbUser();
    });
    
  • Defense in Depth: Do NOT rely solely on middleware. Always implement individual route protection using withAuthRequired.

2. Frontend Data Access

  • Client-Side: Use useSession from src/lib/auth-client.ts.
    import { useSession } from "@/lib/auth-client";
    const { data: session } = useSession();
    
  • Do NOT use NextAuth imports. Use @/lib/auth-client.

3. Server-Side Data Access

  • Check Auth: Import auth from @/lib/auth.
  • Get Context: Use auth.api.getSession({ headers: await headers() }).

Reference

For architecture details, see reference.md.

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 38 lines · 28 tokens per session scan A 21a965cecd1e

Subscribe to this mod's changes

auth-handler is a skill published in the GitHub repository Indie-Kit/nextjs-saas-starter (28 stars, last pushed 20d ago), licensed MIT. It adds 28 tokens to every session and 312 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

use-miller

Build, configure, provision, diagnose, verify, deploy, or extend an application created from the Miller starter. Use for projects containing miller.config.json, especially when creating an app, setting up production, configuring self-hosted Better Auth or Stripe, integrating either Next.js or an independent browser…

darraghoriordan/use-miller · 93 tokens

add-integration-api

Step-by-step recipe for adding a new integration API resource to SpeedPy: model, serializer, views, scopes, URLs, tests, schema, and optional webhook event. Use when adding a new /api/v1/ endpoint.

speedpy/speedpy · 51 tokens

create-miller

Create a new application from the Miller starter and guide its owner through naming, local setup, provider credentials, verification, and optional production setup. Use when a user asks to start, scaffold, bootstrap, or create a Miller application before a miller.config.json project exists.

darraghoriordan/use-miller · 58 tokens

supastarter-nextjs-skill

Guides development with supastarter for Next.js only (not Vue/Nuxt): tech stack, setup, configuration, database (Prisma), API (Hono/oRPC), auth (Better Auth), organizations, payments (Stripe), AI, customization, storage, mailing, i18n, SEO, deployment, background tasks, analytics, monitoring, E2E. Use when building or…

OscarDRT/supastarter-nextjs-skill · 124 tokens

typescript-pro

Implements advanced TypeScript type systems, creates custom type guards, utility types, and branded types, and configures tRPC for end-to-end type safety. Use when building TypeScript applications requiring advanced generics, conditional or mapped types, discriminated unions, monorepo setup, or full-stack type safety…

12-Studio/Tackl · 69 tokens

mem0-oss-to-platform

Plan, then execute, a migration of a project from the mem0 open-source / self-hosted SDK (local Memory class) to the mem0 Platform / hosted SDK (MemoryClient). TRIGGER when: the developer wants to move, switch, or migrate mem0 off OSS/self-hosted to the hosted API, e.g. "migrate my mem0 setup to the platform", "switch…

mem0ai/mem0 · 217 tokens