What this thread does
As of November 2026, use a maintained authentication library and plan the integration before implementation. Better Auth’s create-auth skill scans the project and asks only the missing setup questions.
Do first: identify the installed auth version, framework and database, then use matching documentation as required by the best-practices skill.
The problem in plain words
Asked for "add login", an agent often invents session and token handling from scratch. That is the part most worth borrowing from a maintained library, and the part where silent mistakes (weak secrets, missing CSRF, sessions that never expire) are costly.
What Better Auth's skills do
The better-auth/skills repository includes a security skill covering rate limiting, auth secrets and CSRF protection. The repository root lists neither a README nor a licence file.
- create-auth requires a planning phase before any code: it scans the project for framework (Next.js, SvelteKit, Nuxt, Astro, Express, Hono), database and ORM (Prisma, Drizzle, pg, Mongo), existing auth libraries (next-auth, lucia, Clerk, Supabase Auth, Firebase) and package manager, then asks the applicable initial questions together: new project or adding or migrating, framework, database, sign-in methods and features. Providers, email verification and email-provider questions can follow after the earlier choices; it skips what it can detect (planning section).
- best-practices says to use documentation matching the Better Auth version installed in the project.
- security covers: secret must come from config or env and placeholder secrets are rejected in production (warns under 32 characters; generate with
openssl rand -base64 32), rate limiting enabled by default in production, CSRF, trusted origins, cookies and audit logging. The documented cookie defaults include SameSite=Lax and httpOnly (security skill, security docs).
Why people pick it (and counter-views)
Choose between operating an auth library and a hosted service based on your own data and operational requirements.
Related discussions: Better Auth versus Auth.js and Clerk versus BetterAuth.
Wording to give your agent
Suggested prompt: Add authentication. Do not write your own session or token handling. Use [library]. First scan the repo for framework, ORM and existing auth and tell me what you found. Ask me the planning questions, then implement. Generate the secret with openssl, keep it in the env file that is gitignored, and read the library's security docs before finishing. Verify the /api/auth/ok route and a sign-up then sign-out in a test.
Common mistakes
- Letting the agent keep both the old and new auth libraries; stale
auth-schemaafter adding plugins; putting the auth secret in client-exposed env vars; Drizzle setups missingdrizzle.config.ts(listed in the skill's gotchas). - For Supabase Auth users, see the separate RLS audit thread: authentication is not authorization.
Caveats
A skill steers the agent but does not make the resulting app secure; review the diff and run the security checklist.
Sources
- create-auth planning, version-aware best practices and security skill: maintainer guidance, including conditional follow-up questions and production rate limiting.
- Installation and security reference: setup and cookie safeguards; secure cookies apply when the base URL uses HTTPS. The Reddit links are additional discussion, not evidence for the setup instructions.
Started from a post by @better-auth, packaged by the editor. Original post