nuxt-better-auth — Claude Code skill: install and setup
Guides Nuxt authentication with @nuxtjs/better-auth, including sessions, route protection, server APIs, and plugins.
npx skills add onmax/nuxt-skills --skill nuxt-better-auth -a claude-codeWhat nuxt-better-auth does
This skill routes each task to a focused reference: module setup, client or server authentication, page protection, database settings, types, or clientOnly mode. It guides work with @nuxtjs/better-auth APIs in a Nuxt project.
Protected API reads and mutations belong on the server through requireUserSession(event). Redirects should use validated local paths. After changing session payload fields on the server, call refreshSessionCookieCache(event); client auth endpoints that change the current session need runWithSessionRefresh().
Check the installed package version before using an API, because the published skill can be newer than the lockfile. That is a real compatibility check, not a cosmetic step. In clientOnly mode, local server helpers and SSR session hydration do not apply. Finish by running typecheck and the narrowest relevant authentication test.
What it helps with
- configure
@nuxtjs/better-authin a Nuxt app - enforce a session check in an API handler
- protect pages and API routes
- refresh the session cookie cache after server changes
- register Better Auth plugins with client companions
Example prompts for the agent
- “Set up
@nuxtjs/better-authin this Nuxt project and check the environment configuration.” - “Protect this API handler with
requireUserSession(event).” - “After changing session payload fields, add
refreshSessionCookieCache(event).”
How to install nuxt-better-auth
1Skills CLI (Vercel)
npx skills add onmax/nuxt-skills --skill nuxt-better-auth -a claude-code2Manually: put the files in place
~/.claude/skills/nuxt-better-auth/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/nuxt-better-auth/
1Skills CLI (Vercel)
npx skills add onmax/nuxt-skills --skill nuxt-better-auth -a codex2Manually: put the files in place
.agents/skills/nuxt-better-auth/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add onmax/nuxt-skills --skill nuxt-better-auth -a cursor2Manually: put the files in place
.cursor/skills/nuxt-better-auth/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install onmax/nuxt-skills nuxt-better-auth2Manually: put the files in place
.github/skills/nuxt-better-auth/SKILL.md1Skills CLI (Vercel)
npx skills add onmax/nuxt-skills --skill nuxt-better-auth -a gemini-cli2Platform CLI
gemini skills install https://github.com/onmax/nuxt-skills --path skills/nuxt-better-authManually: put the files in place
.devin/skills/nuxt-better-auth/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add onmax/nuxt-skills --skill nuxt-better-auth -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about nuxt-better-auth
How do I install nuxt-better-auth in Claude Code?
Run npx skills add onmax/nuxt-skills --skill nuxt-better-auth -a claude-code, then run npx skills add onmax/nuxt-skills --skill nuxt-better-auth -a claude-code again. The skill file is at ~/.claude/skills/nuxt-better-auth/SKILL.md.
What does nuxt-better-auth do?
It guides Nuxt authentication work with @nuxtjs/better-auth. Its references cover module setup, client and server sessions, route protection, plugins, types, and clientOnly.
What changes in clientOnly mode?
In clientOnly mode, do not use local server helpers or expect SSR session hydration. Check that the installed package version supports every API you use.
Source text
SKILL.md · MIT
--- name: nuxt-better-auth description: Guides authentication in Nuxt apps using @nuxtjs/better-auth. Use when installing or configuring the module, using its client or server APIs, protecting routes, refreshing sessions, or integrating Better Auth plugins. license: MIT --- # Nuxt Better Auth Use the smallest reference that matches the task. ## Pick a reference | Task | Read | | -------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | | Install the module, configure environment variables, or create config files | [references/installation.md](references/installation.md) | | Read client session state, build auth forms, call plugins, or fetch auth-bound data | [references/client-auth.md](references/client-auth.md) | | Read or enforce sessions in server handlers, create sessions, or refresh cached session data | [references/server-auth.md](references/server-auth.md) | | Protect pages or API routes and configure redirects | [references/route-protection.md](references/route-protection.md) | | Register Better Auth plugins and their client companions | [references/plugins.md](references/plugins.md) | | Configure NuxtHub, generated schema, or secondary storage | [references/database.md](references/database.md) | | Connect a Nuxt frontend to an external Better Auth server | [references/client-only.md](references/client-only.md) | | Use inferred auth types or add project fields | [references/types.md](references/types.md) | ## Rules that apply across tasks - Confirm the consumer's installed package version supports each API you use. The published skill may be newer than the consumer's lockfile. - Enforce protected API reads and mutations server-side with `requireUserSession(event)`. Route rules and page meta also control navigation. - Navigate only to validated local redirect paths. - In `clientOnly` mode, do not use local server helpers or expect SSR session hydration. - After server-side changes to session payload fields, call `refreshSessionCookieCache(event)`. Wrap custom client auth endpoints that create or change the current session with `runWithSessionRefresh()`. Before finishing an implementation, run the consumer's typecheck and the narrowest relevant auth test. ## Resources - [Documentation site](https://better-auth.nuxt.dev) - [Better Auth docs](https://www.better-auth.com/)
© onmax · MIT · onmax/nuxt-skills