---
name: "better-auth-multi-provider-framework"
description: "Deploy comprehensive authentication with OAuth, passkeys, 2FA, and organization multi-tenancy."
metadata:
  author: "Better Auth"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "setup better auth"
  - "configure passkey webauthn better auth"
  - "multi-tenant organizations better auth"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Better Auth Modular Multi-Provider TypeScript Authentication

Configures Better Auth: configuring betterAuth instance, database adapters, social providers (GitHub, Google), two-factor authentication (2FA / TOTP), passkeys (WebAuthn), and client SDK hooks.

## When to Invoke
Invoke this skill whenever you need to:
- setup better auth
- configure passkey webauthn better auth
- multi-tenant organizations better auth

## Execution SOP & Rules
1. Initialize server: export const auth = betterAuth({ database: prismaAdapter(db), socialProviders: { ... } }).
2. Mount handler in route handler: app/api/auth/[...all]/route.ts export const { GET, POST } = toNextJsHandler(auth).
3. Initialize client SDK: const authClient = createAuthClient(); await authClient.signIn.social({ provider: 'github' }).
4. Add organization plugin: plugins: [organization()] for full multi-tenant workspace management.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
