tanstack-start

TanStack Start full-stack React framework patterns. Use when working with file-based routing, API routes, server handlers, TanStack Router layouts, or integrating AI/MCP features in this codebase.

16 stars

Best use case

tanstack-start is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

TanStack Start full-stack React framework patterns. Use when working with file-based routing, API routes, server handlers, TanStack Router layouts, or integrating AI/MCP features in this codebase.

Teams using tanstack-start should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/tanstack-start/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/tanstack-start/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/tanstack-start/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How tanstack-start Compares

Feature / Agenttanstack-startStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

TanStack Start full-stack React framework patterns. Use when working with file-based routing, API routes, server handlers, TanStack Router layouts, or integrating AI/MCP features in this codebase.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# TanStack Start

## File-Based Routing

Routes live in `src/routes/`. The route tree auto-generates to `src/routeTree.gen.ts` - commit this file (required for type-checking).

### Route Types

- `__root.tsx` - Root layout, wraps all routes
- `index.tsx` - Index route for a path segment
- `demo.tsx` - Layout route wrapping all `demo/*.tsx` children (uses `<Outlet />`)
- `demo/*.tsx` - Child routes rendered inside parent layout
- `$param.tsx` - Dynamic route segment

### Layout Routes

Create `foo.tsx` alongside `foo/` directory to wrap child routes:

```tsx
import { createFileRoute, Outlet } from '@tanstack/react-router'

export const Route = createFileRoute('/foo')({
  component: FooLayout,
})

function FooLayout() {
  return (
    <div>
      <Outlet />
    </div>
  )
}
```

## API Routes

Server handlers use `api.*.ts` naming convention:

```tsx
import { createFileRoute } from '@tanstack/react-router'

export const Route = createFileRoute('/demo/api/example')({
  server: {
    handlers: {
      POST: async ({ request }) => {
        const data = await request.json()
        return Response.json({ result: data })
      },
    },
  },
})
```

## AI Chat Integration

### Client Side

Use `@ai-sdk/react` with `DefaultChatTransport`:

```tsx
import { useChat } from '@ai-sdk/react'
import { DefaultChatTransport } from 'ai'

const { messages, sendMessage } = useChat({
  transport: new DefaultChatTransport({
    api: '/demo/api/chat',
  }),
})
```

### Server Side

Use `streamText` from `ai` package with OpenRouter provider:

```tsx
import { convertToModelMessages, streamText } from 'ai'
import { haiku } from '@/lib/openrouter'

const result = await streamText({
  model: haiku,
  messages: convertToModelMessages(messages),
  system: SYSTEM_PROMPT,
  tools,
})

return result.toUIMessageStreamResponse()
```

### OpenRouter Setup

Create provider singleton in `src/lib/openrouter.ts`:

```tsx
import { createOpenRouter } from '@openrouter/ai-sdk-provider'

export const openrouter = createOpenRouter({
  apiKey: process.env.OPENROUTER_API_KEY,
})

export const haiku = openrouter('anthropic/claude-3.5-haiku')
```

## MCP Server

Register tools with Zod schemas in route files:

```tsx
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
import z from 'zod'
import { handleMcpRequest } from '@/utils/mcp-handler'

const server = new McpServer({ name: 'my-server', version: '1.0.0' })

server.registerTool(
  'toolName',
  {
    title: 'Tool Title',
    description: 'Tool description',
    inputSchema: { param: z.string().describe('Param description') },
  },
  ({ param }) => ({
    content: [{ type: 'text', text: result }],
  }),
)

export const Route = createFileRoute('/mcp')({
  server: {
    handlers: {
      POST: async ({ request }) => handleMcpRequest(request, server),
    },
  },
})
```

## Path Aliases

`@/*` maps to `./src/*` (configured in tsconfig.json).

Related Skills

tanstack-query

16
from diegosouzapw/awesome-omni-skill

TanStack Query (React Query) for asynchronous server-state management with automatic caching, background refetching, optimistic updates, and pagination in React applications.

supastarter-nextjs-skill

16
from diegosouzapw/awesome-omni-skill

Guides development with supastarter for Next.js only (not Vue/Nuxt): tech stack, setup, configuration, database (Prisma), API (Hono/oRPC), auth (Better Auth), organizations, payments (Stripe), AI, customization, storage, mailing, i18n, SEO, deployment, background tasks, analytics, monitoring, E2E. Use when building or modifying supastarter Next.js apps, adding features, or when the user mentions supastarter Next.js, Prisma, oRPC, Better Auth, or related Next.js stack topics.

start

16
from diegosouzapw/awesome-omni-skill

Use when starting work on any task, when the user mentions metaswarm, or when the user wants to begin tracked development work

start-local

16
from diegosouzapw/awesome-omni-skill

Start local development environment with auto-detected services in a persistent tmux session

solidstart-websocket

16
from diegosouzapw/awesome-omni-skill

SolidStart WebSocket: experimental WebSocket endpoints, connection handling, message events, real-time communication, bidirectional data flow.

solidstart-api-routes

16
from diegosouzapw/awesome-omni-skill

SolidStart API routes: export GET/POST/PATCH/DELETE functions, handle APIEvent with request/params/fetch, GraphQL and tRPC integration, session management.

setup-tanstack-start

16
from diegosouzapw/awesome-omni-skill

Bootstrap a new web project with TanStack Start, React, Tailwind CSS v4, and shadcn/ui on top of the base tooling stack. Consult this skill whenever creating a web app, setting up a frontend project, starting a React application, or initializing anything involving TanStack Start, TanStack Router, TanStack Query, Tailwind, shadcn, or Vite.

session-start

16
from diegosouzapw/awesome-omni-skill

Initialize a new mission with role selection and persona naming

session-start-routine

16
from diegosouzapw/awesome-omni-skill

Execute work session initialization routine at conversation start. Identifies new skills, researches improvements for existing skills, and updates skill library. Triggers automatically at session start.

preferences-react-tanstack-ui-development

16
from diegosouzapw/awesome-omni-skill

React and TanStack UI development patterns including component design, routing, and state management. Load when working with React components or TanStack libraries.

nextjs-tanstack-form

16
from diegosouzapw/awesome-omni-skill

TanStack Form v1 for Next.js 16 with Server Actions, Zod validation, and shadcn/ui integration. Use when building forms, validation, multi-step wizards, or dynamic field arrays.

nextjs-supabase-starter

16
from diegosouzapw/awesome-omni-skill

Rules and best practices for building a Next.js starter app with Supabase (auth, profiles, RLS, declarative schemas, setup script). Use when working on Next.js + Supabase integration, authentication, migrations, or this starter app codebase.