better-auth-best-practices

better-auth-best-practices is a skill for Claude Code, Codex from sutchan/Agent-Skills-Hub. It costs 61 tokens per session (2,064 once invoked), scanned A, a copy of better-auth-best-practices, MIT.

A guide for configuring Better Auth, a TypeScript authentication library, on the server and client. It covers database adapters, sessions, plugins, environment variables, migrations, and a basic health check.

In plain words
What is it for?
Use it when adding Better Auth to a TypeScript project: install it, configure secrets and URLs, connect a database, create the route handler, run migrations, and verify the auth endpoint.
Why use it?
It gives a defined setup path for sign-in systems using email and password, OAuth, or supported plugins without guessing at configuration details.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when adding Better Auth to a TypeScript project: install it, configure secrets and URLs, connect a database, create the route handler, run migrations, and verify the auth endpoint.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/sutchan/agent-skills-hub/better-auth-best-practices
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 sutchan/Agent-Skills-Hub --skill better-auth-best-practices
Clone the repo
git clone --depth 1 https://github.com/sutchan/Agent-Skills-Hub

Made for: Claude Code, Codex.

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-best-practices

README.md
[![agentmods](https://agentmods.dev/badge/skills/sutchan/agent-skills-hub/better-auth-best-practices/github.svg)](https://agentmods.dev/skills/sutchan/agent-skills-hub/better-auth-best-practices)
Your own site
<a href="https://agentmods.dev/skills/sutchan/agent-skills-hub/better-auth-best-practices"><img src="https://agentmods.dev/badge/skills/sutchan/agent-skills-hub/better-auth-best-practices/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-best-practices

Your own site · 80×15
<a href="https://agentmods.dev/skills/sutchan/agent-skills-hub/better-auth-best-practices"><img src="https://agentmods.dev/badge/skills/sutchan/agent-skills-hub/better-auth-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,064 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 92% copy Near-identical to another mod 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.00061 $0.02064
Opus 5 $0.00030 $0.01032
Sonnet 5 $0.00012 $0.00413
Haiku 4.5 $0.00006 $0.00206

Measured yesterday against content hash a5337f186300, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

better-auth-best-practices 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 yesterday.

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.

Origin

This is a copy

92% identical to better-auth-best-practices — 25 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/better-auth-best-practices/SKILL.md · 193 lines

How it starts

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

Better Auth Integration Guide

Documentation Version

Use documentation that matches the Better Auth version installed in the project. APIs and plugin names can differ across maintained release lines.

  1. Prefer a version explicitly named by the user.
  2. Otherwise, inspect the resolved better-auth version in the lockfile, falling back to the package manifest when no lockfile is available.
  3. When the Better Auth MCP is available, call get_doc with /llms.txt to resolve that package version to a documentation identifier. Pass the identifier to every search_docs call and pass result paths to get_doc unchanged.
  4. Without MCP, start at better-auth.com/llms.txt and follow the matching version index.
  5. Use the latest documentation only when the project version cannot be determined or the user explicitly asks about the latest release or an upgrade.

When planning an upgrade, separate guidance for the currently installed version from guidance for the target version.


Setup Workflow

  1. Install: npm install better-auth
  2. Set env vars: BETTER_AUTH_SECRET and BETTER_AUTH_URL
  3. Create auth.ts with database + config
  4. Create route handler for your framework
  5. Run migrations:
    • Built-in adapter: npx auth@latest migrate
    • Drizzle: npx auth@latest generate --output src/db/auth-schema.ts then npx drizzle-kit push (dev) or npx drizzle-kit generate && npx drizzle-kit migrate (prod)
    • Prisma: npx auth@latest generate --output prisma/schema.prisma then npx prisma migrate dev
  6. Verify: call GET /api/auth/ok — should return { status: "ok" }

Quick Reference

Environment Variables

  • BETTER_AUTH_SECRET - Encryption secret (min 32 chars). Generate: openssl rand -base64 32
  • BETTER_AUTH_URL - Base URL (e.g., https://example.com)

Only define baseURL/secret in config if env vars are NOT set.

File Location

CLI looks for auth.ts in: ./, ./lib, ./utils, or under ./src. Use --config for custom path.

Read the full file on GitHub · 193 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. yesterday Changed · +7 lines · -6 tokens per session a5337f186300
  2. 11d ago First seen · 186 lines · 67 tokens per session scan A b21818eb3072

Subscribe to this mod's changes

better-auth-best-practices is a skill published in the GitHub repository sutchan/Agent-Skills-Hub (2 stars, last pushed yesterday), licensed MIT. It adds 61 tokens to every session and 2,064 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. It is 92% identical to better-auth-best-practices, differing in 25 lines, and is treated as a copy.

Related

Other skills, from other repositories

file-upload-media-expert

Expert guide for file uploads (S3, R2, Supabase Storage), presigned URLs, image/video processing, CDN optimization, and media pipeline architecture / Panduan ahli untuk upload file (S3, R2, Supabase Storage), presigned URL, pemrosesan gambar/video, optimasi CDN, dan arsitektur pipeline media.

roedyrustam/vibes-plug · 76 tokens

email-notification-expert

Expert guide for transactional email (Resend, Postmark, SES), React Email templates, in-app notifications, and unified communication pipelines / Panduan ahli untuk email transaksional (Resend, Postmark, SES), template React Email, notifikasi in-app, dan pipeline komunikasi terpadu.

roedyrustam/vibes-plug · 65 tokens

js-backend-expert

Expert-level skill for Node.js 24+ (LTS), Bun 1.2+, and Deno 2.x backend development. Covers Express 5, Fastify 5, Hono v4, NestJS, Prisma 6, Drizzle ORM, WebSockets, BullMQ, OpenTelemetry, and microservices in English and Indonesian.

roedyrustam/vibes-plug · 77 tokens

mvc-expert

Expert guidelines to refactor legacy PHP codebases into clean, modern, and scalable MVC-structured projects / Pedoman ahli untuk merefaktor codebase PHP lama menjadi proyek terstruktur MVC yang bersih, modern, dan skalabel.

roedyrustam/vibes-plug · 51 tokens

python-programming-expert

Expert-level skill for Python programming (Python 3.13/3.14+). Covers type safety, generic syntax (PEP 695), async/await TaskGroups, FastAPI 0.115+, Pydantic v2, uv package manager, Ruff, and pytest in English and Indonesian.

roedyrustam/vibes-plug · 68 tokens

spa-orchestrator

Orchestrates Single-Page Application (SPA) architecture, integrating frontend state management with API-driven backends / Mengorkestrasi arsitektur Single-Page Application (SPA), mengintegrasikan state management frontend dengan backend berbasis API.

roedyrustam/vibes-plug · 53 tokens