better-auth-best-practices — Claude Code skill: setup
This skill guides Better Auth setup in TypeScript projects, covering the server, client, database, sessions, and plugins for email/password or OAuth flows.
npx skills add better-auth/skills --skill better-auth-best-practices -a claude-code
npx skills add better-auth/skills --skill best-practices -a claude-codeWhat better-auth-best-practices does
The skill works from the Better Auth version resolved in the project, using the lockfile or package manifest as the starting point. It guides the agent through auth.ts, BETTER_AUTH_SECRET, BETTER_AUTH_URL, a framework route handler, and a check against GET /api/auth/ok.
Its coverage includes built-in, Drizzle, Prisma, and MongoDB adapters, email/password and OAuth configuration, client methods, session storage, hooks, and plugins. For Drizzle and Prisma, the workflow includes schema generation with npx auth@latest generate followed by the ORM migration commands.
One detail deserves attention: Better Auth expects adapter model names rather than physical table names. With a Prisma model named User mapped to the users table, the configuration uses modelName: "user".
What it helps with
- set up a Better Auth server and client
- connect a Drizzle or Prisma database adapter
- configure email/password and OAuth sign-in
- choose session storage and cookie cache behavior
- add Better Auth plugins, hooks, and environment variables
Example prompts for the agent
- Set up Better Auth in this TypeScript project using `auth.ts`, `BETTER_AUTH_SECRET`, and `BETTER_AUTH_URL`, then add the route handler.
- Review the Prisma setup for Better Auth and generate the schema at `prisma/schema.prisma`.
- Add `twoFactor` from `better-auth/plugins/two-factor` and list the required client and database changes.
How to install better-auth-best-practices
1Skills CLI (Vercel)
npx skills add better-auth/skills --skill better-auth-best-practices -a claude-codenpx skills add better-auth/skills --skill best-practices -a claude-code2Manually: put the files in place
~/.claude/skills/best-practices/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/best-practices/
1Skills CLI (Vercel)
npx skills add better-auth/skills --skill best-practices -a codex2Manually: put the files in place
.agents/skills/best-practices/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add better-auth/skills --skill best-practices -a cursor2Manually: put the files in place
.cursor/skills/best-practices/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install better-auth/skills best-practices2Manually: put the files in place
.github/skills/best-practices/SKILL.md1Skills CLI (Vercel)
npx skills add better-auth/skills --skill best-practices -a gemini-cli2Platform CLI
gemini skills install https://github.com/better-auth/skills --path better-auth/best-practicesManually: put the files in place
.devin/skills/best-practices/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add better-auth/skills --skill best-practices -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set5
The whole set →Similar
Questions about better-auth-best-practices
How do I install better-auth-best-practices in Claude Code?
Run npx skills add better-auth/skills --skill better-auth-best-practices -a claude-code, then run npx skills add better-auth/skills --skill best-practices -a claude-code. Confirm the file at ~/.claude/skills/best-practices/SKILL.md.
What does better-auth-best-practices do?
It guides Better Auth configuration for the server and client, database adapters, environment variables, sessions, email/password, OAuth, hooks, and plugins.
What should I check when connecting Better Auth to Prisma?
Use the Prisma model name in the adapter configuration, not the physical table name. For a User model mapped to users, use modelName: "user".