No slash command · from hypervibe
Internal helper invoked by add-auth to set up NextAuth in admin-credentials mode with a single hardcoded admin via env vars, no DB or OAuth. Installs NextAuth, configures CredentialsProvider, generates password hashes, adds rate limiting, and pushes env vars.
Ships in hypervibe. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
/bootstrap carries no language signal by itself). If nothing in the conversation gives a signal, fall back to the OS locale (node -e "console.log(Intl.DateTimeFormat().resolvedOptions().locale)") before defaulting to English. ALWAYS reply in that language for every user-facing message: questions, progress, confirmations, summaries, errors - including any example text quoted in this skill, which is illustrative and must be translated, never sent verbatim.Installs NextAuth in admin mode: a single admin account whose credentials live in the env vars (no DB). Invoked by add-auth when the user chose "Just a protected admin interface".
The deterministic code (install, AUTH_SECRET generation, dev+prod hashes, scaffold auth.ts / password.ts / API route, scaffold pages /admin/signin + /admin (protected route group, every page checked by requireAdmin()), the middleware in front of the admin space, push env vars) lives in scripts/setup-auth-admin.mjs. This SKILL only handles the pre-flight (passed by add-auth), the script invocation, and the post-script communication (where the prod password's file is, never the password itself + CLAUDE.md).
Input variables (passed by add-auth): WEB_DIR, IS_MONOREPO, PROJECT_NAME.
⚠️ Fresh install only - the script refuses if src/server/auth.ts already exists. The "add admin on top of existing users-credentials" case is driven by Claude from add-auth Step 0, NOT by this skill.
node "${CLAUDE_SKILL_DIR}/../../scripts/setup-auth-admin.mjs" \
--name "<PROJECT_NAME>" \
--web-dir "<WEB_DIR>"
The script chains 10 sub-steps: preflight, install next-auth@beta, AUTH_SECRET generation, dev hash (Admin1234!) + prod generation (24 alphanumeric chars) + hash, write src/lib/password.ts, write src/server/auth.ts (marker // hypervibe:auth-modes admin; its authorize() limits sign-in attempts, 5 per address in 15 minutes, and a refusal reaches the form as code: "too_many_attempts"), write the API route (NextAuth's own handlers: a route that answered a refusal itself froze the sign-in form, 3.4.23), write admin pages (src/server/require-admin.ts, src/app/admin/signin/page.tsx + src/app/admin/(protected)/{layout,page}.tsx - route group that isolates the check from the signin to avoid the redirect loop; the page calls requireAdmin() on its first line, the layout checks too), write the admin gate's middleware (src/middleware.ts, or src/proxy.ts from Next.js 16: a request for an admin page without a session cookie goes to the sign-in page before anything renders; never written over a middleware the project already has), push env vars (AUTH_SECRET, ADMIN_USERNAME, ADMIN_PASSWORD_HASH_DEV, ADMIN_PASSWORD_HASH_PROD, target=all).
Why every page checks for itself: Next.js renders a layout and its page at the same time. When the layout alone checked, its redirect of a visitor without a session (307) left with the page's content already rendered, readable with a plain curl (found on 26/10/2026 in production, on sites built with this skill). The middleware is a first barrier, never the only one: a cookie is not a proof, it only lets the request through to requireAdmin().
The script prints live:
▸ <step> when it starts each sub-step✅ <result> at the end⚠️ <warning> (notably if src/lib/rate-limit.ts is absent - bootstrap is supposed to create it; the warning is non-blocking but the TS build will fail as long as rate-limit.ts does not exist){"success":true,"authMode":"admin","credentialsFile":"<path>","adminGate":{"status":"written","file":"src/middleware.ts","next":15},"envVars":["AUTH_SECRET","ADMIN_USERNAME","ADMIN_PASSWORD_HASH_DEV","ADMIN_PASSWORD_HASH_PROD"]}
The production password is never in this output, and never goes through the conversation: the script writes it, with the identifier and the sign-in page, in a file of the person's downloads folder (credentialsFile), and only its hash goes to the project. Never open, read or display that file: it is the person's.
Mark the step ✅, capture credentialsFile and adminGate from the JSON, and move on to Step 2.
adminGate.status is existing: the project already had a middleware (next-intl, routing by host name...), named in adminGate.file, and the script left it as it was. Read it. When the gate fits in without changing what it already does (the cookie check of ${CLAUDE_SKILL_DIR}/../../templates/auth/admin/middleware.ts first, for the admin paths only, then the existing logic, and its matcher extended to /admin and /admin/((?!signin).*)), merge it in. Otherwise leave the file untouched and tell the person, in one plain sentence, that the first barrier is missing and what to add, the pages being protected by requireAdmin() all the same. Never replace their file. With present, the gate was already there; with written, nothing to do.
❌ Failed at: <step>). The name maps 1:1 to a function in the script - open setup-auth-admin.mjs and look at the function.preflight failed → usually src/server/auth.ts already exists (re-config), or one of the pages src/app/admin/signin/page.tsx / src/app/admin/(protected)/{layout,page}.tsx (or src/server/require-admin.ts) already exists → go back to the Step 0 menu of add-auth. Or package.json missing / no Next.js.installNextAuth failed → pnpm / network error → retry manually.hashPasswords failed → often hash-password.mjs not found (sibling script absent) or Node too old. Diagnose with node "${CLAUDE_SKILL_DIR}/../../scripts/hash-password.mjs" --help.writeAuthTs / writePasswordTs / writeApiRoute / writeAdminPages / writeAdminGate failed → filesystem permission (rare) or missing template.pushEnvVars failed → all the code is in place, only the env vars did not land → run the command the error message gives: it pushes them again from .env without showing them. Their values are in no output, so never look for them there.Invoke _update-claude-md with:
stack: - **Auth**: NextAuth v5 (admin mode - single account via env vars)conventions:
- Auth admin: \await isAdmin()` from `~/server/auth` to check access. Session via `await auth()`.`- **Admin structure**: the pages to protect live in the route group \src/app/admin/(protected)/`, and every `page.tsx` there starts with `await requireAdmin()` (from `~/server/require-admin`) before reading any data: the check of the group's `layout.tsx` is not enough (the layout's redirect carries the page's content, Next.js rendering both at the same time). A page that needs interactivity stays a server page that calls `requireAdmin()` and renders a client component kept in its own file. Every `"use server"` action starts with `if (!(await isAdmin())) return;` (the sign-in action alone excepted: it is public by nature, and limited in attempts). The middleware (`src/middleware.ts`, `src/proxy.ts` from Next.js 16) sends a visitor without a session cookie to the sign-in page: a first barrier, never the only one. `src/app/admin/signin/page.tsx` stays outside the group to avoid the redirect loop. NEVER add a check in `app/admin/layout.tsx` (this layout also wraps signin → infinite loop).`custom:
## Changing the admin password in productionAdmin auth uses `ADMIN_PASSWORD_HASH_DEV` (dev) and `ADMIN_PASSWORD_HASH_PROD` (prod), selected via NODE_ENV.
To change it, the user types the new password in the masked window, never in the conversation: `node "<path>/scripts/vault/launch.mjs" collect-env --keys "NEW_ADMIN_PASSWORD:secret" --project-dir <app folder> --file .env.admin-password`; then hash it and push the hash in one go: `H=$(node "<path>/scripts/env-value.mjs" --project-dir <app folder> --file .env.admin-password NEW_ADMIN_PASSWORD | node "<path>/scripts/hash-password.mjs") && [ -n "$H" ] && printf 'ADMIN_PASSWORD_HASH_PROD=%s\n' "$H" | node "<path>/scripts/push-env-vars.mjs" --stdin`, and delete `.env.admin-password`.
To generate a new random password instead: `node "<path>/scripts/admin-password.mjs" rotate --project-dir <app folder>`. It writes the new password in a file of the user's downloads folder and pushes only its hash: the password never appears in the conversation, and it works once the site is deployed again.
env-vars:
- \AUTH_SECRET` - NextAuth session secret`- \ADMIN_USERNAME` - admin login name (default: admin)`- \ADMIN_PASSWORD_HASH_DEV` - scrypt hash of the dev admin password (Admin1234!)`- \ADMIN_PASSWORD_HASH_PROD` - scrypt hash of the prod admin password (unique per project)`Display exactly (replacing <CREDENTIALS_FILE> with the credentialsFile path of Step 1):
✅ Your admin interface is ready
You are the only one who can sign in. Here are your credentials:
Locally (on your computer during development):
- Username:
admin- Password:
Admin1234!In production (on your live site): the username and the password are in a file I have put in your downloads folder, so that the password never appears in our conversation:
<CREDENTIALS_FILE>⚠️ Open it, save the password in your password manager, then delete the file. It is stored nowhere else, only a hash (an unreadable version) is kept in the project. If you lose it, ask me for a new one.
How to use it: go to
/admin/signinand sign in. You will be redirected to/admin, your admin space (which for now just contains a welcome message and a sign-out button). Ask me whenever you want "add an admin page to manage X" - I will create the pages directly in the right folder (src/app/admin/(protected)/...), each one checking on its own that it is you before showing anything.
If the script reported warnings (e.g. rate-limit.ts absent), mention it here.
Never ask for the production password, never read the file: if the person pastes the password into the conversation anyway, say so plainly and offer a new one (admin-password.mjs rotate), since a password written in a conversation is kept in its history.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub flavien-ia/hypervibe-craft --plugin hypervibe90 skills in this plugin
/accessibilityAccessibility audit of a Next.js app: reads the code (images, buttons, links, form fields, keyboard, focus, zoom, motion), measures the live pages with PageSpeed Insights, explains each problem plainly, then applies the fixes the user approves./add-2faAdd two-factor authentication (2FA TOTP) to an existing T3 project's login. Orchestrator - asks which authenticator app the user wants, detects whether the project uses admin auth (single fixed login) or user accounts, and delegates to the right setup. Admin mode - 2FA is mandatory for the single admin, secret + backup codes stored in the Bitwarden vault. User mode - 2FA is optional per user, each user enables it from their account page, secrets + backup codes stored per-user in the database. Requires the project to already have hypervibe auth (`/add-auth`)./Other plugins' skills for the same job