skills/prisma-better-auth-nextjs/SKILL.md
Prisma 7 + Better Auth + Next.js App Router. Email/password, OAuth, 2FA, rate limiting, audit logging. Triggers: add auth, better auth, prisma auth, nextjs login, sign-up/sign-in, auth scaffold.
npx skillsauth add clownnvd/claude-code-skills prisma-better-auth-nextjsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Source: prisma.io/docs/guides/authentication/better-auth/nextjs
| Step | Folder | Files | What |
|------|--------|-------|------|
| 1 | 1-setup-project/ | create-nextjs-app | Create Next.js project |
| 2.1 | 2-setup-prisma/ | install-dependencies | Install Prisma + pg |
| 2.2 | | configure-prisma | prisma.config.ts |
| 2.3 | | generate-client | Generate typed client |
| 2.4 | | global-client | Singleton src/lib/db/index.ts |
| 3.1 | 3-setup-better-auth/ | install-configure | Install + src/lib/auth.ts |
| 3.2 | | add-auth-models | User, Session, Account (with @@map) |
| 3.3 | | migrate-database | Run migration |
| 4.1 | 4-api-routes/ | setup-routes | Catch-all + auth client |
| 5.1 | 5-pages/ | sign-up | Sign up form |
| 5.2 | | sign-in | Sign in form |
| 5.3 | | dashboard | Protected dashboard |
| 5.4 | | home | Landing page |
| 6 | 6-test/ | test-app | Test + troubleshoot |
| Step | Folder | Files | What |
|------|--------|-------|------|
| 2.5 | 2-setup-prisma/ | neon-adapter | Neon serverless adapter + dual URLs |
| 2.6 | | slow-query-logging | Structured slow query detection |
| 3.4 | 3-setup-better-auth/ | oauth-providers | Google + GitHub OAuth |
| 3.5 | | two-factor | TOTP 2FA plugin |
| 3.6 | | email-verification | Resend + React Email templates |
| 3.7 | | session-config | Session, cookies, trustedOrigins |
| 4.2 | 4-api-routes/ | rate-limiting | Upstash Redis + account lockout |
| 4.3 | | audit-logging | Structured auth event logging |
| File | Purpose |
|------|---------|
| prisma.config.ts | Datasource URL (Prisma 7: DIRECT_URL fallback) |
| src/lib/db/index.ts | Global Prisma + Neon adapter + slow query logging |
| src/lib/auth.ts | Better Auth config (email, OAuth, 2FA, hooks) |
| src/lib/auth-client.ts | React client (signIn, signUp, signOut, useSession, twoFactor) |
| src/lib/rate-limit.ts | Upstash Redis rate limiter + in-memory fallback |
| src/lib/auth/audit-log.ts | Structured auth event logger |
| src/lib/email/resend.ts | Resend email sender + fire-and-forget variant |
| src/app/api/auth/[...all]/route.ts | Auth API + rate limit + account lockout |
# Core
npm install prisma tsx --save-dev
npm install @prisma/client @prisma/adapter-neon better-auth
npx @better-auth/cli@latest secret
npx @better-auth/cli generate
npx prisma migrate dev --name add-auth-models
# Advanced
npm install @upstash/ratelimit @upstash/redis resend react-email
prisma.config.ts for datasource, NOT schema.prisma@@map("lowercase") — required by Better AuthDATABASE_URL (pooled) for queries, DIRECT_URL for migrationsX-Forwarded-For IP (proxy-set, not spoofable)Boolean(ID && SECRET)Boolean(process.env.RESEND_API_KEY)python .claude/skills/prisma-better-auth-nextjs/scripts/scaffold.py [target-dir]
tools
Zustand v5 state management for Next.js 16. Store patterns, middleware (persist/immer/devtools), SSR hydration, CV editor multi-step wizard, 20 documented errors. Triggers: zustand, store, state management, useState replacement, global state, persist, immer.
development
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
development
Ultimate UI/UX design intelligence with real app flow knowledge. 93 styles, 121 palettes, 81 font pairings, 35 charts, 79 components, 62 animations, 65 WCAG criteria, 46 responsive patterns, 46 dark mode rules, 60 design tokens, 13 stacks. PLUS: Claude.ai full UI blueprint (19 flows, all screens), PageFlows app patterns. Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check, clone, recreate, rebuild. Styles: glassmorphism, brutalism, neumorphism, bento, dark mode, view transitions, scroll-driven, container queries, AI-native, liquid glass, neo-minimalism, mesh gradient, geometric abstraction. Topics: color, accessibility, animation, layout, typography, spacing, shadow, gradient, responsive, dark mode, WCAG 2.2, design tokens, components, spring physics, kinetic typography, container queries, popover API, semantic tokens. Apps: claude.ai, ChatGPT-style, AI chat UI, SaaS dashboard.
development
--- name: ui description: UI quality system. 4 modes: research (design brief), score (10-category audit), fix (auto-fix from scorecard), pipeline (end-to-end chain). license: Complete terms in LICENSE.txt --- # UI Quality System One skill, 4 modes. Research real products, score UI quality, fix issues, or run the full pipeline. ## Modes | Mode | Use When | Workflow | |------|----------|---------| | **research** | Before building any page | Extract tokens → Search → Fetch → Design Brief | | **