[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6ECWRDTYA4QTA2F1CKE56SM":3,"skill-same:01M6ECWRDTYA4QTA2F1CKE56SM":66},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":27,"linkOnly":28,"markdownContent":29,"markdownBody":29,"frontMatter":30,"refName":31,"commitSha":32,"skillDirectory":33,"forksCount":34,"repositoryHtmlUrl":35,"repositoryHomepageUrl":36,"ownerHtmlUrl":37,"ownerBlogUrl":6,"ownerDescription":38,"updatedAt":39,"install":40,"resources":53},"01M6ECWRDTYA4QTA2F1CKE56SM","create-auth-skill",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FLeoYeAI\u002Fopenclaw-master-skills\u002Fcreate-auth-skill\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[23,24,25,26],"auth","create","create auth skill","create auth","2026-11-10 10:12:30",false,"# 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",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FLeoYeAI\u002Fopenclaw-master-skills\u002Fcreate-auth-skill",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":41,"prompt":51,"zipAvailable":52},[42,45,48],{"tool":43,"command":44},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill create-auth-skill",{"tool":46,"command":47},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill create-auth-skill",{"tool":49,"command":50},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill create-auth-skill","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FLeoYeAI\u002Fopenclaw-master-skills\u002Fcreate-auth-skill\u002FSKILL.md",true,[54,60],{"path":55,"resourceType":56,"resourceTypeDesc":57,"sizeBytes":58,"sourceHtmlUrl":59},"agents\u002Fopenai.yaml","REFERENCE","参考文档",110,"https:\u002F\u002Fgithub.com\u002FThamielis\u002F.agents\u002Fblob\u002Fmain\u002Fplugins\u002Flife-science-research\u002Fskills\u002Fgenebass-gene-burden-skill\u002Fagents\u002Fopenai.yaml",{"path":61,"resourceType":62,"resourceTypeDesc":63,"sizeBytes":64,"sourceHtmlUrl":65},"scripts\u002Fgenebass_gene_burden.py","SCRIPT","脚本",9739,"https:\u002F\u002Fgithub.com\u002FThamielis\u002F.agents\u002Fblob\u002Fmain\u002Fplugins\u002Flife-science-research\u002Fskills\u002Fgenebass-gene-burden-skill\u002Fscripts\u002Fgenebass_gene_burden.py",[67,77,87,96,102,109],{"skillNo":68,"name":69,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":73,"publishedAt":27},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[72],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[74,75,76],"model","model hierarchy","model hierarchy skill",{"skillNo":78,"name":79,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":83,"publishedAt":27},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[82],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[84,85,86],"MCP","zoom","zoom mcp",{"skillNo":88,"name":89,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":27},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[93,94,95,85],"sdk","zoom apps sdk","apps",{"skillNo":97,"name":98,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":27},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[98],{"skillNo":103,"name":104,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":108,"publishedAt":27},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[107],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[104],{"skillNo":110,"name":111,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":27},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[111]]