Agent skill

Tanstack Router

by secondsky in secondsky/claude-skills

TanStack Router type-safe file-based routing for React. An agent skill from secondsky/claude-skills.

MITAuto-check: notesDevelopment

Install Tanstack Router

skills CLI
$ npx skills add secondsky/claude-skills --skill tanstack-router -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install secondsky/claude-skills tanstack-router --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/secondsky/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/tanstack-router/skills/tanstack-router .claude/skills/tanstack-router && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
tanstack-router
GitHub stars
227
Token cost
~1.9k tokens
SKILL.md length
367 words
Files
5 (incl. references)
Skills in repo
169
Repo updated
First seen
Licence
MIT

At a glance

TanStack Router type-safe file-based routing for React. An agent skill from secondsky/claude-skills.

  • Works in 3 steps: Type-Safe Navigation → Route Loaders (Data Fetching) → TanStack Query Integration
  • TanStack Query integration
  • SKILL.md covers When to Use This Skill, Quick Start, Key Features and Common Errors & Solutions, plus 6 more sections
  • Runs TypeScript scripts from its folder; calls bun

What it does

Tanstack Router is an agent skill from secondsky/claude-skills. TanStack Router type-safe file-based routing for React. Use for SPAs, TanStack Query integration, Cloudflare Workers, or encountering devtools, type safety, loader, Vite bundling errors.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 6 other files, including reference files (for example `references/common-errors.md`, `templates/package.json` and `templates/vite.config.ts`).

It sits in Development, covering Type safety. It works with TanStack, Vite, Cloudflare Workers and React. The repository describes itself as: Production-ready skills for Claude Code CLI - Cloudflare, React, Tailwind v4, and AI integrations. The licence is MIT.

When your agent uses it

  • TanStack Query integration
  • Cloudflare Workers
  • Encountering devtools
  • Vite bundling errors

Example prompts

  • “/tanstack-router”

Requirements

  • Node.js
  • Pre-approved tools (allowed-tools): Bash, Read, Write, Edit

Workflow steps

3 steps, taken from the step headings in SKILL.md.

  1. Type-Safe Navigation
  2. Route Loaders (Data Fetching)
  3. TanStack Query Integration

What it can do on your machine

Read from SKILL.md and the folder at commit 8837836. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash
    • Read
    • Write
    • Edit

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (TypeScript), which the agent can run.

    Shell commands in SKILL.md call:

    • bun

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Tanstack Router loads about 1.9k tokens when it runs, and up to ~2.4k if it reads all its reference files. Until then it costs about 51 tokens; SKILL.md has 367 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~51
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~2.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Bash, Read, Write, Edit

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from secondsky/claude-skills at commit 8837836, republished under its MIT licence (© secondsky). 367 words, ~1,888 tokens.

Download SKILL.mdSave it as .claude/skills/tanstack-router/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
tanstack-router
description
TanStack Router type-safe file-based routing for React. Use for SPAs, TanStack Query integration, Cloudflare Workers, or encountering devtools, type safety, loader, Vite bundling errors.
allowed-tools
Bash, Read, Write, Edit
license
MIT
metadata.version
1.0.0
metadata.author
Claude Skills Maintainers
metadata.last-verified
2026-08-03
metadata.production-tested
true
metadata.keywords
tanstack router, react router, type-safe routing, file-based routing, client-side routing, spa routing, route loaders, data loading, navigation, vite plugin…

TanStack Router Skill

Build type-safe, file-based routing for React SPAs with TanStack Router, optimized for Cloudflare Workers deployment.


When to Use This Skill

Auto-triggers when you mention:

  • "TanStack Router" or "type-safe routing"
  • "file-based routing" or "route configuration"
  • "React routing" with TypeScript emphasis
  • "route loaders" or "data loading in routes"
  • "Cloudflare Workers routing"

Use this skill when:

  • Building SPAs with type-safe navigation
  • Implementing file-based routing (like Next.js)
  • Need route-level data loading
  • Integrating routing with TanStack Query
  • Deploying to Cloudflare Workers
  • Want better TypeScript support than React Router

Quick Start

