Skip to main content
skill CX Codex

tanstack-start · oakoss — Claude Code skill: what it does, how to install

A skill that teaches your coding agent TanStack Start: server functions, SSR with streaming, middleware and deploy presets. Useful when you build a full-stack React app.

MIT 156 installs ★ 29 updated 2026-08-17

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add oakoss/agent-skills --skill tanstack-start -a claude-code
Open on GitHub

What tanstack-start does

The skill covers TanStack Start, a React framework with a server side built on TanStack Router. Reference tables inside show how to declare server functions with createServerFn(), validate input through a Zod schema, read request headers and set your own, and compose middleware. A separate table maps which helpers run on the server, which in the browser, and which in both.

Deployment gets its own section: @cloudflare/vite-plugin for Workers, @netlify/vite-plugin-tanstack-start for Netlify, and nitro/vite with a preset for Vercel, AWS Lambda, Bun or static output. The mistakes table is the practical part. Raw fetch calls throw away type safety and serialization, and Cloudflare needs the nodejs_compat flag in wrangler.toml or the app will not run.

TanStack Start is still a Release Candidate, so APIs can shift before 1.0. Check the examples against current @tanstack/react-start docs before copying them into a project.

What it helps with

  • Add a server function with Zod input validation
  • Set up SSR with streaming and <Suspense> boundaries
  • Guard a route group in beforeLoad
  • Compose request middleware for shared concerns
  • Pick the right Vite plugin for Cloudflare Workers or Vercel

Example prompts for the agent

  • Add a createServerFn that returns the order list and validate its input with Zod
  • Set up deploy to Cloudflare Workers with @cloudflare/vite-plugin and the nodejs_compat flag
  • Move the auth check into beforeLoad for the _authenticated route group

How to install tanstack-start

1Skills CLI (Vercel)

npx skills add oakoss/agent-skills --skill tanstack-start -a claude-code

2Manually: put the files in place

~/.claude/skills/tanstack-start/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/tanstack-start/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about tanstack-start

How do I install tanstack-start in Claude Code?

Run npx skills add oakoss/agent-skills --skill tanstack-start -a claude-code. The skill lands at ~/.claude/skills/tanstack-start/SKILL.md.

What does the tanstack-start skill do?

It gives your agent TanStack Start reference material: server functions with input validation, SSR and streaming, middleware, auth in beforeLoad, plus deploy presets for several platforms.

Does it match the latest TanStack Start release?

The framework is a Release Candidate and APIs can still change before 1.0, so compare the examples with the current @tanstack/react-start docs.

Source text

SKILL.md · MIT
---
name: tanstack-start
description: 'Full-stack React framework built on TanStack Router. Type-safe routing, server functions, SSR/streaming, middleware, and multi-platform deployment. Use when building full-stack React apps with SSR, server functions, middleware, or authentication. Use for createServerFn, createMiddleware, beforeLoad, API routes, Cloudflare Workers, Vercel, Netlify deployment.'
license: MIT
metadata:
  author: oakoss
  version: '1.5'
  source: 'https://tanstack.com/start/latest/docs'
user-invocable: false
---

# TanStack Start

Full-stack React framework built on TanStack Router. Type-safe server functions via RPC, SSR/streaming, middleware composition, and deployment to Cloudflare Workers, Vercel, Netlify, AWS Lambda, and more.

> **RC:** TanStack Start is currently in Release Candidate status. APIs may still change before the stable 1.0 release.

**Package:** `@tanstack/react-start`

## Quick Reference

