Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add bobmatnyc/claude-mpm-skills --skill better-auth-authentication -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/better-auth-authentication/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/better-auth-authentication/

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

Similar skills

All skills for Backend and APIs →

From the same set66

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor