PluginBench
Skill
Pass
Audit score 90

nuxt-better-auth

onmax/nuxt-skills

Guides authentication in Nuxt apps using @nuxtjs/better-auth with client/server APIs, route protection, and session management.

What is nuxt-better-auth?

A reference skill for implementing authentication in Nuxt applications via the @nuxtjs/better-auth module. Use it when installing the module, configuring environment variables, building auth forms, protecting routes, managing sessions, or integrating Better Auth plugins.

  • Install and configure @nuxtjs/better-auth with environment variables
  • Read and manage client session state, build authentication forms, and call auth plugins
  • Enforce sessions in server handlers, create sessions, and refresh cached session data
  • Protect pages and API routes with redirects and route rules
  • Register Better Auth plugins and their client companions
  • Configure NuxtHub, database schema, and secondary storage

How to install nuxt-better-auth

npx skills add https://github.com/onmax/nuxt-skills --skill nuxt-better-auth
Prerequisites
  • Nuxt 3 application
  • @nuxtjs/better-auth module installed
Claude Code
Cursor
Windsurf
Cline

How to use nuxt-better-auth

  1. 1.Choose the relevant reference guide based on your task (installation, client auth, server auth, route protection, plugins, database, or client-only mode)
  2. 2.Follow the reference documentation for your specific use case
  3. 3.Confirm your installed package version supports the APIs you're using
  4. 4.For server-side changes to session payload, call refreshSessionCookieCache(event)
  5. 5.Wrap custom client auth endpoints that modify the current session with runWithSessionRefresh()
  6. 6.Run typecheck and relevant auth tests before finishing implementation

Use cases

Good for
  • Setting up authentication in a new Nuxt application with environment configuration
  • Building login/signup forms that read client session state and call auth endpoints
  • Protecting API routes and pages with server-side session enforcement via requireUserSession()
  • Refreshing session data after server-side mutations to session payload fields
  • Integrating third-party Better Auth plugins with their client companions
Who it's for
  • Nuxt application developers
  • Full-stack engineers building authenticated web applications
  • Teams implementing Better Auth in Nuxt projects

nuxt-better-auth FAQ

When should I use requireUserSession(event)?

Use it to enforce protected API reads and mutations server-side. It ensures the user has a valid session before allowing access to sensitive endpoints.

What's the difference between client and server auth APIs?

Client APIs read session state and build forms; server APIs read/enforce sessions in handlers, create sessions, and manage cached session data.

How do I refresh session data after server-side changes?

Call refreshSessionCookieCache(event) after modifying session payload fields, and wrap custom client auth endpoints that change the current session with runWithSessionRefresh().

Can I use this skill in client-only mode?

Yes, but do not use local server helpers or expect SSR session hydration in client-only mode. Use the client-only reference guide for external Better Auth server setups.

What should I do before finishing an implementation?

Run the consumer's typecheck and the narrowest relevant auth test to ensure your implementation is correct.

Full instructions (SKILL.md)

Source of truth, from onmax/nuxt-skills.


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

TaskRead
Install the module, configure environment variables, or create config filesreferences/installation.md
Read client session state, build auth forms, call plugins, or fetch auth-bound datareferences/client-auth.md
Read or enforce sessions in server handlers, create sessions, or refresh cached session datareferences/server-auth.md
Protect pages or API routes and configure redirectsreferences/route-protection.md
Register Better Auth plugins and their client companionsreferences/plugins.md
Configure NuxtHub, generated schema, or secondary storagereferences/database.md
Connect a Nuxt frontend to an external Better Auth serverreferences/client-only.md
Use inferred auth types or add project fieldsreferences/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