| Pattern                                  | Usage                                                     |
| ---------------------------------------- | --------------------------------------------------------- |
| `createServerFn()`                       | GET (default) — idempotent, cacheable data fetching       |
| `createServerFn({ method: 'POST' })`     | Mutations that change data                                |
| `.inputValidator(zodSchema)`             | Input validation before handler                           |
| `.handler(async ({ data }) => {})`       | Server-side logic with typed input data                   |
| `getRequest()`                           | Access full incoming `Request` inside handler/middleware  |
| `getRequestHeader(name)`                 | Read a single request header by name                      |
| `setResponseHeaders(headers)`            | Set outgoing response headers (caching, cookies)          |
| `useServerFn(fn)`                        | Wrap server function for component use with pending state |
| `createMiddleware().server(fn)`          | Request middleware for cross-cutting concerns             |
| `.middleware([dep])`                     | Compose middleware with dependencies                      |
| `next({ context: {} })`                  | Pass data downstream through middleware chain             |
| `createMiddleware({ type: 'function' })` | Function-level middleware with input validation           |
| `requestMiddleware` in `createStart()`   | Global middleware for all requests (SSR, fns, routes)     |
| `functionMiddleware` in `createStart()`  | Global middleware for server functions only               |
| `createIsomorphicFn()`                   | Different implementations per environment                 |
| `createServerOnlyFn()`                   | Server-only utility — crashes if called from client       |
| `createClientOnlyFn()`                   | Client-only utility — crashes if called from server       |
| `useSession()`                           | Cookie-based session with encryption and secure settings  |
| `session.update()`                       | Update session data                                       |
| `session.clear()`                        | Clear session (logout)                                    |
| `beforeLoad`                             | Auth check before route loads                             |
| `_authenticated.tsx`                     | Pathless layout route for grouped protection              |
| `throw redirect({ to: '/login' })`       | Redirect with return URL                                  |
| `await ensureQueryData()`                | Block SSR on critical data                                |
| `prefetchQuery()`                        | Start fetch, don't block SSR                              |
| `<Suspense>` boundaries                  | Define streaming chunks                                   |
| `head: ({ loaderData }) => ({})`         | Meta tags, Open Graph, favicons                           |
| `head.scripts` + JSON-LD                 | Structured data for LLMO (schema.org)                     |
| `llms.txt` server route                  | AI system guidance file                                   |
| `headers: () => ({...})`                 | ISR / cache-control on route definition                   |
| `server: { handlers: { GET, POST } }`    | API routes on `createFileRoute`                           |
| `ssr: false`                             | Disable SSR for specific routes (SPA mode)                |

## Execution Boundaries

| Function               | Runs On | Client Can Call? | Use For                         |
| ---------------------- | ------- | ---------------- | ------------------------------- |
| `createServerFn()`     | Server  | Yes (RPC stub)   | Data fetching, mutations        |
| `createServerOnlyFn()` | Server  | No (throws)      | Secrets, DB connections         |
| `createClientOnlyFn()` | Client  | N/A              | localStorage, DOM APIs          |
| `createIsomorphicFn()` | Both    | N/A              | Per-environment implementations |

## Deployment (Vite Plugins)

| Platform       | Plugin                                 | Runtime |
| -------------- | -------------------------------------- | ------- |
| Cloudflare     | `@cloudflare/vite-plugin`              | Workers |
| Netlify        | `@netlify/vite-plugin-tanstack-start`  | Node    |
| Vercel         | `nitro/vite` (`preset: 'vercel'`)      | Node    |
| Node.js/Docker | `nitro/vite` (`preset: 'node-server'`) | Node    |
| AWS Lambda     | `nitro/vite` (`preset: 'aws-lambda'`)  | Node    |
| Bun            | `nitro/vite` (`preset: 'bun'`)         | Bun     |
| Static         | `nitro/vite` (`preset: 'static'`)      | None    |

## Common Mistakes

| Mistake                                      | Fix                                                    |
| -------------------------------------------- | ------------------------------------------------------ |
| No `.inputValidator()` on server functions   | Always validate with Zod schemas                       |
| Raw fetch instead of `createServerFn`        | Loses type safety, serialization, and code splitting   |
| Mixing server/client code without boundaries | Use `createServerOnlyFn` / `createClientOnlyFn`        |
| Checking auth in every handler               | Use middleware composition or `beforeLoad`             |
| Awaiting all data in loader                  | Only await critical data, prefetch the rest            |
| `Date.now()` in render                       | Pass timestamp from loader (hydration mismatch)        |
| Missing `nodejs_compat` flag                 | Required in `wrangler.toml` for Cloudflare             |
| GET for mutations                            | Use POST for create/update/delete                      |
| Cookies not forwarded to external APIs       | Use `getRequestHeader()` or `createIsomorphicFn`       |
| `process.env` in loader (runs on both)       | Wrap in `createServerFn` — loaders run client-side too |
| Unvalidated server env vars                  | Validate with Zod in `.server.ts` files                |
| Storing auth tokens in localStorage          | Use HTTP-only cookies via `useSession`                 |
| Exposing raw DB errors to client             | Catch and return user-friendly messages, log details   |
| No structured data for content pages         | Add JSON-LD via `head.scripts` for AI discoverability  |

## Delegation

Use this skill for TanStack Start server functions, middleware, SSR/streaming, route protection, API routes, and deployment configuration. Delegate to `tanstack-router` for file-based routing, search params, and data loading patterns. Delegate to `tanstack-query` for cache management, optimistic updates, and query patterns.

> If the `tanstack-form` skill is available, delegate form state management, validation, and field patterns to it.
> If the `local-first` skill is available, delegate local-first architecture decisions and sync engine selection to it.
> If the `electricsql` skill is available, delegate ElectricSQL shapes, auth configuration, and write patterns to it.
> If the `tanstack-db` skill is available, delegate reactive collections, live queries, and optimistic mutation patterns to it.

## References

- [Server Functions](references/server-functions.md) — createServerFn, useServerFn, validation, auth, request context, response headers, file uploads, streaming, TanStack Query integration
- [Middleware](references/middleware.md) — composition, function-level middleware, route-level middleware, global middleware, logging, rate limiting
- [SSR and Streaming](references/ssr-and-streaming.md) — Suspense, prerendering, ISR, cache-control, hybrid strategies, hydration safety
- [Route Protection](references/route-protection.md) — beforeLoad, pathless layouts, session security, login/logout, header forwarding, Better Auth
- [API Routes](references/api-routes.md) — server handlers, REST patterns, route-level middleware, webhooks, health check, server functions vs server routes
- [Deployment](references/deployment.md) — Vite plugins, adapter comparison, Cloudflare D1/KV/R2 bindings, Docker, prerendering
- [SEO and Head Management](references/seo.md) — head property, meta tags, Open Graph, Twitter Cards, favicons, SEO helper
- [LLM Optimization (LLMO)](references/llmo.md) — JSON-LD structured data, schema.org, llms.txt, machine-readable endpoints, AI citation patterns
- [Error Handling](references/error-handling.md) — discriminated unions, custom error classes, status codes, result types vs try-catch
- [File Organization](references/file-organization.md) — entry points, plugin config, execution boundaries, env validation, .server.ts convention
- [Known Issues](references/known-issues.md) — 10 documented issues with workarounds
- [Query Integration](references/query-integration.md) — Router+Query setup, SSR integration, setupRouterSsrQueryIntegration, DevTools
- [Integration Flows](references/integration-flows.md) — form submission with cache update, infinite scroll, paginated tables, auth-protected routes, error handling
- [Local-First Integration](references/local-first.md) — shape proxy server functions, mixing server-based and local-first data, ElectricSQL deployment
- [Electric Middleware](references/electric-middleware.md) — auth middleware for shape proxies, global middleware config, sendContext, function-level validation

© oakoss · MIT · oakoss/agent-skills

Similar skills

All skills for Frontend and UI →

tanstack-start by other authors comes first.

tanstack-start vercel-labs Gives the agent a recipe for building TanStack Start pages from a JSON spec, wiring routes, layouts and SSR loaders into the router. CX Codex +1 245installs tanstack-start jezweb Scaffolds a full-stack TanStack Start app on Cloudflare Workers from scratch: SSR, file-based routing, D1, auth. Useful when you want a working skeleton without cloning a template. CX Codex +1 2,500installs tanstack-start tanstack-skills Guides agents through building full-stack React apps with TanStack Start, streaming SSR, and type-safe server functions. CX Codex +1 4,000installs tanstack-start-cursorrules-prompt-file PatrickJS tanstack-start-cursorrules-prompt-file — a Cursor rule for TanStack Start, a full-stack React framework with SSR, server functions and type safety. Triggers when you work on Start projects, TanStack Router routes or Vinxi config files. CX Codex +1 ★ 41,178repo stars clerk-tanstack-patterns clerk The clerk-tanstack-patterns Claude Code skill covers Clerk authentication patterns for TanStack React Start. It activates for work with createServerFn, beforeLoad route protection, and request middleware. CX Codex +1 16,400installs tanstack-start-best-practices DeckardGer tanstack-start-best-practices is a Claude Code skill with best practices for full-stack React apps built with TanStack Start. It guides server functions, middleware, and session security. CX Codex +1 10,000installs tanstack-integration-best-practices DeckardGer tanstack-integration-best-practices — a skill that hands the agent rules for wiring TanStack Query, Router and Start together: loaders, SSR hydration, cache ownership. Useful once all three live in one codebase. CX Codex +1 3,100installs react-start TanStack react-start guides agents through TanStack Start with React. It covers Vite configuration, isomorphic loaders, server functions, and the useServerFn hook. CX Codex +1 533installs start-server-core TanStack start-server-core — a skill for Claude Code and five other platforms covering the TanStack Start server runtime: createStartHandler, request and response utilities, cookie management via AsyncLocalStorage. CX Codex +1 408installs

From the same set106

The whole set →

Project sponsors

Companies that keep this analytics open