[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CSG16H7R9849PWTTETPB51":3,"skill-same:01M7CSG16H7R9849PWTTETPB51":46},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7CSG16H7R9849PWTTETPB51","create-auth-skill",null,"Scaffold and implement authentication in TypeScript\u002FJavaScript apps using Better Auth. Detect frameworks, configure database adapters, set up route handlers, add OAuth providers, and create auth UI pages. Use when users want to add login, sign-up, or authentication to a new or existing project with Better Auth.","Henrique1601\u002FSkiilsToIAs","Henrique1601","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F92006691?v=4","01M7CRXVT0GVXVK80JT1GR687S","Henrique Bezerra Dos Santos","01M7CRXVTN5Y8TMWJ1MDSKCQ1T",0,"MIT","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Fbackend-database\u002Fcreate-auth-skill\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: create-auth-skill\ndescription: Scaffold and implement authentication in TypeScript\u002FJavaScript apps using Better Auth. Detect frameworks, configure database adapters, set up route handlers, add OAuth providers, and create auth UI pages. Use when users want to add login, sign-up, or authentication to a new or existing project with Better Auth.\n---\n\n# Create Auth Skill\n\nGuide for adding authentication to TypeScript\u002FJavaScript applications using Better Auth.\n\n**For code examples and syntax, see [better-auth.com\u002Fdocs](https:\u002F\u002Fbetter-auth.com\u002Fdocs).**\n\n---\n\n## Phase 1: Planning (REQUIRED before implementation)\n\nBefore writing any code, gather requirements by scanning the project and asking the user structured questions. This ensures the implementation matches their needs.\n\n### Step 1: Scan the project\n\nAnalyze the codebase to auto-detect:\n- **Framework** — Look for `next.config`, `svelte.config`, `nuxt.config`, `astro.config`, `vite.config`, or Express\u002FHono entry files.\n- **Database\u002FORM** — Look for `prisma\u002Fschema.prisma`, `drizzle.config`, `package.json` deps (`pg`, `mysql2`, `better-sqlite3`, `mongoose`, `mongodb`).\n- **Existing auth** — Look for existing auth libraries (`next-auth`, `lucia`, `clerk`, `supabase\u002Fauth`, `firebase\u002Fauth`) in `package.json` or imports.\n- **Package manager** — Check for `pnpm-lock.yaml`, `yarn.lock`, `bun.lockb`, or `package-lock.json`.\n\nUse what you find to pre-fill defaults and skip questions you can already answer.\n\n### Step 2: Ask planning questions\n\nUse the `AskQuestion` tool to ask the user **all applicable questions in a single call**. Skip any question you already have a confident answer for from the scan. Group them under a title like \"Auth Setup Planning\".\n\n**Questions to ask:**\n\n1. **Project type** (skip if detected)\n   - Prompt: \"What type of project is this?\"\n   - Options: New project from scratch | Adding auth to existing project | Migrating from another auth library\n\n2. **Framework** (skip if detected)\n   - Prompt: \"Which framework are you using?\"\n   - Options: Next.js (App Router) | Next.js (Pages Router) | SvelteKit | Nuxt | Astro | Express | Hono | SolidStart | Other\n\n3. **Database & ORM** (skip if detected)\n   - Prompt: \"Which database setup will you use?\"\n   - Options: PostgreSQL (Prisma) | PostgreSQL (Drizzle) | PostgreSQL (pg driver) | MySQL (Prisma) | MySQL (Drizzle) | MySQL (mysql2 driver) | SQLite (Prisma) | SQLite (Drizzle) | SQLite (better-sqlite3 driver) | MongoDB (Mongoose) | MongoDB (native driver)\n\n4. **Authentication methods** (always ask, allow multiple)\n   - Prompt: \"Which sign-in methods do you need?\"\n   - Options: Email & password | Social OAuth (Google, GitHub, etc.) | Magic link (passwordless email) | Passkey (WebAuthn) | Phone number\n   - `allow_multiple: true`\n\n5. **Social providers** (only if they selected Social OAuth above — ask in a follow-up call)\n   - Prompt: \"Which social providers do you need?\"\n   - Options: Google | GitHub | Apple | Microsoft | Discord | Twitter\u002FX\n   - `allow_multiple: true`\n\n6. **Email verification** (only if Email & password was selected above — ask in a follow-up call)\n   - Prompt: \"Do you want to require email verification?\"\n   - Options: Yes | No\n\n7. **Email provider** (only if email verification is Yes, or if Password reset is selected in features — ask in a follow-up call)\n   - Prompt: \"How do you want to send emails?\"\n   - Options: Resend | Mock it for now (console.log)\n\n8. **Features & plugins** (always ask, allow multiple)\n   - Prompt: \"Which additional features do you need?\"\n   - Options: Two-factor authentication (2FA) | Organizations \u002F teams | Admin dashboard | API bearer tokens | Password reset | None of these\n   - `allow_multiple: true`\n\n9. **Auth pages** (always ask, allow multiple — pre-select based on earlier answers)\n   - Prompt: \"Which auth pages do you need?\"\n   - Options vary based on previous answers:\n     - Always available: Sign in | Sign up\n     - If Email & password selected: Forgot password | Reset password\n     - If email verification enabled: Email verification\n   - `allow_multiple: true`\n\n10. **Auth UI style** (always ask)\n   - Prompt: \"What style do you want for the auth pages? Pick one or describe your own.\"\n   - Options: Minimal & clean | Centered card with background | Split layout (form + hero image) | Floating \u002F glassmorphism | Other (I'll describe)\n\n### Step 3: Summarize the plan\n\nAfter collecting answers, present a concise implementation plan as a markdown checklist. Example:\n\n```\n## Auth Implementation Plan\n\n- **Framework:** Next.js (App Router)\n- **Database:** PostgreSQL via Prisma\n- **Auth methods:** Email\u002Fpassword, Google OAuth, GitHub OAuth\n- **Plugins:** 2FA, Organizations, Email verification\n- **UI:** Custom forms\n\n### Steps\n1. Install `better-auth` and `@better-auth\u002Fcli`\n2. Create `lib\u002Fauth.ts` with server config\n3. Create `lib\u002Fauth-client.ts` with React client\n4. Set up route handler at `app\u002Fapi\u002Fauth\u002F[...all]\u002Froute.ts`\n5. Configure Prisma adapter and generate schema\n6. Add Google & GitHub OAuth providers\n7. Enable `twoFactor` and `organization` plugins\n8. Set up email verification handler\n9. Run migrations\n10. Create sign-in \u002F sign-up pages\n```\n\nAsk the user to confirm the plan before proceeding to Phase 2.\n\n---\n\n## Phase 2: Implementation\n\nOnly proceed here after the user confirms the plan from Phase 1.\n\nFollow the decision tree below, guided by the answers collected above.\n\n```\nIs this a new\u002Fempty project?\n├─ YES → New project setup\n│   1. Install better-auth (+ scoped packages per plan)\n│   2. Create auth.ts with all planned config\n│   3. Create auth-client.ts with framework client\n│   4. Set up route handler\n│   5. Set up environment variables\n│   6. Run CLI migrate\u002Fgenerate\n│   7. Add plugins from plan\n│   8. Create auth UI pages\n│\n├─ MIGRATING → Migration from existing auth\n│   1. Audit current auth for gaps\n│   2. Plan incremental migration\n│   3. Install better-auth alongside existing auth\n│   4. Migrate routes, then session logic, then UI\n│   5. Remove old auth library\n│   6. See migration guides in docs\n│\n└─ ADDING → Add auth to existing project\n    1. Analyze project structure\n    2. Install better-auth\n    3. Create auth config matching plan\n    4. Add route handler\n    5. Run schema migrations\n    6. Integrate into existing pages\n    7. Add planned plugins and features\n```\n\nAt the end of implementation, guide users thoroughly on remaining next steps (e.g., setting up OAuth app credentials, deploying env vars, testing flows).\n\n---\n\n## Installation\n\n**Core:** `npm install better-auth`\n\n**Scoped packages (as needed):**\n| Package | Use case |\n|---------|----------|\n| `@better-auth\u002Fpasskey` | WebAuthn\u002FPasskey auth |\n| `@better-auth\u002Fsso` | SAML\u002FOIDC enterprise SSO |\n| `@better-auth\u002Fstripe` | Stripe payments |\n| `@better-auth\u002Fscim` | SCIM user provisioning |\n| `@better-auth\u002Fexpo` | React Native\u002FExpo |\n\n---\n\n## Environment Variables\n\n```env\nBETTER_AUTH_SECRET=\u003C32+ chars, generate with: openssl rand -base64 32>\nBETTER_AUTH_URL=http:\u002F\u002Flocalhost:3000\nDATABASE_URL=\u003Cyour database connection string>\n```\n\nAdd OAuth secrets as needed: `GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET`, `GOOGLE_CLIENT_ID`, etc.\n\n---\n\n## Server Config (auth.ts)\n\n**Location:** `lib\u002Fauth.ts` or `src\u002Flib\u002Fauth.ts`\n\n**Minimal config needs:**\n- `database` - Connection or adapter\n- `emailAndPassword: { enabled: true }` - For email\u002Fpassword auth\n\n**Standard config adds:**\n- `socialProviders` - OAuth providers (google, github, etc.)\n- `emailVerification.sendVerificationEmail` - Email verification handler\n- `emailAndPassword.sendResetPassword` - Password reset handler\n\n**Full config adds:**\n- `plugins` - Array of feature plugins\n- `session` - Expiry, cookie cache settings\n- `account.accountLinking` - Multi-provider linking\n- `rateLimit` - Rate limiting config\n\n**Export types:** `export type Session = typeof auth.$Infer.Session`\n\n---\n\n## Client Config (auth-client.ts)\n\n**Import by framework:**\n| Framework | Import |\n|-----------|--------|\n| React\u002FNext.js | `better-auth\u002Freact` |\n| Vue | `better-auth\u002Fvue` |\n| Svelte | `better-auth\u002Fsvelte` |\n| Solid | `better-auth\u002Fsolid` |\n| Vanilla JS | `better-auth\u002Fclient` |\n\n**Client plugins** go in `createAuthClient({ plugins: [...] })`.\n\n**Common exports:** `signIn`, `signUp`, `signOut`, `useSession`, `getSession`\n\n---\n\n## Route Handler Setup\n\n| Framework | File | Handler |\n|-----------|------|---------|\n| Next.js App Router | `app\u002Fapi\u002Fauth\u002F[...all]\u002Froute.ts` | `toNextJsHandler(auth)` → export `{ GET, POST }` |\n| Next.js Pages | `pages\u002Fapi\u002Fauth\u002F[...all].ts` | `toNextJsHandler(auth)` → default export |\n| Express | Any file | `app.all(\"\u002Fapi\u002Fauth\u002F*\", toNodeHandler(auth))` |\n| SvelteKit | `src\u002Fhooks.server.ts` | `svelteKitHandler(auth)` |\n| SolidStart | Route file | `solidStartHandler(auth)` |\n| Hono | Route file | `auth.handler(c.req.raw)` |\n\n**Next.js Server Components:** Add `nextCookies()` plugin to auth config.\n\n---\n\n## Database Migrations\n\n| Adapter | Command |\n|---------|---------|\n| Built-in Kysely | `npx @better-auth\u002Fcli@latest migrate` (applies directly) |\n| Prisma | `npx @better-auth\u002Fcli@latest generate --output prisma\u002Fschema.prisma` then `npx prisma migrate dev` |\n| Drizzle | `npx @better-auth\u002Fcli@latest generate --output src\u002Fdb\u002Fauth-schema.ts` then `npx drizzle-kit push` |\n\n**Re-run after adding plugins.**\n\n---\n\n## Database Adapters\n\n| Database | Setup |\n|----------|-------|\n| SQLite | Pass `better-sqlite3` or `bun:sqlite` instance directly |\n| PostgreSQL | Pass `pg.Pool` instance directly |\n| MySQL | Pass `mysql2` pool directly |\n| Prisma | `prismaAdapter(prisma, { provider: \"postgresql\" })` from `better-auth\u002Fadapters\u002Fprisma` |\n| Drizzle | `drizzleAdapter(db, { provider: \"pg\" })` from `better-auth\u002Fadapters\u002Fdrizzle` |\n| MongoDB | `mongodbAdapter(db)` from `better-auth\u002Fadapters\u002Fmongodb` |\n\n---\n\n## Common Plugins\n\n| Plugin | Server Import | Client Import | Purpose |\n|--------|---------------|---------------|---------|\n| `twoFactor` | `better-auth\u002Fplugins` | `twoFactorClient` | 2FA with TOTP\u002FOTP |\n| `organization` | `better-auth\u002Fplugins` | `organizationClient` | Teams\u002Forgs |\n| `admin` | `better-auth\u002Fplugins` | `adminClient` | User management |\n| `bearer` | `better-auth\u002Fplugins` | - | API token auth |\n| `openAPI` | `better-auth\u002Fplugins` | - | API docs |\n| `passkey` | `@better-auth\u002Fpasskey` | `passkeyClient` | WebAuthn |\n| `sso` | `@better-auth\u002Fsso` | - | Enterprise SSO |\n\n**Plugin pattern:** Server plugin + client plugin + run migrations.\n\n---\n\n## Auth UI Implementation\n\n**Sign in flow:**\n1. `signIn.email({ email, password })` or `signIn.social({ provider, callbackURL })`\n2. Handle `error` in response\n3. Redirect on success\n\n**Session check (client):** `useSession()` hook returns `{ data: session, isPending }`\n\n**Session check (server):** `auth.api.getSession({ headers: await headers() })`\n\n**Protected routes:** Check session, redirect to `\u002Fsign-in` if null.\n\n---\n\n## Security Checklist\n\n- [ ] `BETTER_AUTH_SECRET` set (32+ chars)\n- [ ] `advanced.useSecureCookies: true` in production\n- [ ] `trustedOrigins` configured\n- [ ] Rate limits enabled\n- [ ] Email verification enabled\n- [ ] Password reset implemented\n- [ ] 2FA for sensitive apps\n- [ ] CSRF protection NOT disabled\n- [ ] `account.accountLinking` reviewed\n\n---\n\n## Troubleshooting\n\n| Issue | Fix |\n|-------|-----|\n| \"Secret not set\" | Add `BETTER_AUTH_SECRET` env var |\n| \"Invalid Origin\" | Add domain to `trustedOrigins` |\n| Cookies not setting | Check `baseURL` matches domain; enable secure cookies in prod |\n| OAuth callback errors | Verify redirect URIs in provider dashboard |\n| Type errors after adding plugin | Re-run CLI generate\u002Fmigrate |\n\n---\n\n## Resources\n\n- [Docs](https:\u002F\u002Fbetter-auth.com\u002Fdocs)\n- [Examples](https:\u002F\u002Fgithub.com\u002Fbetter-auth\u002Fexamples)\n- [Plugins](https:\u002F\u002Fbetter-auth.com\u002Fdocs\u002Fconcepts\u002Fplugins)\n- [CLI](https:\u002F\u002Fbetter-auth.com\u002Fdocs\u002Fconcepts\u002Fcli)\n- [Migration Guides](https:\u002F\u002Fbetter-auth.com\u002Fdocs\u002Fguides)\n","# Create Auth Skill\n\nGuide for adding authentication to TypeScript\u002FJavaScript applications using Better Auth.\n\n**For code examples and syntax, see [better-auth.com\u002Fdocs](https:\u002F\u002Fbetter-auth.com\u002Fdocs).**\n\n---\n\n## Phase 1: Planning (REQUIRED before implementation)\n\nBefore writing any code, gather requirements by scanning the project and asking the user structured questions. This ensures the implementation matches their needs.\n\n### Step 1: Scan the project\n\nAnalyze the codebase to auto-detect:\n- **Framework** — Look for `next.config`, `svelte.config`, `nuxt.config`, `astro.config`, `vite.config`, or Express\u002FHono entry files.\n- **Database\u002FORM** — Look for `prisma\u002Fschema.prisma`, `drizzle.config`, `package.json` deps (`pg`, `mysql2`, `better-sqlite3`, `mongoose`, `mongodb`).\n- **Existing auth** — Look for existing auth libraries (`next-auth`, `lucia`, `clerk`, `supabase\u002Fauth`, `firebase\u002Fauth`) in `package.json` or imports.\n- **Package manager** — Check for `pnpm-lock.yaml`, `yarn.lock`, `bun.lockb`, or `package-lock.json`.\n\nUse what you find to pre-fill defaults and skip questions you can already answer.\n\n### Step 2: Ask planning questions\n\nUse the `AskQuestion` tool to ask the user **all applicable questions in a single call**. Skip any question you already have a confident answer for from the scan. Group them under a title like \"Auth Setup Planning\".\n\n**Questions to ask:**\n\n1. **Project type** (skip if detected)\n   - Prompt: \"What type of project is this?\"\n   - Options: New project from scratch | Adding auth to existing project | Migrating from another auth library\n\n2. **Framework** (skip if detected)\n   - Prompt: \"Which framework are you using?\"\n   - Options: Next.js (App Router) | Next.js (Pages Router) | SvelteKit | Nuxt | Astro | Express | Hono | SolidStart | Other\n\n3. **Database & ORM** (skip if detected)\n   - Prompt: \"Which database setup will you use?\"\n   - Options: PostgreSQL (Prisma) | PostgreSQL (Drizzle) | PostgreSQL (pg driver) | MySQL (Prisma) | MySQL (Drizzle) | MySQL (mysql2 driver) | SQLite (Prisma) | SQLite (Drizzle) | SQLite (better-sqlite3 driver) | MongoDB (Mongoose) | MongoDB (native driver)\n\n4. **Authentication methods** (always ask, allow multiple)\n   - Prompt: \"Which sign-in methods do you need?\"\n   - Options: Email & password | Social OAuth (Google, GitHub, etc.) | Magic link (passwordless email) | Passkey (WebAuthn) | Phone number\n   - `allow_multiple: true`\n\n5. **Social providers** (only if they selected Social OAuth above — ask in a follow-up call)\n   - Prompt: \"Which social providers do you need?\"\n   - Options: Google | GitHub | Apple | Microsoft | Discord | Twitter\u002FX\n   - `allow_multiple: true`\n\n6. **Email verification** (only if Email & password was selected above — ask in a follow-up call)\n   - Prompt: \"Do you want to require email verification?\"\n   - Options: Yes | No\n\n7. **Email provider** (only if email verification is Yes, or if Password reset is selected in features — ask in a follow-up call)\n   - Prompt: \"How do you want to send emails?\"\n   - Options: Resend | Mock it for now (console.log)\n\n8. **Features & plugins** (always ask, allow multiple)\n   - Prompt: \"Which additional features do you need?\"\n   - Options: Two-factor authentication (2FA) | Organizations \u002F teams | Admin dashboard | API bearer tokens | Password reset | None of these\n   - `allow_multiple: true`\n\n9. **Auth pages** (always ask, allow multiple — pre-select based on earlier answers)\n   - Prompt: \"Which auth pages do you need?\"\n   - Options vary based on previous answers:\n     - Always available: Sign in | Sign up\n     - If Email & password selected: Forgot password | Reset password\n     - If email verification enabled: Email verification\n   - `allow_multiple: true`\n\n10. **Auth UI style** (always ask)\n   - Prompt: \"What style do you want for the auth pages? Pick one or describe your own.\"\n   - Options: Minimal & clean | Centered card with background | Split layout (form + hero image) | Floating \u002F glassmorphism | Other (I'll describe)\n\n### Step 3: Summarize the plan\n\nAfter collecting answers, present a concise implementation plan as a markdown checklist. Example:\n\n```\n## Auth Implementation Plan\n\n- **Framework:** Next.js (App Router)\n- **Database:** PostgreSQL via Prisma\n- **Auth methods:** Email\u002Fpassword, Google OAuth, GitHub OAuth\n- **Plugins:** 2FA, Organizations, Email verification\n- **UI:** Custom forms\n\n### Steps\n1. Install `better-auth` and `@better-auth\u002Fcli`\n2. Create `lib\u002Fauth.ts` with server config\n3. Create `lib\u002Fauth-client.ts` with React client\n4. Set up route handler at `app\u002Fapi\u002Fauth\u002F[...all]\u002Froute.ts`\n5. Configure Prisma adapter and generate schema\n6. Add Google & GitHub OAuth providers\n7. Enable `twoFactor` and `organization` plugins\n8. Set up email verification handler\n9. Run migrations\n10. Create sign-in \u002F sign-up pages\n```\n\nAsk the user to confirm the plan before proceeding to Phase 2.\n\n---\n\n## Phase 2: Implementation\n\nOnly proceed here after the user confirms the plan from Phase 1.\n\nFollow the decision tree below, guided by the answers collected above.\n\n```\nIs this a new\u002Fempty project?\n├─ YES → New project setup\n│   1. Install better-auth (+ scoped packages per plan)\n│   2. Create auth.ts with all planned config\n│   3. Create auth-client.ts with framework client\n│   4. Set up route handler\n│   5. Set up environment variables\n│   6. Run CLI migrate\u002Fgenerate\n│   7. Add plugins from plan\n│   8. Create auth UI pages\n│\n├─ MIGRATING → Migration from existing auth\n│   1. Audit current auth for gaps\n│   2. Plan incremental migration\n│   3. Install better-auth alongside existing auth\n│   4. Migrate routes, then session logic, then UI\n│   5. Remove old auth library\n│   6. See migration guides in docs\n│\n└─ ADDING → Add auth to existing project\n    1. Analyze project structure\n    2. Install better-auth\n    3. Create auth config matching plan\n    4. Add route handler\n    5. Run schema migrations\n    6. Integrate into existing pages\n    7. Add planned plugins and features\n```\n\nAt the end of implementation, guide users thoroughly on remaining next steps (e.g., setting up OAuth app credentials, deploying env vars, testing flows).\n\n---\n\n## Installation\n\n**Core:** `npm install better-auth`\n\n**Scoped packages (as needed):**\n| Package | Use case |\n|---------|----------|\n| `@better-auth\u002Fpasskey` | WebAuthn\u002FPasskey auth |\n| `@better-auth\u002Fsso` | SAML\u002FOIDC enterprise SSO |\n| `@better-auth\u002Fstripe` | Stripe payments |\n| `@better-auth\u002Fscim` | SCIM user provisioning |\n| `@better-auth\u002Fexpo` | React Native\u002FExpo |\n\n---\n\n## Environment Variables\n\n```env\nBETTER_AUTH_SECRET=\u003C32+ chars, generate with: openssl rand -base64 32>\nBETTER_AUTH_URL=http:\u002F\u002Flocalhost:3000\nDATABASE_URL=\u003Cyour database connection string>\n```\n\nAdd OAuth secrets as needed: `GITHUB_CLIENT_ID`, `GITHUB_CLIENT_SECRET`, `GOOGLE_CLIENT_ID`, etc.\n\n---\n\n## Server Config (auth.ts)\n\n**Location:** `lib\u002Fauth.ts` or `src\u002Flib\u002Fauth.ts`\n\n**Minimal config needs:**\n- `database` - Connection or adapter\n- `emailAndPassword: { enabled: true }` - For email\u002Fpassword auth\n\n**Standard config adds:**\n- `socialProviders` - OAuth providers (google, github, etc.)\n- `emailVerification.sendVerificationEmail` - Email verification handler\n- `emailAndPassword.sendResetPassword` - Password reset handler\n\n**Full config adds:**\n- `plugins` - Array of feature plugins\n- `session` - Expiry, cookie cache settings\n- `account.accountLinking` - Multi-provider linking\n- `rateLimit` - Rate limiting config\n\n**Export types:** `export type Session = typeof auth.$Infer.Session`\n\n---\n\n## Client Config (auth-client.ts)\n\n**Import by framework:**\n| Framework | Import |\n|-----------|--------|\n| React\u002FNext.js | `better-auth\u002Freact` |\n| Vue | `better-auth\u002Fvue` |\n| Svelte | `better-auth\u002Fsvelte` |\n| Solid | `better-auth\u002Fsolid` |\n| Vanilla JS | `better-auth\u002Fclient` |\n\n**Client plugins** go in `createAuthClient({ plugins: [...] })`.\n\n**Common exports:** `signIn`, `signUp`, `signOut`, `useSession`, `getSession`\n\n---\n\n## Route Handler Setup\n\n| Framework | File | Handler |\n|-----------|------|---------|\n| Next.js App Router | `app\u002Fapi\u002Fauth\u002F[...all]\u002Froute.ts` | `toNextJsHandler(auth)` → export `{ GET, POST }` |\n| Next.js Pages | `pages\u002Fapi\u002Fauth\u002F[...all].ts` | `toNextJsHandler(auth)` → default export |\n| Express | Any file | `app.all(\"\u002Fapi\u002Fauth\u002F*\", toNodeHandler(auth))` |\n| SvelteKit | `src\u002Fhooks.server.ts` | `svelteKitHandler(auth)` |\n| SolidStart | Route file | `solidStartHandler(auth)` |\n| Hono | Route file | `auth.handler(c.req.raw)` |\n\n**Next.js Server Components:** Add `nextCookies()` plugin to auth config.\n\n---\n\n## Database Migrations\n\n| Adapter | Command |\n|---------|---------|\n| Built-in Kysely | `npx @better-auth\u002Fcli@latest migrate` (applies directly) |\n| Prisma | `npx @better-auth\u002Fcli@latest generate --output prisma\u002Fschema.prisma` then `npx prisma migrate dev` |\n| Drizzle | `npx @better-auth\u002Fcli@latest generate --output src\u002Fdb\u002Fauth-schema.ts` then `npx drizzle-kit push` |\n\n**Re-run after adding plugins.**\n\n---\n\n## Database Adapters\n\n| Database | Setup |\n|----------|-------|\n| SQLite | Pass `better-sqlite3` or `bun:sqlite` instance directly |\n| PostgreSQL | Pass `pg.Pool` instance directly |\n| MySQL | Pass `mysql2` pool directly |\n| Prisma | `prismaAdapter(prisma, { provider: \"postgresql\" })` from `better-auth\u002Fadapters\u002Fprisma` |\n| Drizzle | `drizzleAdapter(db, { provider: \"pg\" })` from `better-auth\u002Fadapters\u002Fdrizzle` |\n| MongoDB | `mongodbAdapter(db)` from `better-auth\u002Fadapters\u002Fmongodb` |\n\n---\n\n## Common Plugins\n\n| Plugin | Server Import | Client Import | Purpose |\n|--------|---------------|---------------|---------|\n| `twoFactor` | `better-auth\u002Fplugins` | `twoFactorClient` | 2FA with TOTP\u002FOTP |\n| `organization` | `better-auth\u002Fplugins` | `organizationClient` | Teams\u002Forgs |\n| `admin` | `better-auth\u002Fplugins` | `adminClient` | User management |\n| `bearer` | `better-auth\u002Fplugins` | - | API token auth |\n| `openAPI` | `better-auth\u002Fplugins` | - | API docs |\n| `passkey` | `@better-auth\u002Fpasskey` | `passkeyClient` | WebAuthn |\n| `sso` | `@better-auth\u002Fsso` | - | Enterprise SSO |\n\n**Plugin pattern:** Server plugin + client plugin + run migrations.\n\n---\n\n## Auth UI Implementation\n\n**Sign in flow:**\n1. `signIn.email({ email, password })` or `signIn.social({ provider, callbackURL })`\n2. Handle `error` in response\n3. Redirect on success\n\n**Session check (client):** `useSession()` hook returns `{ data: session, isPending }`\n\n**Session check (server):** `auth.api.getSession({ headers: await headers() })`\n\n**Protected routes:** Check session, redirect to `\u002Fsign-in` if null.\n\n---\n\n## Security Checklist\n\n- [ ] `BETTER_AUTH_SECRET` set (32+ chars)\n- [ ] `advanced.useSecureCookies: true` in production\n- [ ] `trustedOrigins` configured\n- [ ] Rate limits enabled\n- [ ] Email verification enabled\n- [ ] Password reset implemented\n- [ ] 2FA for sensitive apps\n- [ ] CSRF protection NOT disabled\n- [ ] `account.accountLinking` reviewed\n\n---\n\n## Troubleshooting\n\n| Issue | Fix |\n|-------|-----|\n| \"Secret not set\" | Add `BETTER_AUTH_SECRET` env var |\n| \"Invalid Origin\" | Add domain to `trustedOrigins` |\n| Cookies not setting | Check `baseURL` matches domain; enable secure cookies in prod |\n| OAuth callback errors | Verify redirect URIs in provider dashboard |\n| Type errors after adding plugin | Re-run CLI generate\u002Fmigrate |\n\n---\n\n## Resources\n\n- [Docs](https:\u002F\u002Fbetter-auth.com\u002Fdocs)\n- [Examples](https:\u002F\u002Fgithub.com\u002Fbetter-auth\u002Fexamples)\n- [Plugins](https:\u002F\u002Fbetter-auth.com\u002Fdocs\u002Fconcepts\u002Fplugins)\n- [CLI](https:\u002F\u002Fbetter-auth.com\u002Fdocs\u002Fconcepts\u002Fcli)\n- [Migration Guides](https:\u002F\u002Fbetter-auth.com\u002Fdocs\u002Fguides)\n",{"name":5,"description":7},"main","a73152352c0612252131e5cf84e91312a6cf17dc","backend-database\u002Fcreate-auth-skill","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs","https:\u002F\u002Fgithub.com\u002FHenrique1601","https:\u002F\u002Fbezerraportifolio.netlify.app\u002F","Full Stack Developer | React, Next.js, TypeScript, Node.js & IA | Construindo produtos digitais e soluções SaaS","2026-11-15 02:56:04",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add Henrique1601\u002FSkiilsToIAs --skill create-auth-skill",{"tool":38,"command":39},"bunx","bunx skills add Henrique1601\u002FSkiilsToIAs --skill create-auth-skill",{"tool":41,"command":42},"pnpm","pnpm dlx skills add Henrique1601\u002FSkiilsToIAs --skill create-auth-skill","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Fbackend-database\u002Fcreate-auth-skill\u002FSKILL.md",true,[],[47,54,61,69,76,83],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":19},"01M7E2ANBW9V6AVX5JXNCEAWF8","rag-architect-agent","Agente Arquiteto de RAG, Embeddings & Busca Vetorial. Especialista em design e implementação de pipelines de Retrieval-Augmented Generation de alta fidelidade: chunking semântico, modelagem pgvector no PostgreSQL (Neon\u002FSupabase), busca híbrida (cosseno + BM25), reranking, validação via TypeSafe AI e filosofia Ponytail (anti-overengineering).","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Fcustom-agents\u002Frag-architect-agent\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M7E29KKF8R02ZRGYE2MJM67G","rag-architecture-patterns","Padrões arquiteturais e implementação de pipelines RAG (Retrieval-Augmented Generation) de alta fidelidade para qualquer projeto ou sistema. Cobre chunking semântico, embeddings, busca híbrida (pgvector + BM25), reranking, validação via TypeSafe AI e filosofia Ponytail (anti-overengineering).","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Fai-agents\u002Frag-architecture-patterns\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":65,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7CWRA8E3BJ7CPY8N8EG28J1","skill-repair","Use this to fix and re-install agent skills that have failed installation.\nThis skill provides the necessary context and permissions to surgically update\nthe `manifest.json` after a fix has been applied.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Futilities\u002Fskill-repair\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7CWR66FZP8FA47WVZ4Z2EXC","security-scan","Scan your Claude Code configuration (.claude\u002F directory) for security vulnerabilities, misconfigurations, and injection risks using AgentShield. Checks CLAUDE.md, settings.json, MCP servers, hooks, and agent definitions.","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Futilities\u002Fsecurity-scan\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7CWR0QPY58QPTR1P759TFNG","security-review","Use this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment\u002Fsensitive features. Provides comprehensive security checklist and patterns.","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Futilities\u002Fsecurity-review\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7CWQXCE40XWT4FZ3VWZFGDP","security-bounty-hunter","Hunt for exploitable, bounty-worthy security issues in repositories. Focuses on remotely reachable vulnerabilities that qualify for real reports instead of noisy local-only findings.","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Futilities\u002Fsecurity-bounty-hunter\u002FSKILL.md",[],[]]