From product-builder
Adds Better Auth email-and-password authentication to an existing Product Builder Cloudflare Workers, React Router, Drizzle D1, TypeScript, Tailwind, and shadcn/ui project. Use when the user asks to add login, signup/register, logout, auth routes, session handling, Better Auth, or authentication-backed protected routes to a Product Builder project.
How this skill is triggered — by the user, by Claude, or both
Slash command
/product-builder:adding-authenticationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Work in the target Product Builder project repository. If the project path is unclear, ask only for the path before changing files.
Work in the target Product Builder project repository. If the project path is unclear, ask only for the path before changing files.
Require an existing Product Builder-style project that already has D1 and Drizzle configured. If D1 is missing, run the adding-database skill first.
Derive these values from the project or user prompt when possible:
PROJECT_PATH: <absolute path>
D1_BINDING: APP_DB
AUTH_COOKIE_PREFIX: App
pnpm for package installation and project commands.react-router-patterns before adding or changing React Router routes, loaders, actions, redirects, forms, protected routes, or app-level route files. Any React Router code must follow those patterns.better-auth, zod@4, @conform-to/react, and @conform-to/zod.AUTH_SECRET with openssl rand -base64 32 and write it to .env as AUTH_SECRET=<generated-value>..env secret values. Update .env.example with an AUTH_SECRET= placeholder.APP_DB binding.app/db/schema.ts with Better Auth-compatible table aliases in the adapter options.app/routes/auth.tsx at route path api/auth/*.App by default). If the cookie prefix in the auth config does not match what the client sends, every session check silently returns null — the user appears logged out with no error.AUTH_SECRET must be the same between dev and deployed environments. Generating a new secret invalidates all existing sessions.api/auth/* route must be a splat route (route("api/auth/*", "routes/auth.tsx")). Using a non-splat path causes Better Auth sub-endpoints like /api/auth/sign-in/email to 404.react-router-patterns, then add api/auth/*, login, logout, and signup routes using 04-auth-routes-and-forms.md.Better Auth (email + password).users, sessions, accounts, verifications) matching app/db/schema.ts.docs/conventions/routes.md — add auth-related route patterns: protected route loader check, login/signup form action with Better Auth API, logout action, safe redirect after auth.AUTH_SECRET, pnpm wrangler secret put AUTH_SECRET for remote deploys, migration commands.better-auth, zod@4, @conform-to/react, and @conform-to/zod are installed..env contains AUTH_SECRET=<secret generated with openssl rand -base64 32>..env.example documents AUTH_SECRET=.README.md documents that remote Cloudflare deployments require users to run pnpm wrangler secret put AUTH_SECRET from an authenticated Wrangler session.docs/architecture.md includes Better Auth in the Stack section.docs/data-model.md includes auth entities (users, sessions, accounts, verifications) matching app/db/schema.ts.docs/conventions/routes.md includes auth-related route patterns (protected routes, login/signup actions, logout, safe redirect).AGENTS.md documents auth setup, environment variables, and migration commands, and references docs/.app/db/schema.ts exports users, sessions, accounts, verifications, their relations, and schema.db/migrations.app/context.ts exposes auth: ReturnType<typeof betterAuth>.workers/app.ts constructs Better Auth with drizzleAdapter.app/routes.ts includes api/auth/*, login, logout, and signup.react-router-patterns was loaded and followed for auth routes, loaders, actions, redirects, and forms.context.get(appContext).app/routes/auth.tsx delegates loader and action to auth.handler(request).auth.api.signOut.pnpm format, pnpm typecheck, pnpm lint, and pnpm build pass after fixes.npx claudepluginhub adrianhdezm/mystack --plugin product-builderProvides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.