/hypervibe:_setup-2fa-adminfrom hypervibe
Sets up TOTP-based 2FA on a hypervibe admin login, including secret generation, backup codes, trusted-device cookie, idle auto-logout, and Bitwarden vault storage. Invoked by /add-2fa in admin mode.
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.Sets up 2FA on a hypervibe admin login. The deterministic core (install, generation of the secret + codes, writing the code, vault storage, env push) lives in scripts/setup-2fa.mjs. This skill handles the pre-flight (vault), the invocation, mounting the auto-logout, and the summary.
Input variables (passed by add-2fa): PROJECT_NAME, WEB_DIR, AUTH_APP.
The 2FA secret + the codes are stored in the Bitwarden vault. Make sure it is unlocked (the _ensure-vault pattern):
node "${CLAUDE_SKILL_DIR}/../../scripts/vault/vault.mjs" status
unlocked -> continue.locked / expired -> warn the user ("vault is locked, a window will open for your master password"), then:
node "${CLAUDE_SKILL_DIR}/../../scripts/vault/launch.mjs" unlock --lang <LANG>
(blocking, the user enters their master pwd, auto-closes on success). Then continue._add-keyring, then continue.Info: if the vault stays unavailable, the script falls back (gitignored file), non-blocking.
node "${CLAUDE_SKILL_DIR}/../../scripts/setup-2fa.mjs" \
--name "<PROJECT_NAME>" \
--issuer "<PROJECT_NAME capitalized>" \
--web-dir "<WEB_DIR>"
7 sub-steps (preflight, install otpauth + qrcode, TOTP secret, backup codes, writing the code, storage in the vault + scan QR, push of the environment variables). Ends with a handoff banner + JSON:
{"success":true,"storedIn":"vault|file","vaultItem":"<NAME>_2FA","qrPath":"…/.2fa-setup/qrcode.png"}
Relay it in plain language (↳ Generating your secret…, ↳ Storing your keys in your vault…).
On success: capture storedIn, vaultItem, qrPath. Move on to Step 3.
On failure: read the error above the banner (❌ Failed at: <step>, maps 1:1 to a function in setup-2fa.mjs). Causes: preflight (no admin auth / 2FA already present, or an auth.ts that is not the admin login alone: a combined sign-in admin, users, accounts in the database or an OAuth provider; the script refuses and leaves the file untouched, since it rewrites it whole: never work around it, go back to add-2fa Step 1), install (pnpm/network), env push. If src/lib/rate-limit.ts was missing (a project that ran /add-auth outside of bootstrap), the script creates a minimal one automatically while writing the code: no more broken build.
The script created src/components/dashboard/idle-timeout.tsx but did not mount it. In <WEB_DIR>/src/app/admin/(protected)/layout.tsx:
import { IdleTimeout } from "~/components/dashboard/idle-timeout";<IdleTimeout /> right before {children} (adapt to the actual wrapper; <><IdleTimeout />{children}</> if the layout returns <>{children}</>).Verify: cd <WEB_DIR> && pnpm tsc --noEmit then pnpm lint.
Invoke _update-claude-md:
env-vars: - \ADMIN_TOTP_SECRET` - TOTP secret for admin 2FA;- `ADMIN_2FA_BACKUP_HASHES` - hashed backup codes (JSON)`custom heading ## Two-factor authentication (2FA), body:
Admin login = password + 2FA (TOTP code).
- `loginAction` (`src/app/admin/signin/actions.ts`) = single entry point (password + 2nd factor + trust cookie + signed proof → signIn). NextAuth `authorize` validates the proof (`verifyLoginProof`).
- TOTP: `src/lib/auth-2fa.ts`, secret `ADMIN_TOTP_SECRET`. Codes: `src/lib/auth-backup-codes.ts`, hashed `ADMIN_2FA_BACKUP_HASHES`.
- Trusted device: 24h cookie. Idle logout: `IdleTimeout` (30 min). Session 8h.
- Secret + codes in plain text: in the Bitwarden vault (item `<PROJECT>_2FA`). To regenerate: delete `src/lib/auth-2fa.ts` then re-run `/add-2fa`.
✅ Two-factor authentication enabled
Logging in as admin will now require your password + a 6-digit code from <AUTH_APP>.
To do now (one time):
- Open your Bitwarden vault, item
<vaultItem>: your TOTP key and your 8 backup codes are there (encrypted, never displayed in the chat).- In <AUTH_APP>, add the entry: either by scanning the QR (
<qrPath>), or by pasting the key from the vault.- Keep the backup codes handy (they are already in your vault) in case you lose your phone.
- Once enrolled, delete the
.2fa-setup/folder (it only contains the scan QR; already ignored by git). Tell me "delete the 2FA folder" and I'll do it.After that: password + code from <AUTH_APP>. For 24h on this browser, only the password will be asked again; auto-logout after 30 min of inactivity.
If storedIn = "file" (vault unavailable at install time): replace point 1 with "open <folder>/secrets.txt, save the key + the codes in your password manager, then delete the .2fa-setup/ folder".
⚠️ Never re-display the secret or the codes in the chat - they are in the vault (or the file).
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
90 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`)./add-agent-dashboardAdd a monitoring screen for AI agents in the project admin: cost, run history, turn-by-turn traces, and a button to launch a run by hand. Installed when an agent is created, safe to re-run./add-aiAdd AI to an existing Next.js project: chat assistant, content processing, or generation. Estimates the cost from live prices and provisions a spending-capped key before writing any code. Model-independent through OpenRouter./add-analyticsAdd Google Analytics (GA4) to an existing Next.js project. Includes RGPD cookie consent banner./add-authAdd NextAuth (Auth.js) authentication to an existing T3 project. One structured question decides the mode - admin (fixed login in env vars) or users (DB-backed email+password with signup, signin, account page, delete account, and optional forgot-password if email is configured). OAuth providers (Google, GitHub) are offered as optional add-ons AFTER the user-credentials baseline, never as a replacement. This skill is an orchestrator - it delegates the actual implementation to `_setup-auth-admin` or `_setup-auth-users` depending on the chosen mode.npx claudepluginhub flavien-ia/hypervibe-craft --plugin hypervibeOther plugins' skills for the same job