Better Auth Patterns

Better Auth Patterns is a skill for Claude Code from smicolon/ai-kit. It costs 34 tokens per session (2,935 once invoked), scanned A, original, MIT.

A set of Better Auth patterns for adding authentication to React applications, including providers, forms, and sessions.

In plain words
What is it for?
Use it when setting up sign-in, configuring authentication providers, building auth forms, or managing logged-in user sessions.
Why use it?
It helps keep common authentication work consistent and reduces the need to decide how each part should be implemented.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the better-auth plugin — 3 skills shipped together

Good fit Use it when setting up sign-in, configuring authentication providers, building auth forms, or managing logged-in user sessions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/smicolon/ai-kit/better-auth-patterns
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 smicolon/ai-kit --skill better-auth-patterns
Clone the repo
git clone --depth 1 https://github.com/smicolon/ai-kit

Made for: Claude Code.

Or install better-auth, the plugin that ships this one along with the rest of its 3 skills.

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 Better Auth Patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/smicolon/ai-kit/better-auth-patterns/github.svg)](https://agentmods.dev/skills/smicolon/ai-kit/better-auth-patterns)
Your own site
<a href="https://agentmods.dev/skills/smicolon/ai-kit/better-auth-patterns"><img src="https://agentmods.dev/badge/skills/smicolon/ai-kit/better-auth-patterns/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 Better Auth Patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/smicolon/ai-kit/better-auth-patterns"><img src="https://agentmods.dev/badge/skills/smicolon/ai-kit/better-auth-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,935 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00034 $0.02935
Opus 5.5 $0.00014 $0.01174
Sonnet 5.5 $0.00007 $0.00587
Haiku 4.5 $0.00003 $0.00294

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

Security

Grade A, and why

Better Auth Patterns scanned grade A with 1 finding 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 3mo 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

return fetch(url, {
packs/better-auth/skills/better-auth-patterns/SKILL.md · 526 lines

How it starts

The opening of the file, as written. The whole thing — 526 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Better Auth Patterns

This skill enforces Better Auth best practices for authentication in React applications.

Server Configuration

Basic Setup

// lib/auth.ts
import { betterAuth } from 'better-auth'
import { prismaAdapter } from 'better-auth/adapters/prisma'
import { prisma } from './prisma'

export const auth = betterAuth({
  database: prismaAdapter(prisma, {
    provider: 'postgresql',
  }),

  emailAndPassword: {
    enabled: true,
    requireEmailVerification: true,
  },

  session: {
    expiresIn: 60 * 60 * 24 * 7, // 7 days
    updateAge: 60 * 60 * 24,     // Extend daily
  },
})

export type Auth = typeof auth

Social Providers

import { betterAuth } from 'better-auth'

export const auth = betterAuth({
  // ... database config

  socialProviders: {
    google: {
      clientId: process.env.GOOGLE_CLIENT_ID!,
      clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
      scopes: ['email', 'profile'],
    },
    github: {
      clientId: process.env.GITHUB_CLIENT_ID!,
      clientSecret: process.env.GITHUB_CLIENT_SECRET!,
      scopes: ['user:email'],
    },
    discord: {
      clientId: process.env.DISCORD_CLIENT_ID!,
      clientSecret: process.env.DISCORD_CLIENT_SECRET!,
    },
  },
})

Two-Factor Authentication

import { twoFactor } from 'better-auth/plugins/two-factor'

export const auth = betterAuth({
  // ... base config

  plugins: [
    twoFactor({
      issuer: 'MyApp',
      totpWindow: 1,
      backupCodes: {
        enabled: true,
        count: 10,
      },
    }),
  ],
})

Passkeys (WebAuthn)

import { passkey } from 'better-auth/plugins/passkey'

export const auth = betterAuth({
  // ... base config

  plugins: [
    passkey({
      rpId: 'myapp.com',
      rpName: 'My App',
      origin: 'https://myapp.com',
      attestation: 'none',
      authenticatorSelection: {
        authenticatorAttachment: 'platform',
        userVerification: 'preferred',
        residentKey: 'preferred',
      },
    }),
  ],
})

Read the full file on GitHub · 526 lines

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. 3mo ago Changed · +70 lines 09dffc36079d
  2. 3mo ago First seen · 456 lines · 34 tokens per session scan A fde91229df4b

Subscribe to this mod's changes

Better Auth Patterns is a skill published in the GitHub repository smicolon/ai-kit (7 stars, last pushed 2mo ago), licensed MIT. It adds 34 tokens to every session and 2,935 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Better Auth Patterns compared with skills from other repositories

Better Auth Patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
Better Auth Patternssmicolon/ai-kitSkill72mo agoMITA34Claude Code
add-dial-toolnanocoai/nanoclawSkill31ktodayMITA118Claude Code
add-telegramnanocoai/nanoclawSkill31ktodayMITA12Claude Code
add-gchatnanocoai/nanoclawSkill31ktodayMITA13Claude Code
add-signalnanocoai/nanoclawSkill31ktodayMITA22Claude Code
add-matrixnanocoai/nanoclawSkill31ktodayMITA19Claude Code
onecli-gatewaynanocoai/nanoclawSkill31ktodayMITA81Claude Code