mfarzanansari/better-auth-skill/better-auth
Claude Code and agent skill by mfarzanansari/better-auth-skill
- community
Checking that the SKILL.md file is still in the repository.
Framework-agnostic Better Auth implementation and troubleshooting skill for TypeScript applications. Use when setting up Better Auth, migrating from Auth.js/Auth0/Clerk/Supabase/WorkOS, configuring adapters/providers/plugins, hardening security settings, or diagnosing Better Auth runtime/auth/session errors.
Install
npx vskill@latest install mfarzanansari/better-auth-skill/better-authSKILL.md
Better Auth
Overview
Use this skill to deliver production-grade Better Auth setup, migration, and debugging with explicit workflow gates.
Keep this file procedural. Load details from references/playbooks/ first, then exact upstream docs in references/upstream/.
Required Workflow
- Scan project context before implementation.
- Capture requirements and decide path.
- Route to the smallest playbook/reference set.
- Apply minimum changes.
- Validate auth flows and safety checks.
Do not skip project scan or requirement intake.
Phase 1: Project Scan and Requirement Intake
Before writing code, confirm:
- Framework/runtime: Next.js, SvelteKit, Nuxt, React Router v7, Express, Hono, Electron, etc.
- Database and adapter stack: Prisma, Drizzle, direct driver, MongoDB.
- Existing auth system and migration status.
- Required sign-in methods (email/password, social OAuth, magic link, passkey, phone).
- Required plugins (2FA, organization, bearer/API key, SSO/OIDC/OAuth provider, etc.).
- Whether Better Auth Infrastructure features are in scope (
@better-auth/infra, dashboard/sentinel/email/sms). - Email delivery strategy for verification/reset/invitations.
- Security constraints (trusted origins, session policy, CSRF, rate limits).
- Auth config location (
auth.ts) and package manager lockfile.
If any of these are unknown, ask before implementation.
Phase 2: Route to the Right Branch
Branch A: Core Setup / Migration
Use when creating first Better Auth integration or migrating from another provider.
Load in order:
references/playbooks/core-setup-migration.md- Relevant migration guide in
references/upstream/better-auth/llms.txt/docs/guides/ - Framework integration doc in
references/upstream/better-auth/llms.txt/docs/integrations/ - Adapter doc in
references/upstream/better-auth/llms.txt/docs/adapters/
Branch B: Security Hardening
Use when auditing security or fixing trust/session/rate-limit weaknesses.
Load in order:
references/playbooks/security-baseline.mdreferences/upstream/better-auth/llms.txt/docs/reference/security.mdreferences/upstream/better-auth/llms.txt/docs/reference/options.md
Branch C: Email/Password Flows
Use for signup/signin/reset/verification/password policy behavior.
Load:
references/playbooks/email-password.mdreferences/upstream/better-auth/llms.txt/docs/authentication/email-password.md- Relevant plugin docs (
email-otp,magic-link, etc.) if used.
Branch D: Organization and Multi-Tenant Flows
Use for org lifecycle, membership, invitations, role/permission patterns.
Load:
references/playbooks/organization.mdreferences/upstream/better-auth/llms.txt/docs/plugins/organization.md
Branch E: Two-Factor Flows
Use for TOTP/OTP, backup codes, trusted devices, and 2FA onboarding.
Load:
references/playbooks/two-factor.mdreferences/upstream/better-auth/llms.txt/docs/plugins/2fa.md
Branch F: Providers and Error Diagnosis
Use for OAuth/provider setup and explicit error troubleshooting.
Load:
references/playbooks/providers-and-errors.mdreferences/error-map.md- Exact error docs in
references/upstream/better-auth/llms.txt/docs/reference/errors/
Branch G: Infrastructure and Managed Services
Use when enabling Better Auth Infrastructure features (@better-auth/infra) such as dashboard, sentinel, managed email, or managed SMS.
Load in order:
references/upstream/better-auth/llms.txt/docs/infrastructure/introduction.mdreferences/upstream/better-auth/llms.txt/docs/infrastructure/getting-started.md- Exact infra plugin/service docs in
references/upstream/better-auth/llms.txt/docs/infrastructure/
Guardrails
- Re-run Better Auth CLI schema generation/migrations after adding or changing plugins.
- Re-run migrations after switching plugin options that affect schema.
- Verify env vars and callback/trusted-origin config before concluding root cause.
- For infrastructure features, verify
BETTER_AUTH_API_KEYand infra endpoint connectivity before deeper debugging. - Keep fixes scoped to the failing flow; avoid unrelated refactors.
- Use model names (adapter/ORM semantics), not raw table names, when required by adapter config.
- Prefer dedicated plugin import paths over broad plugin imports.
- Verify auth health endpoint (
/api/auth/ok) after setup or migrations.
Validation Checklist
For any meaningful auth change:
- Positive path works (signup/signin/session/use case success).
- Negative path is handled (invalid credentials/token/provider mismatch).
- Session behavior is correct (creation, refresh, revocation/log out).
- Security policy is enforced (origins/rate limits/verification where configured).
- Schema state is synchronized after plugin changes.
- OAuth/provider callbacks preserve query/path through proxy/ingress.
Refresh Upstream Docs
Useful modes:
Resource Map
- Playbook index:
references/index.md - Error triage map:
references/error-map.md - Merged playbooks:
references/playbooks/ - Upstream corpus:
references/upstream/better-auth/ - Refresh script:
scripts/fetch_better_auth_llms.py
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingbetter-auth/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mfarzanansari/better-auth-skill/better-auth)