skills/waitlist-access-control/SKILL.md
Wire the common "invite-only with a waitlist" access pattern into a TanStack Start + Better Auth + Drizzle + Resend app — passwordless email-OTP sign-in gated by an email allowlist, a public waitlist capture with confirmation email, a "you're in" email when an address is whitelisted, a super-admin / admin / member role tier, and a super-admin-only admin section to view users, view the waitlist, whitelist emails, and promote admins. Use when the user wants invite-only access, an allowlist/whitelist of emails, a waitlist with emails, gated sign-up, an admin user-management section, role tiers, or "only let approved people in".
npx skillsauth add RonanCodes/ronan-skills waitlist-access-controlInstall 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.
The recurring "not open to the public yet" shape: anyone can ask to get in (waitlist), only approved emails can actually sign in (allowlist), sign-in is passwordless (email OTP), and an admin can approve people and manage roles. This skill wires that end-to-end on the canonical stack (TanStack Start + Better Auth + Drizzle/Postgres + Resend + Cloudflare Workers).
Composes with: /ro:better-auth (the auth base), /ro:resend (email), and the auth-guards canon (server-side route guards). Passwordless choice rationale: see the auth-UX trade-offs (OTP beats passwords for low-friction gated tools; passkeys layer on later).
flowchart TD
V["Visitor enters email"]:::user
G{"email in allowlist?"}:::engine
OTP["send 6-digit OTP (Resend)<br/>→ verify → signed in"]:::out
WL["upsert waitlist (pending)<br/>+ send waitlist-confirmation email"]:::out
A["Super-admin whitelists email<br/>→ create user row + allowlist<br/>+ send 'you're in' email"]:::engine
V --> G
G -- yes --> OTP
G -- no --> WL
WL -.later.-> A
A -.next sign-in.-> OTP
classDef user fill:#e0af40,stroke:#b8860b,color:#1a1a1a
classDef engine fill:#5bbcd6,stroke:#2d7d99,color:#1a1a1a
classDef out fill:#7dcea0,stroke:#4a9b6e,color:#1a1a1a
user.role — column on the existing Better Auth user table: 'super_admin' | 'admin' | 'member', default 'member'.allowlist — email (PK, lowercased), role (default 'member'), added_by (user id), created_at. The source of truth for "who may sign in".waitlist — email (PK, lowercased), status ('pending' | 'invited'), created_at, notified_at.Use Better Auth's emailOTP plugin with disableSignUp: true (so only pre-created users can sign in), and gate the OTP send on the allowlist. Non-allowlisted emails get waitlisted instead of a code:
// src/lib/auth.ts (inside betterAuth({ ... }))
emailAndPassword: { enabled: false },
plugins: [
emailOTP({
otpLength: 6,
expiresIn: 600,
disableSignUp: true, // only existing (= whitelisted) users can sign in
async sendVerificationOTP({ email, otp }) {
const addr = email.toLowerCase()
if (await isAllowlisted(addr)) {
await sendEmail(addr, `Your sign-in code: ${otp}`, otpBody(otp))
} else {
await upsertWaitlist(addr) // status 'pending'
await sendEmail(addr, `You're on the waitlist`, waitlistBody())
// do NOT send the OTP — they can't sign in until whitelisted
}
},
}),
],
Double-gate: disableSignUp: true means even a leaked code can't create an account for a non-whitelisted email. Whitelisting an email therefore must create the user row (not just the allowlist row), or first OTP sign-in fails with "no user".
Client: add emailOTPClient() to createAuthClient plugins. Sign-in UI is two steps: email → 6-digit code. If the email wasn't allowlisted, the response is success-but-no-code; show "You're on the waitlist, we'll email you when you're in."
Whitelist = create allowlist row + create the Better Auth user row (random id, name from email, emailVerified: true, role) + flip any waitlist row to invited + send the "you're in" email. Wrap in a server function callable only by admin/super-admin.
async function whitelist(email: string, role: 'member' | 'admin', byUserId: string) {
const addr = email.toLowerCase()
await db.insert(allowlist).values({ email: addr, role, addedBy: byUserId }).onConflictDoNothing()
await db.insert(user).values({ id: randomId(), email: addr, name: addr.split('@')[0], emailVerified: true, role }).onConflictDoNothing()
await db.update(waitlist).set({ status: 'invited', notifiedAt: new Date() }).where(eq(waitlist.email, addr))
await sendEmail(addr, `You're in 🎉`, invitedBody(appUrl))
}
A one-shot seed (script or idempotent migration-time insert) that whitelists the founding emails with roles. Take the super-admin email as a parameter; never hardcode it in shared/engine code (per-app config).
A small form (homepage or a /waitlist route) → server fn → upsertWaitlist(email) + confirmation email. Idempotent (re-submitting the same email is a no-op + same friendly message). This is the same waitlist the gate writes to, just a second, explicit entry point.
All via Resend from a verified domain. Copy follows /ro:write-copy (no em-dashes, plain, honest).
A route group gated by a server-side beforeLoad guard (per auth-guards canon) requiring role in (admin, super_admin):
requireRole('admin') helper on every admin server fn (defence in depth — never trust the client). Super-admin-only actions check role === 'super_admin' explicitly.
user.role + allowlist + waitlist tables + migrationdisableSignUp: true, allowlist-gated sendrequireRole() on every admin fn/ro:better-auth — the auth base this extends./ro:resend — the email transport (verified domain, send-email server fn).auth-guards canon — server-side beforeLoad route guards (every gated route)./ro:clerk — the hosted-UI alternative if you'd rather not own the user table.development
Close the loop on a Linear ticket when its work ships - move the status and post a deploy comment with the PR link, what shipped, and a try-it link, mentioning the collaborator. Used as the tail of /ro:linear-nightshift for every merged mirror, or manually after an ad-hoc build. Triggers on "linear update", "update the linear ticket", "mark NUT-x done", "tell eoin it shipped", "/ro:linear-update".
devops
Run a night-shift against a collaborator's Linear board. Pulls the team's Grilled tickets (/ro:linear-grill moves a ticket to Grilled once its questions are answered), VERIFIES the questions were actually answered (unanswered → bounce the ticket to the "Question for <name>" state), mirrors verified tickets to ephemeral GitHub issues with ready-for-agent, then runs the standard /ro:night-shift machinery on GitHub. Tail-calls /ro:linear-update for everything that merged + deployed. Triggers on "linear nightshift", "nightshift linear", "drain the linear board", "run the shift off linear", "/ro:linear-nightshift".
development
Grill a collaborator's Linear tickets and move every processed ticket to where it belongs. Resolves the board from the repo's .ro-linear.json, reads the collaborator's Backlog / Ready-for-agent issues, then per ticket either posts 3-5 decision-extracting questions (state moves to "Question for <name>") or confirms it build-ready (state moves to "Grilled", the gate /ro:linear-nightshift consumes); shipped-and-confirmed tickets close as Done. The async-collaborator counterpart of /ro:day-shift for people who never touch GitHub. Triggers on "grill linear", "grill eoin's tickets", "linear grill", "add questions to the linear tickets", "/ro:linear-grill".
development
--- name: about-page description: Add a standard About page to any web app, what it is, the tech stack, and an FAQ, wired into a footer link with a sticky footer. Built with Spartan + Tailwind (the canonical component layer) and falls back to semantic HTML so it ships reliably. Use whenever building, polishing, or shipping an app, every app should have one. Triggers on "add an about page", "about page", "footer about link", or as a standard step in app build/polish. category: frontend argument-h