better-auth-authentication — Claude Code skill: auth flows
A skill for TypeScript apps: sets up email and password sign-in, social providers and email verification with Better Auth.
npx skills add bobmatnyc/claude-mpm-skills --skill better-auth-authentication -a claude-codeWhat better-auth-authentication does
The skill walks through wiring Better Auth into a TypeScript project. Quick start is three steps: enable emailAndPassword, configure socialProviders, create a client with createAuthClient. Then the client calls signUp.email, signIn.email, signIn.social and signOut.
Email verification gets its own section. Sending the link requires emailVerification.sendVerificationEmail, and emailAndPassword.requireEmailVerification blocks sign-in until the address is confirmed. Social providers go into socialProviders with their own credentials, signIn.social starts the OAuth flow, and redirects are set with callbackURL, errorCallbackURL and newUserCallbackURL.
Guardrails matter here. Call client methods from the client only, and keep secrets in server-only environment variables. The GitHub example needs GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET; without them GitHub sign-in fails. Persistent sessions on email sign-in are controlled by rememberMe. The skill is marked user-invocable: false, so you cannot call it directly.
What it helps with
- add email and password sign-in to a TypeScript app
- wire up GitHub as an OAuth provider
- send a verification link by email
- block sign-in until the address is verified
- set redirects for success and error cases
Example prompts for the agent
- Set up email and password auth with Better Auth in my TypeScript project
- Add GitHub sign-in and redirect to /dashboard after login
- Require email verification before users can sign in
How to install better-auth-authentication
1Skills CLI (Vercel)
npx skills add bobmatnyc/claude-mpm-skills --skill better-auth-authentication -a claude-code2Manually: put the files in place
~/.claude/skills/better-auth-authentication/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/better-auth-authentication/
1Skills CLI (Vercel)
npx skills add bobmatnyc/claude-mpm-skills --skill better-auth-authentication -a codex2Manually: put the files in place
.agents/skills/better-auth-authentication/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add bobmatnyc/claude-mpm-skills --skill better-auth-authentication -a cursor2Manually: put the files in place
.cursor/skills/better-auth-authentication/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install bobmatnyc/claude-mpm-skills better-auth-authentication2Manually: put the files in place
.github/skills/better-auth-authentication/SKILL.md1Skills CLI (Vercel)
npx skills add bobmatnyc/claude-mpm-skills --skill better-auth-authentication -a gemini-cli2Platform CLI
gemini skills install https://github.com/bobmatnyc/claude-mpm-skills --path toolchains/platforms/auth/better-auth/better-auth-authenticationManually: put the files in place
.devin/skills/better-auth-authentication/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add bobmatnyc/claude-mpm-skills --skill better-auth-authentication -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about better-auth-authentication
How do I install better-auth-authentication in Claude?
Run npx skills add bobmatnyc/claude-mpm-skills --skill better-auth-authentication -a claude-code. The skill lands at ~/.claude/skills/better-auth-authentication/SKILL.md.
What does better-auth-authentication do?
It covers Better Auth setup: email and password sign-in, social providers, sign-up, sign-out and email verification. It also lists rules for secrets and client-side calls.
What do I need for this skill to work?
A TypeScript project using Better Auth. The GitHub provider example needs GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET in server-side environment variables.
Source text
SKILL.md · MIT
---
name: better-auth-authentication
description: Better Auth authentication flows for TypeScript apps. Use when enabling email/password auth, configuring social providers, or implementing sign-up, sign-in, and verification flows.
user-invocable: false
disable-model-invocation: true
progressive_disclosure:
entry_point:
summary: "Better Auth authentication flows for TypeScript apps. Use when enabling email/password auth, configuring social providers, or implementing sign-up, sign-in, and verification flows."
when_to_use: "When implementing authentication, authorization, or security."
quick_start: "1. Review the core concepts below. 2. Apply patterns to your use case. 3. Follow best practices for implementation."
references:
- email-password.md
- providers.md
---
# Better Auth Authentication
## Goals
- Enable email/password authentication and social providers.
- Implement sign-up, sign-in, sign-out, and verification flows.
- Handle redirects and errors consistently.
## Quick start
1. Enable `emailAndPassword` and configure `socialProviders`.
2. Create a client with `createAuthClient`.
3. Use `signUp.email`, `signIn.email`, `signIn.social`, and `signOut` on the client.
```ts
import { betterAuth } from "better-auth";
export const auth = betterAuth({
emailAndPassword: { enabled: true },
socialProviders: {
github: {
clientId: process.env.GITHUB_CLIENT_ID as string,
clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
},
},
});
```
```ts
import { createAuthClient } from "better-auth/client";
const authClient = createAuthClient();
await authClient.signUp.email({
email,
password,
name,
});
await authClient.signIn.email({
email,
password,
callbackURL: "/dashboard",
});
await authClient.signIn.social({
provider: "github",
callbackURL: "/dashboard",
});
await authClient.signOut();
```
## Email verification
- Provide `emailVerification.sendVerificationEmail` to send the verification link.
- Use `emailAndPassword.requireEmailVerification` to enforce verification before sign-in.
## Social providers
- Configure providers in `socialProviders` with provider-specific credentials.
- Use `signIn.social` to start OAuth flows.
- Pass `callbackURL`, `errorCallbackURL`, and `newUserCallbackURL` for redirects.
## Guardrails
- Call client methods from the client only.
- Keep secrets in server-only env variables.
- Use `rememberMe` to control persistent sessions on email/password sign-in.
## References
- `toolchains/platforms/auth/better-auth/better-auth-authentication/references/email-password.md`
- `toolchains/platforms/auth/better-auth/better-auth-authentication/references/providers.md`
© bobmatnyc · MIT · bobmatnyc/claude-mpm-skills