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.testing
--- name: linear-pipeline description: The Fable orchestrator for a single dispatched Linear ticket. Holds almost no context itself; it receives `--issue <ID> --detached`, decides the stage sequence, and fans out a sub-agent per stage, passing forward only each stage's artifact (never re-derived, never inlined into its own context). Step zero, before any planning or stage routing, is a boundary triage against `canon/security-boundary.md` (#199): a match tags Ronan Connolly and stops the run, no
development
--- name: in-your-face description: Capture a chat-only answer into a durable artifact (markdown + HTML, PDF when cheap) and launch it automatically so the user cannot miss it. Use when user says "in your face", "don't let me lose this", "save that answer", "make that durable", or right after answering a substantive side question (a recipe, comparison, how-to, or generated prompt) that would otherwise die with the context. category: workflow argument-hint: [--no-open] [--vault <short>] [hint of
tools
One-shot headless OpenAI Codex CLI calls for background/admin AI tasks — summaries, classification, extraction, admin glue. The default engine for anything that runs AI constantly in the background (daemon-driven, per-event), because it bills the flat ChatGPT subscription instead of Claude usage or per-token API spend, and it keeps working while Claude is rate-limited. NEVER for coding — coding stays Claude. Use when a skill or daemon needs a cheap always-on AI call, when the user says "use codex", "ask codex", "codex as backup", or when building a background summarizer/classifier into a listener or loop. Reads auth from ~/.codex/auth.json (ChatGPT account, no API key).
research
Turn a warranty rejection, repair quote, or RMA email into a cited decision brief — legal read (NL/EU consumer law), is the part user-serviceable, live part and new-unit prices, repair-vs-DIY-vs-new economics, before-you-send-it checklist, deadlines. Use when the user pastes or screenshots a repair quote, warranty rejection, "not covered" email, onderzoekskosten fee, or asks "should I repair or replace this".