better-auth
БесплатноБез исполняемых скриптовНе проверенBetter Auth in TypeScript — setting up the auth instance, picking adapters, wiring framework route handlers, configuring sessions and cookies, adding plugins…
от pproenca★ 231 звезда на GitHubОб этом скилле
Better Auth Best Practices
Implementation and migration guide for Better Auth, the framework-agnostic TypeScript authentication and authorization library. This skill contains 42 rules organized by impact across 8 categories, derived from the official documentation and migration guides.
When to Apply
Reference these guidelines when:
- Setting up a fresh Better Auth instance (config, adapter, route handler, client)
- Wiring framework-specific integrations (Next.js App/Pages Router, SvelteKit, Hono, Express, Nuxt, Astro)
- Configuring sessions, cookies, and security (rate limit, trusted origins, password hashing)
- Adding plugins: 2FA, organization, admin, magicLink, JWT, passkey, multi-session
- Migrating from another auth library (NextAuth/Auth.js, Clerk, Auth0, Supabase Auth)
- Debugging "session is null" / "redirect_uri_mismatch" / 403 CSRF errors
- Reviewing PRs that touch
lib/auth.ts,auth-client.ts, or/api/auth/route handlers
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Setup & Configuration | CRITICAL | setup- |
| 2 | Database Adapters & Schema | CRITICAL | db- |
| 3 | API Route Handlers | CRITICAL | route- |
| 4 | Session & Cookies | HIGH | session- |
| 5 | Auth Methods & Providers | HIGH | auth- |
| 6 | Security & Hardening | HIGH | security- |
| 7 | Plugins & Extensions | MEDIUM | plugins- |
| 8 | Migration from Other Auth | MEDIUM | migrate- |
Quick Reference
1. Setup & Configuration (CRITICAL)
setup-secret— Set a strongBETTER_AUTH_SECRETper environmentsetup-base-url— Configure an explicitbaseURLper environmentsetup-client-base-url— Match the clientbaseURLto the serversetup-singleton— Export a single auth instance from a server-only modulesetup-trusted-origins— ConfiguretrustedOriginsfor all non-baseURL callers
2. Database Adapters & Schema (CRITICAL)
db-adapter-selection— Pick the adapter that matches your ORMdb-schema-generate— Runauth generatethen ORM migrate before every deploydb-additional-fields— Extend the user schema viaadditionalFieldsdb-plugin-schema-customization— Rename plugin tables via theschemaoptiondb-database-hooks— UsedatabaseHooksfor cross-cutting logicdb-connection-pooling— Share one pooled DB client with the rest of your app
3. API Route Handlers (CRITICAL)
route-mount-catchall— Mount the catch-all handler at/api/auth/[...all]route-runtime-selection— Use the Node.js runtime for middleware that callsauth.apiroute-no-body-consumers— Mount auth before any body-parsing middleware
4. Session & Cookies (HIGH)
session-server-vs-client— Useauth.api.getSessionon server,authClient.useSessionon clientsession-expiry-tuning— ConfigureexpiresInandupdateAgetogethersession-cookie-cache— EnablecookieCacheto cut session DB lookupssession-cookie-attributes— SetsameSite,secure,partitionedfor cross-site flowssession-cross-subdomain— EnablecrossSubDomainCookiesfor multi-subdomain appssession-customsession-fields— UsecustomSessionto add computed fields
5. Auth Methods & Providers (HIGH)
auth-require-email-verification— EnablerequireEmailVerificationwithsendVerificationEmailauth-oauth-redirect-uri— Match OAuthredirectURIexactly with the provider consoleauth-oauth-env-vars— Load OAuth credentials from environment, never inlineauth-magic-link-setup— ImplementsendMagicLinkbefore enabling themagicLinkpluginauth-client-sign-in-helpers— UseauthClient.signIn.socialwithcallbackURLauth-infer-additional-fields— AddinferAdditionalFieldsto the client for type sync
6. Security & Hardening (HIGH)
security-rate-limit— Enable `rateLi
Установить better-auth в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл better-auth?
Better Auth in TypeScript — setting up the auth instance, picking adapters, wiring framework route handlers, configuring sessions and cookies, adding plugins (2FA, organization, admin, magicLink, JWT), or porting from NextAuth/Auth.js, Clerk, Auth0, or Supabase Auth. Covers Next.js, SvelteKit, Hono, Express, Nuxt, Astro, and React/Vue/Svelte clients. Trigger when writing, reviewing, or migrating Better Auth code — and even when the user doesn't explicitly mention Better Auth but is working on TypeScript authentication, session cookies, OAuth providers, or auth-library migration. Contains 42 rules organized by impact across 8 categories.
Как установить скилл better-auth?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл better-auth запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic