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.
npx skills add sutchan/Agent-Skills-Hub --skill better-auth-best-practicesgit clone --depth 1 https://github.com/sutchan/Agent-Skills-HubWrote 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.
[](https://agentmods.dev/skills/sutchan/agent-skills-hub/better-auth-best-practices)<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.
<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>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.
| Model | Per session | Once 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 |
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.
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.
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.
- Prefer a version explicitly named by the user.
- Otherwise, inspect the resolved
better-authversion in the lockfile, falling back to the package manifest when no lockfile is available. - When the Better Auth MCP is available, call
get_docwith/llms.txtto resolve that package version to a documentation identifier. Pass the identifier to everysearch_docscall and pass result paths toget_docunchanged. - Without MCP, start at better-auth.com/llms.txt and follow the matching version index.
- 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
- Install:
npm install better-auth - Set env vars:
BETTER_AUTH_SECRETandBETTER_AUTH_URL - Create
auth.tswith database + config - Create route handler for your framework
- Run migrations:
- Built-in adapter:
npx auth@latest migrate - Drizzle:
npx auth@latest generate --output src/db/auth-schema.tsthennpx drizzle-kit push(dev) ornpx drizzle-kit generate && npx drizzle-kit migrate(prod) - Prisma:
npx auth@latest generate --output prisma/schema.prismathennpx prisma migrate dev
- Built-in adapter:
- 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 32BETTER_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.
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.
- yesterday Changed · +7 lines · -6 tokens per session a5337f186300
- 11d ago First seen · 186 lines · 67 tokens per session scan A b21818eb3072
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.
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.
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.
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.
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.
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.
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.