Agent skill
better-auth-plugins
Better Auth plugin system for TypeScript. Use when adding advanced auth features (2FA, magic link, passkey, username, JWT, organizations) via server and client plugins.
Install this agent skill to your Project
npx add-skill https://github.com/bobmatnyc/claude-mpm-skills/tree/main/toolchains/platforms/auth/better-auth/better-auth-plugins
SKILL.md
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
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
bad-example-skill
ANTI-PATTERN - Example showing violations of self-containment (DO NOT COPY)
example-framework-skill
Example of a properly self-contained skill following all best practices
systematic-debugging
Systematic debugging methodology emphasizing root cause analysis over quick fixes
verification-before-completion
Run verification commands and confirm output before claiming success
Root Cause Tracing
Systematically trace bugs backward through call stack to find original trigger
Brainstorming Ideas Into Designs
Interactive idea refinement using Socratic method to develop fully-formed designs
Didn't find tool you were looking for?