SKILL.md
readonlyread-only
name
better-auth-plugins
description
Better Auth plugin system for TypeScript. Use when adding advanced auth features (2FA, magic link, passkey, username, JWT, organizations) via server and client plugins.
Better Auth Plugins
Goals
- Add server plugins to extend auth features.
- Add client plugins for matching client methods.
- Apply schema changes when plugins add tables.
Quick start
- Import the plugin from
better-auth/pluginsand add it toplugins. - Run migrations (
generateormigrate) when required. - Add the client plugin from
better-auth/client/plugins.
Example: Two-factor authentication
import { betterAuth } from "better-auth";
import { twoFactor } from "better-auth/plugins";
export const auth = betterAuth({
plugins: [twoFactor()],
});
import { createAuthClient } from "better-auth/client";
import { twoFactorClient } from "better-auth/client/plugins";
export const authClient = createAuthClient({
plugins: [twoFactorClient({ twoFactorPage: "/two-factor" })],
});
Migration reminder
Run the CLI when a plugin adds tables:
npx @better-auth/cli generate
npx @better-auth/cli migrate
Guardrails
- Add server and client plugins together to keep APIs aligned.
- Keep
nextCookies(if used) last in the server plugin list. - Review plugin docs for required schema and env variables.
References
toolchains/platforms/auth/better-auth/better-auth-plugins/references/plugins-index.md
You Might Also Like
Related Skills

verify
243K
Use when you want to validate changes before committing, or when you need to check all React contribution requirements.
facebook
test
243K
Use when you need to run tests for React core. Supports source, www, stable, and experimental channels.
facebook
feature-flags
243K
Use when feature flag tests fail, flags need updating, understanding @gate pragmas, debugging channel-specific test failures, or adding new flags to React.
facebook
extract-errors
243K
Use when adding new error messages to React, or seeing "unknown error code" warnings.
facebook