No slash command · from fuse-tanstack-start
Adds authentication to TanStack Start apps: route protection, server-function authorization, session/cookie handling, and CSRF. Prevents the common gotcha of relying on UI guards for API security.
Ships in fuse-tanstack-start. 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.
Read when SKILL.md points to them.
The central gotcha this skill exists to prevent: beforeLoad + redirect() protects the UI only — server functions and server routes are independently reachable API endpoints, so authorization MUST be enforced inside the server-function handler or its middleware, never assumed from a route guard.
Ships DIY server-primitive templates (portable, no vendor lock-in) for an _authed layout + authMiddleware, session/CSRF helpers, and OAuth authorization-code flow with PKCE. For a managed auth library, install it and follow its own current docs or the dedicated better-auth skill rather than assuming a Start adapter API.
Do NOT use this skill for generic route guards unrelated to auth (react-tanstack-router) or non-Start Node auth setups.
beforeLoad + redirect() protects the UI, NOT your data.
Server functions and server routes are API endpoints reachable independently of whichever route renders the calling component. A beforeLoad guard keeps a user off a screen, but the underlying createServerFn handler can still be called directly (crafted request, replayed RPC). Authorization MUST be enforced inside the server-function handler or its middleware — that is the security boundary. beforeLoad is route UX only.
Route beforeLoad guard → UX: keep users out of screens they can't use
Server-fn middleware → SECURITY: the real data/API boundary — enforce auth HERE
→ data-boundary.md is mandatory reading before writing any auth code.
Before ANY implementation, spawn in parallel:
src/routes/_authed*, src/server/, existing session code/websites/tanstack_start_framework_reactuseSession, createMiddleware, getRequest signaturesAfter implementation, run fuse-ai-pilot:sniper, then consider fuse-security:auth-audit.
| Concern | Primitive |
|---|---|
| Route UX | beforeLoad + redirect({ to: '/login' }) in an _authed layout route |
| Data authorization | authMiddleware on every private createServerFn (the real boundary) |
| Sessions | useSession<T>() (sealed cookie) OR manual __Host- cookie via getRequest/setResponseHeader |
| CSRF | createCsrfMiddleware() (auto for server fns) + Origin check for sibling subdomains |
authMiddleware; never rely on beforeLoad.SameSite=Lax protects them.process.env.SECRET inside the handler, NEVER at module scope (leaks to bundle; undefined on edge).The official authentication guide lists Clerk, WorkOS, Better Auth, and Auth.js as supported options, plus fully DIY. This skill ships the DIY server-primitive templates (portable, no vendor lock-in), which the official guide documents in depth. For a managed library (Auth.js, Better Auth, Clerk, WorkOS), install it and follow ITS current docs / the better-auth skill — do NOT assume a Start adapter API without verifying it, and note there is no first-party start-authjs example in the TanStack repo (the real DIY examples are start-basic-auth and start-supabase-basic).
| Topic | Reference | Load when |
|---|---|---|
| Data boundary | data-boundary.md | ALWAYS first — where auth is actually enforced |
| Route protection | route-protection.md | Building the _authed layout + RBAC redirects |
| Sessions & cookies | sessions-cookies.md | Issuing/reading sessions, cookie flags |
| Hardening | hardening.md | CSRF, rate limiting, OAuth state/PKCE, timing |
| Template | When to Use |
|---|---|
| authed-middleware.md | _authed layout + authMiddleware + protected server fn |
| session-and-csrf.md | Cookie session helpers + global CSRF/origin middleware + login |
| oauth-pkce.md | OAuth authorization-code flow with state + PKCE |
authMiddleware so every handler gets a typed session__Host- prefixed, HttpOnly, Secure, SameSite=Lax cookiesOrigin on non-GET requests against your app originbeforeLoad as the security boundaryprocess.env at module top levelreferences/data-boundary.md (opens in a new tab)references/hardening.md (opens in a new tab)references/route-protection.md (opens in a new tab)references/sessions-cookies.md (opens in a new tab)references/templates/authed-middleware.md (opens in a new tab)references/templates/oauth-pkce.md (opens in a new tab)references/templates/session-and-csrf.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub fusengine/claude-plugins --plugin fuse-tanstack-start9 skills in this plugin
/solid-tanstack-startUse when organizing TanStack Start code, splitting oversized routes/server functions, or reviewing architecture. Do NOT use for setup or plain React SPA./start-coreUse when scaffolding a TanStack Start project, wiring the build tool, or debugging setup (blank page, hydration, no client JS)./start-deploymentUse when building or deploying a TanStack Start app — Cloudflare, Netlify, Vercel/Node/Bun, prerendering, or env vars. Do NOT use for app logic or generic Vite config.Other plugins' skills for the same job