secondsky/claude-skills / plugins/tanstack-start/skills/tanstack-start
tanstack-start
VerifiedTanStack Start (RC) full-stack React with server functions, SSR, Cloudflare Workers. Use for Next.js migration, edge rendering, or encountering hydration, auth, data pattern errors.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 6.4 KB |
| references/cloudflare-hosting-and-env.md | markdown | 2.6 KB |
| references/devtools-and-llm-support.md | markdown | 1.2 KB |
| references/execution-and-auth.md | markdown | 2.1 KB |
| references/navigation-and-preloading.md | markdown | 1.6 KB |
| references/quickstart-and-layout.md | markdown | 2.8 KB |
| references/rendering-modes.md | markdown | 2.0 KB |
| references/routing-and-data-loading.md | markdown | 2.3 KB |
| references/server-functions-and-middleware.md | markdown | 2.9 KB |
| scripts/bootstrap-cloudflare-start.sh | script | 1.1 KB |
references/execution-and-auth.md
View on GitHub# Execution Model, Env Functions, and Auth/Data Patterns
## Execution Model (what runs where)
- Route modules execute on the server for SSR, then on the client after navigation. Avoid side effects at module scope; put work in loaders/components.
- Use environment functions to fence code:
```ts
import { createServerOnlyFn, createClientOnlyFn } from '@tanstack/react-start'
export const readSecret = createServerOnlyFn(() => process.env.API_KEY!)
export const focusInput = createClientOnlyFn(() => document.querySelector('input')?.focus())
```
- Prefer `createIsomorphicFn()` when you need one call site with server/client branches (e.g., logging to console vs. sending to APM).
## Authentication Building Blocks
- Sessions: `useSession()` in server functions or loaders; store `SESSION_SECRET` in env/binding.
- Protect routes with middleware:
```ts
const requireUser = createMiddleware({ type: 'function' }).server(async ({ next }) => {
const session = await useSession()
if (!session.data.userId) throw redirect({ to: '/login' })
return next({ context: { userId: session.data.userId } })
})
```
- Login/logout as server functions; throw `redirect()` after setting/clearing session.
- Hosted options with examples: Clerk, WorkOS, Auth.js, Supabase (see official examples list).
## Data Layer Guidance
- Keep database clients (D1, Neon, PlanetScale, Prisma, Drizzle) in `app/lib/db.ts` and import only in server functions/server routes.
- For Workers, prefer edge-friendly drivers (D1 binding, Prisma Data Proxy, Postgres HTTP/Neon) to avoid TCP.
- Co-locate validation schemas with server functions to reuse on the client via zod types.
## Observability
- Enable `observability` in `wrangler.jsonc` for request traces; forward `ctx.waitUntil(logger.flush())` in handlers.
- Use `console.log` in server functions; Start surfaces logs in dev and Workers tail. For client, gate logs behind `import.meta.env.DEV`.
## Path Aliases
- Add to `tsconfig.json`:
```json
{
"compilerOptions": {
"baseUrl": ".",
"paths": { "@/*": ["./app/*"] }
}
}
```
- Install `vite-tsconfig-paths` and add to `plugins` after `tanstackStart()`.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |