better-auth-add-plugin
Add a better-auth plugin to an existing project. Configures server and client plugins with proper imports.
Interactive setup wizard for better-auth authentication. Guides through database, framework, OAuth providers, and plugin configuration.
$ npx -y skills add secondsky/claude-skills --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
/better-auth-setupContext preview
What this command does when you run it.
Interactive setup wizard for better-auth authentication. Guides through database, framework, OAuth providers, and plugin configuration.
name: better-auth:setup description: Interactive setup wizard for better-auth authentication. Guides through database, framework, OAuth providers, and plugin configuration.
This command walks through configuring better-auth for your project.
Use the AskUserQuestion tool to collect configuration preferences:
Which database will you use? - Cloudflare D1 (Recommended for Cloudflare) - PostgreSQL (Drizzle) - PostgreSQL (Prisma) - MongoDB - MySQL - SQLite
Which ORM do you prefer? - Drizzle ORM (Recommended) - Prisma - Kysely - None (Direct adapter)
Which framework are you using? - Cloudflare Workers + Hono - Next.js (App Router) - Next.js (Pages Router) - Nuxt 3 - Remix - SvelteKit - Express - Fastify - Expo (React Native)
Which OAuth providers do you need? (Select all that apply) - Google - GitHub - Microsoft/Azure AD - Apple - Discord - Twitter/X - None (Email/password only)
Which features do you need? (Select all that apply) - Two-Factor Authentication (2FA) - Passkeys (WebAuthn) - Magic Links - Organizations (Multi-tenancy) - API Keys - Admin Dashboard - None
Based on answers, generate the appropriate files:
1. **`src/auth.ts`** (or `lib/auth.ts`)
2. **Database Schema**
3. **Auth Route**
4. **Client**
5. **Environment Variables Template**
Load `references/core-setup.md` and `references/cloudflare-binding.md` for:
Load `references/frameworks/nextjs.md` for:
Load `references/frameworks/nuxt.md` for:
Load `references/frameworks/expo-mobile.md` for:
# Create D1 database wrangler d1 create auth-db # Generate schema bunx drizzle-kit generate # Apply migrations wrangler d1 migrations apply auth-db --local
# Generate migrations bunx drizzle-kit generate # OR for Prisma bunx prisma generate # Apply migrations bunx drizzle-kit push # OR for Prisma bunx prisma migrate dev
No migrations needed - collections created automatically.
Generate `.env.example`:
# Required BETTER_AUTH_SECRET= # Generate: openssl rand -base64 32 APP_URL=http://localhost:3000 # Database (choose one) DATABASE_URL= # PostgreSQL/MySQL MONGODB_URI= # MongoDB # OAuth (if selected) GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= GITHUB_CLIENT_ID= GITHUB_CLIENT_SECRET= # Cloudflare (if applicable) # Set via: wrangler secret put BETTER_AUTH_SECRET
Run the generate-secret script:
./scripts/generate-secret.sh
Or manually:
openssl rand -base64 32
After setup, verify configuration:
# Run validation script npx tsx scripts/validate-config.ts # Test auth endpoints ./scripts/test-auth-health.sh
Provide user with: 1. List of created files 2. Commands to run (install deps, migrations) 3. Link to relevant documentation 4. Common next steps:
✓ Created src/auth.ts (Cloudflare D1 + Drizzle) ✓ Created src/db/schema.ts (user, session, account, verification) ✓ Created src/lib/auth-client.ts ✓ Created .env.example ✓ Updated wrangler.jsonc with D1 binding Next steps: 1. Generate secret: ./scripts/generate-secret.sh 2. Set secret: wrangler secret put BETTER_AUTH_SECRET 3. Create D1 database: wrangler d1 create auth-db 4. Generate migrations: bunx drizzle-kit generate 5. Apply migrations: wrangler d1 migrations apply auth-db --local Documentation: - Setup guide: references/core-setup.md - D1 integration: references/cloudflare-binding.md - OAuth setup: https://better-auth.com/docs/authentication/social-sign-in
145 production-ready skills for Claude Code CLI 🔌 Platform / Harness Support These plugins ship as Claude Code marketplace plugins (.claude-plugin/ manifests) and Codex CLI plugins (.codex-plugin/ manifests).
Repo: secondsky/claude-skills
Add a better-auth plugin to an existing project. Configures server and client plugins with proper imports.
Explain Better Auth error codes and provide solutions with code examples
Display Better Auth available authentication providers and their configuration