Installation
bash
bun add @tanstack/react-router @tanstack/router-devtools
bun add -d @tanstack/router-plugin

Latest version: v1.170.18 (verified 2026-08-03)

Vite Configuration
typescript
// vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { TanStackRouterVite } from '@tanstack/router-plugin/vite'

export default defineConfig({
  plugins: [
    TanStackRouterVite(), // MUST come before react()
    react(),
  ],
})
Basic Setup
typescript
// src/routes/__root.tsx
import { createRootRoute, Outlet } from '@tanstack/react-router'

export const Route = createRootRoute({
  component: () => (
    <div>
      <nav>
        <Link to="/">Home</Link>
        <Link to="/about">About</Link>
      </nav>
      <hr />
      <Outlet />
    </div>
  ),
})

// src/routes/index.tsx
import { createFileRoute } from '@tanstack/react-router'

export const Route = createFileRoute('/')({
  component: () => <h1>Home Page</h1>,
})

// src/routes/about.tsx
import { createFileRoute } from '@tanstack/react-router'

export const Route = createFileRoute('/about')({
  component: () => <h1>About Page</h1>,
})

// src/main.tsx
import { createRouter, RouterProvider } from '@tanstack/react-router'
import { routeTree } from './routeTree.gen' // Auto-generated

const router = createRouter({ routeTree })

function App() {
  return <RouterProvider router={router} />
}

Key Features

1. Type-Safe Navigation
typescript
// Fully typed!
<Link to="/posts/$postId" params={{ postId: '123' }} />

// TypeScript error if route doesn't exist
<Link to="/invalid-route" /> // ❌ Error!
2. Route Loaders (Data Fetching)
typescript
// src/routes/posts.$postId.tsx
export const Route = createFileRoute('/posts/$postId')({
  loader: async ({ params }) => {
    const post = await fetchPost(params.postId) // Fully typed!
    return { post }
  },
  component: ({ useLoaderData }) => {
    const { post } = useLoaderData()
    return <h1>{post.title}</h1>
  },
})
3. TanStack Query Integration
typescript
import { queryOptions } from '@tanstack/react-query'

const postQueryOptions = (postId: string) =>
  queryOptions({
    queryKey: ['posts', postId],
    queryFn: () => fetchPost(postId),
  })

export const Route = createFileRoute('/posts/$postId')({
  loader: ({ context: { queryClient }, params }) =>
    queryClient.ensureQueryData(postQueryOptions(params.postId)),
  component: () => {
    const { postId } = Route.useParams()
    const { data: post } = useQuery(postQueryOptions(postId))
    return <h1>{post.title}</h1>
  },
})

Common Errors & Solutions

Error 1: Devtools Dependency Resolution

Problem: Build fails with @tanstack/router-devtools-core not found.

Solution:

bash
bun add @tanstack/router-devtools
Error 2: Vite Plugin Order

Problem: Routes not auto-generated.

Solution: TanStackRouterVite MUST come before react():

typescript
plugins: [
  TanStackRouterVite(), // First!
  react(),
]
Error 3: Type Registration Missing

Problem: Link to not typed.

Solution:

typescript
// src/routeTree.gen.ts is auto-generated
// Import it in main.tsx to register types
import { routeTree } from './routeTree.gen'
Error 4: Loader Not Running

Problem: Loader function not called on navigation.

Solution: Ensure route exports Route:

typescript
export const Route = createFileRoute('/path')({ loader: ... })
Error 5: Memory Leak with Forms

Problem: Production crashes when using TanStack Form + Router.

Solution: This is a known issue (#5734). Workaround: Use React Hook Form instead, or wait for fix.


Cloudflare Workers Deployment

Vite Config
typescript
import { defineConfig } from 'vite'
import { TanStackRouterVite } from '@tanstack/router-plugin/vite'
import { cloudflare } from '@cloudflare/vite-plugin'

export default defineConfig({
  plugins: [
    TanStackRouterVite(),
    react(),
    cloudflare(),
  ],
})
API Backend Pattern
typescript
// functions/api/posts.ts
export async function onRequestGet({ env }) {
  const { results } = await env.DB.prepare('SELECT * FROM posts').all()
  return Response.json(results)
}

// Client-side route
export const Route = createFileRoute('/posts')({
  loader: async () => {
    const posts = await fetch('/api/posts').then(r => r.json())
    return { posts }
  },
})

Show full SKILL.md (157 more words)Show less

Templates

All templates in ~/.claude/skills/tanstack-router/templates/:

  1. package.json - Dependencies and versions
  2. vite.config.ts - Vite plugin setup
  3. basic-routes/ - File-based routing structure
  4. route-with-loader.tsx - Data loading example
  5. query-integration.tsx - TanStack Query pattern
  6. nested-routes/ - Layout pattern
  7. cloudflare-deployment.md - Workers setup guide

Reference Docs

Deep-dive guides in ~/.claude/skills/tanstack-router/references/:

  1. file-based-routing.md - Route structure conventions
  2. type-safety.md - TypeScript patterns
  3. data-loading.md - Loaders and TanStack Query
  4. cloudflare-workers.md - Deployment guide
  5. common-errors.md - All 7+ errors with solutions
  6. migration-guide.md - From React Router

Integration with Existing Skills

Works with:

  • tanstack-query - Recommended for data fetching
  • tanstack-table - Display data from routes
  • cloudflare-worker-base - API backend
  • tailwind-v4-shadcn - UI styling

Token Efficiency

Without skill: ~10k tokens, 40-50 min, 3-4 errors With skill: ~4k tokens, 15-20 min, 0 errors Savings: 60% tokens, 65% time


Production Validation

Tested with:

  • React 19.2, Vite 7.3, TypeScript 5.9
  • Cloudflare Workers (Wrangler 4.0)
  • TanStack Query v5.101.4

Stack compatibility:

  • ✅ Cloudflare Workers + Static Assets
  • ✅ TanStack Query integration
  • ✅ TypeScript strict mode

Last Updated: 2026-08-03 Library Version: @tanstack/react-router v1.170.18

© secondsky, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files (references) in plugins/tanstack-router/skills/tanstack-router of secondsky/claude-skills.

  • SKILL.md
  • references/common-errors.md
  • templates/package.json
  • templates/route-examples.tsx
  • templates/vite.config.ts

Open the folder on GitHubat commit 8837836

Compare with similar skills

Tanstack Router next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Tanstack Router compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Tanstack Router this skillsecondsky/claude-skills227—~1.9kAutomated safety check: NotesMIT
Wagmi Feature Developmentwevm/wagmi6.8k—~3.8kAutomated safety check: PassMIT
Cleanup Specialistahaodev/shadmin174—~1.3kAutomated safety check: PassMIT
Tanstack RouterMindrally/skills267—~1.9kAutomated safety check: PassApache-2.0
React Devdavila7/claude-code-templates32k2 repos~2.6kAutomated safety check: PassMIT
React Frontend Development Guidelinesdiet103/claude-code-infrastructure-showcase10k2 repos~2.9kAutomated safety check: PassMIT

Similar skills

  • Walks through adding a Wagmi feature across its layers: a Viem-based core action, TanStack Query options, and React and Vue bindings.

    6.8k GitHub stars~3.8k tokensUpdated 6 days ago
    DevelopmentAuto-check passed
  • Cleanup Specialist

    ahaodev/shadmin

    Safe cleanup of Shadmin's Go backend, React frontend, Go CLI, and docs — remove dead code, consolidate duplication, and improve maintainability without changing behavior or adding features.

    174 GitHub stars~1.3k tokensUpdated 6 days ago
    DevelopmentAuto-check passed
  • Tanstack Router

    Mindrally/skills

    Type-safe, file-based routing for React with TanStack Router.

    267 GitHub stars~1.9k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • React Dev

    davila7/claude-code-templates

    This skill should be used when building React components with TypeScript, typing hooks, handling events, or when React TypeScript, React 19, Server Components are mentioned.

    32k GitHub starsUsed in 2 repos~2.6k tokens
    Frontend & DesignAuto-check passed
  • React Frontend Development Guidelines

    diet103/claude-code-infrastructure-showcase

    Guidelines for React 18 and TypeScript apps covering Suspense data fetching, lazy loading, feature folders, MUI v7 styling, TanStack Router and performance.

    10k GitHub starsUsed in 2 repos~2.9k tokens
    Frontend & DesignAuto-check passed
  • Spiceflow

    remorses/spiceflow

    Spiceflow is a super simple, fast, and type-safe API and React Server Components framework for TypeScript.

    167 GitHub stars~1.9k tokensUpdated yesterday
    Backend & APIsAuto-check passed

More from secondsky/claude-skills

All 169 skills in this repo
  • Tanstack AI

    secondsky/claude-skills

    TanStack AI (alpha) provider-agnostic type-safe chat with streaming for OpenAI, Anthropic, Gemini, Ollama.

    227 GitHub starsUsed in 1 repo~3.6k tokens
    Auto-check: notes
  • Auto Animate

    secondsky/claude-skills

    AutoAnimate (@formkit/auto-animate) zero-config animations for React.

    227 GitHub stars~2.9k tokensUpdated 9 days ago
    Auto-check passed
  • Base UI React

    secondsky/claude-skills

    MUI Base UI unstyled React components with Floating UI. An agent skill from secondsky/claude-skills.

    227 GitHub stars~1.9k tokensUpdated 9 days ago
    Auto-check passed
  • Cloudflare Images

    secondsky/claude-skills

    This skill should be used when the user asks to "upload images to Cloudflare", "implement direct creator upload", "configure image transformations", "optimize WebP/AVIF", "create image variants"…

    227 GitHub stars~3.6k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Nextjs

    secondsky/claude-skills

    Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare).

    227 GitHub stars~5.3k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Sandbox

    secondsky/claude-skills

    Cloudflare Sandboxes SDK for secure code execution in Linux containers at edge.

    227 GitHub stars~4.5k tokensUpdated 9 days ago
    Auto-check passed

Categories

Questions about Tanstack Router

What does Tanstack Router do?

TanStack Router type-safe file-based routing for React. An agent skill from secondsky/claude-skills. Tanstack Router is an agent skill from secondsky/claude-skills. TanStack Router type-safe file-based routing for React.

When should I use Tanstack Router?

Tanstack Router fits situations like: tanStack Query integration; cloudflare Workers; encountering devtools; vite bundling errors.

How do I install Tanstack Router in Claude Code?

Run `npx skills add secondsky/claude-skills --skill tanstack-router -a claude-code`. Or copy the skill folder (plugins/tanstack-router/skills/tanstack-router in secondsky/claude-skills) into .claude/skills/tanstack-router in your project. Claude Code loads it when a task matches its description.

How do I install Tanstack Router in Codex?

Run `npx skills add secondsky/claude-skills --skill tanstack-router -a codex`. Or copy the skill folder (plugins/tanstack-router/skills/tanstack-router in secondsky/claude-skills) into .agents/skills/tanstack-router in your project. Codex loads it when a task matches its description.

Can I use Tanstack Router in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add secondsky/claude-skills --skill tanstack-router -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/tanstack-router, .gemini/skills/tanstack-router, .github/skills/tanstack-router and .opencode/skills/tanstack-router in your project.

What does Tanstack Router need to run?

Going by SKILL.md and its folder, Tanstack Router needs TypeScript for the scripts in its folder and the command-line tools its instructions call (bun). Our summary lists: Node.js. Its frontmatter pre-approves these tools: Bash, Read, Write, Edit.

Does Tanstack Router access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Tanstack Router safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Tanstack Router use?

Tanstack Router is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Tanstack Router use?

About 1.9k tokens (SKILL.md is roughly 7.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 468 tokens, read only when the agent opens those files.

What are the alternatives to Tanstack Router?

Skills that share tags, products or a category with Tanstack Router: Wagmi Feature Development (wevm/wagmi, 6.8k stars), Cleanup Specialist (ahaodev/shadmin, 174 stars), Tanstack Router (Mindrally/skills, 267 stars) and React Dev (davila7/claude-code-templates, 32k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Tanstack Router?

secondsky (a GitHub user) maintains it in secondsky/claude-skills, which has 227 GitHub stars. The repository holds 169 skills in this directory. The repository was last updated on September 28, 2026.

Source: secondsky/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.