Agent skill

Tanstack Router

by blencorp in blencorp/claude-code-kit

TanStack Router file-based routing patterns including route creation, navigation, loaders, type-safe routing, and lazy loading.

MITAuto-check passedDevelopment

Install Tanstack Router

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

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

GitHub CLI
$ gh skill install blencorp/claude-code-kit 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/blencorp/claude-code-kit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/cli/kits/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
106
Token cost
~2.4k tokens
SKILL.md length
125 words
Files
5
Skills in repo
11
Repo updated
First seen
Licence
MIT

At a glance

TanStack Router file-based routing patterns including route creation, navigation, loaders, type-safe routing, and lazy loading.

  • Works in 3 steps: Use Loaders for Data → Lazy Load Heavy Routes → Type-Safe Navigation
  • Creating routes
  • SKILL.md covers Purpose, When to Use This Skill, Quick Start and File-Based Routing, plus 8 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Tanstack Router is an agent skill from blencorp/claude-code-kit. TanStack Router file-based routing patterns including route creation, navigation, loaders, type-safe routing, and lazy loading. Use when creating routes, implementing navigation, or working with TanStack Router.

Its SKILL.md is about 2.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 5 other files (for example `resources/navigation-patterns.md`, `resources/route-loaders.md` and `resources/routing-guide.md`).

It sits in Development, covering Type safety and Web performance. It works with TanStack. The repository describes itself as: Claude Code infrastructure with auto-activating skills and framework-specific kits. Install complete Claude Code infrastructure in 30 seconds with automatic framework detection… The licence is MIT.

When your agent uses it

  • Creating routes
  • Implementing navigation
  • Working with TanStack Router

Example prompts

  • “/tanstack-router”

Workflow steps

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

  1. Use Loaders for Data
  2. Lazy Load Heavy Routes
  3. Type-Safe Navigation

What it can do on your machine

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

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    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 2.4k tokens when it runs. Until then it costs about 57 tokens; SKILL.md has 125 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~57
When it runs · the whole SKILL.md, loaded when a task matches
~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 passed

The automated check found no risky patterns in SKILL.md.

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 blencorp/claude-code-kit at commit d1b17ed, republished under its MIT licence (© blencorp). 125 words, ~2,387 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 file-based routing patterns including route creation, navigation, loaders, type-safe routing, and lazy loading. Use when creating routes, implementing navigation, or working with TanStack Router.

TanStack Router Patterns

Purpose

File-based routing with TanStack Router, emphasizing type-safe navigation, route loaders, and lazy loading.

When to Use This Skill

  • Creating new routes
  • Implementing navigation
  • Using route loaders for data
  • Type-safe routing with parameters
  • Lazy loading routes

Quick Start

Basic Route
typescript
// routes/posts/index.tsx
import { createFileRoute } from '@tanstack/react-router';
import { postsApi } from '~/features/posts/api/postsApi';

export const Route = createFileRoute('/posts')({
  loader: async () => {
    const posts = await postsApi.getAll();
    return { posts };
  },
  component: PostsPage,
});

function PostsPage() {
  const { posts } = Route.useLoaderData();

  return (
    <div>
      <h1>Posts</h1>
      {posts.map(post => (
        <PostCard key={post.id} post={post} />
      ))}
    </div>
  );
}

File-Based Routing

Directory Structure
routes/
├── __root.tsx          # Root route
├── index.tsx           # /
├── about.tsx           # /about
├── posts/
│   ├── index.tsx       # /posts
│   └── $postId.tsx     # /posts/:postId
└── users/
    ├── index.tsx       # /users
    └── $userId/
        ├── index.tsx   # /users/:userId
        └── posts.tsx   # /users/:userId/posts
Route Mapping
File Path                        → URL Path
routes/index.tsx                 → /
routes/about.tsx                 → /about
routes/posts/index.tsx           → /posts
routes/posts/$postId.tsx         → /posts/:postId
routes/users/$userId/index.tsx   → /users/:userId
routes/users/$userId/posts.tsx   → /users/:userId/posts

Route Parameters

Dynamic Routes
typescript
// routes/posts/$postId.tsx
import { createFileRoute } from '@tanstack/react-router';
import { postsApi } from '~/features/posts/api/postsApi';

export const Route = createFileRoute('/posts/$postId')({
  loader: async ({ params }) => {
    const post = await postsApi.get(params.postId);
    return { post };
  },
  component: PostDetails,
});

function PostDetails() {
  const { post } = Route.useLoaderData();
  const { postId } = Route.useParams();

  return (
    <div>
      <h1>{post.title}</h1>
      <p>{post.content}</p>
    </div>
  );
}
Multiple Parameters
typescript
// routes/users/$userId/posts/$postId.tsx
export const Route = createFileRoute('/users/$userId/posts/$postId')({
  loader: async ({ params }) => {
    const { userId, postId } = params;
    const post = await postsApi.getByUserAndId(userId, postId);
    return { post };
  },
  component: UserPostDetails,
});

Route Loaders

Basic Loader
typescript
export const Route = createFileRoute('/posts')({
  loader: async () => {
    const posts = await postsApi.getAll();
    return { posts };
  },
  component: PostsPage,
});
Loader with Dependencies
typescript
export const Route = createFileRoute('/users/$userId/posts')({
  loader: async ({ params, context }) => {
    const [user, posts] = await Promise.all([
      userApi.get(params.userId),
      postsApi.getByUser(params.userId),
    ]);
    return { user, posts };
  },
  component: UserPosts,
});
Loader Error Handling
typescript
export const Route = createFileRoute('/posts/$postId')({
  loader: async ({ params }) => {
    try {
      const post = await postsApi.get(params.postId);
      return { post, error: null };
    } catch (error) {
      return { post: null, error: 'Post not found' };
    }
  },
  component: PostDetails,
});

function PostDetails() {
  const { post, error } = Route.useLoaderData();

  if (error) return <Error message={error} />;
  return <div>{post.title}</div>;
}

Navigation

typescript
import { Link, useNavigate } from '@tanstack/react-router';

// Link component
<Link to="/posts/$postId" params={{ postId: '123' }}>View Post</Link>

// Programmatic navigation
const navigate = useNavigate();
navigate({ to: '/posts', search: { filter: 'published' } });

Lazy Loading

Lazy Route Component
typescript
// routes/posts/index.tsx
import { createFileRoute } from '@tanstack/react-router';
import { lazy } from 'react';

const PostsPage = lazy(() => import('~/features/posts/PostsPage'));

export const Route = createFileRoute('/posts')({
  component: PostsPage,
});
Lazy Loader
typescript
export const Route = createFileRoute('/posts')({
  loader: async () => {
    // Dynamically import heavy module only when route loads
    const { processData } = await import('~/lib/heavyModule');
    const posts = await postsApi.getAll();
    const processed = processData(posts);
    return { posts: processed };
  },
  component: PostsPage,
});

Search Params

Type-Safe Search Params
typescript
import { z } from 'zod';

const postsSearchSchema = z.object({
  filter: z.enum(['all', 'published', 'draft']).default('all'),
  sort: z.enum(['date', 'title']).default('date'),
  page: z.number().default(1),
});

export const Route = createFileRoute('/posts')({
  validateSearch: postsSearchSchema,
  loader: async ({ search }) => {
    const posts = await postsApi.getAll(search);
    return { posts };
  },
  component: PostsPage,
});

function PostsPage() {
  const { posts } = Route.useLoaderData();
  const search = Route.useSearch();

  return (
    <div>
      <p>Filter: {search.filter}</p>
      <p>Sort: {search.sort}</p>
      <p>Page: {search.page}</p>
    </div>
  );
}
Updating Search Params
typescript
import { useNavigate } from '@tanstack/react-router';

function FilterButtons() {
  const navigate = useNavigate();
  const search = Route.useSearch();

  const setFilter = (filter: string) => {
    navigate({
      to: '.',
      search: (prev) => ({ ...prev, filter }),
    });
  };

  return (
    <div>
      <button onClick={() => setFilter('all')}>All</button>
      <button onClick={() => setFilter('published')}>Published</button>
      <button onClick={() => setFilter('draft')}>Draft</button>
    </div>
  );
}

Layouts

Root Layout
typescript
// routes/__root.tsx
import { createRootRoute, Outlet } from '@tanstack/react-router';

export const Route = createRootRoute({
  component: RootLayout,
});

function RootLayout() {
  return (
    <div>
      <Header />
      <main>
        <Outlet />  {/* Child routes render here */}
      </main>
      <Footer />
    </div>
  );
}
Nested Layouts
typescript
// routes/dashboard.tsx
export const Route = createFileRoute('/dashboard')({
  component: DashboardLayout,
});

function DashboardLayout() {
  return (
    <div className="dashboard">
      <Sidebar />
      <div className="content">
        <Outlet />  {/* Dashboard child routes */}
      </div>
    </div>
  );
}

// routes/dashboard/index.tsx
export const Route = createFileRoute('/dashboard')({
  component: DashboardHome,
});

// routes/dashboard/analytics.tsx
export const Route = createFileRoute('/dashboard/analytics')({
  component: Analytics,
});

Route Guards

Authentication Guard
typescript
export const Route = createFileRoute('/admin')({
  beforeLoad: async ({ context }) => {
    if (!context.auth.isAuthenticated) {
      throw redirect({
        to: '/login',
        search: { redirect: '/admin' },
      });
    }
  },
  component: AdminPage,
});
Permission Guard
typescript
export const Route = createFileRoute('/admin/users')({
  beforeLoad: async ({ context }) => {
    if (!context.auth.hasPermission('users:manage')) {
      throw redirect({ to: '/unauthorized' });
    }
  },
  component: UsersPage,
});

Breadcrumbs

Route Breadcrumbs
typescript
export const Route = createFileRoute('/posts/$postId')({
  loader: async ({ params }) => {
    const post = await postsApi.get(params.postId);
    return { post };
  },
  meta: ({ loaderData }) => [
    { title: 'Home', path: '/' },
    { title: 'Posts', path: '/posts' },
    { title: loaderData.post.title, path: `/posts/${loaderData.post.id}` },
  ],
  component: PostDetails,
});

Best Practices

1. Use Loaders for Data
typescript
// ✅ Good: Loader fetches data
export const Route = createFileRoute('/posts')({
  loader: async () => {
    const posts = await postsApi.getAll();
    return { posts };
  },
  component: PostsPage,
});

// ❌ Avoid: Fetching in component
function PostsPage() {
  const [posts, setPosts] = useState([]);

  useEffect(() => {
    postsApi.getAll().then(setPosts);
  }, []);

  return <div>...</div>;
}
2. Lazy Load Heavy Routes
typescript
// ✅ Good: Lazy load admin panel
const AdminPanel = lazy(() => import('~/features/admin/AdminPanel'));

export const Route = createFileRoute('/admin')({
  component: AdminPanel,
});
3. Type-Safe Navigation
typescript
// ✅ Good: Type-safe Link
<Link to="/posts/$postId" params={{ postId: post.id }}>
  View Post
</Link>

// ❌ Avoid: String concatenation
<a href={`/posts/${post.id}`}>View Post</a>

Additional Resources

For more patterns, see:

© blencorp, 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 in cli/kits/tanstack-router/skills/tanstack-router of blencorp/claude-code-kit.

  • SKILL.md
  • resources/navigation-patterns.md
  • resources/route-loaders.md
  • resources/routing-guide.md
  • skill-rules-fragment.json

Open the folder on GitHubat commit d1b17ed

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 skillblencorp/claude-code-kit106—~2.4kAutomated safety check: PassMIT
React Frontend Development Guidelinesdiet103/claude-code-infrastructure-showcase10k2 repos~2.9kAutomated safety check: PassMIT
Wagmi Feature Developmentwevm/wagmi6.8k—~3.8kAutomated safety check: PassMIT
Tanstack RouterMindrally/skills268—~1.9kAutomated safety check: PassApache-2.0
Tanstack Router Best PracticesDeckardGer/tanstack-agent-skills222—~1.1kAutomated safety check: PassMIT
Tanstack Routerbskimball/tanstack-hono119—~4.4kAutomated safety check: PassMIT

Similar skills

  • 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
  • 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
  • Tanstack Router

    Mindrally/skills

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

    268 GitHub stars~1.9k tokensUpdated 1 mo ago
    DevelopmentAuto-check passed
  • Tanstack Router Best Practices

    DeckardGer/tanstack-agent-skills

    TanStack Router best practices for type-safe routing, data loading, search params, and navigation.

    222 GitHub stars~1.1k tokensUpdated 28 days ago
    DevelopmentAuto-check passed
  • Tanstack Router

    bskimball/tanstack-hono

    Type-safe routing for React and Solid applications with first-class search params, data loading, and seamless integration with the React ecosystem.

    119 GitHub stars~4.4k tokensUpdated 26 days 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

More from blencorp/claude-code-kit

All 11 skills in this repo
  • Mui

    blencorp/claude-code-kit

    Material-UI v7 component library patterns including sx prop styling, theme integration, responsive design, and MUI-specific hooks.

    106 GitHub starsUsed in 2 repos~2.4k tokens
    Auto-check passed
  • Express

    blencorp/claude-code-kit

    Express.js framework patterns including routing, middleware, request/response handling, and Express-specific APIs.

    106 GitHub stars~2.7k tokensUpdated 10 mo ago
    Auto-check passed
  • Nextjs

    blencorp/claude-code-kit

    Next.js 15+ App Router development patterns including Server Components, Client Components, data fetching, layouts, and server actions.

    106 GitHub stars~2.6k tokensUpdated 10 mo ago
    Auto-check passed
  • Nodejs

    blencorp/claude-code-kit

    Core Node.js backend patterns for TypeScript applications including async/await error handling, middleware concepts, configuration management, testing strategies, and layered architecture principles.

    106 GitHub stars~2.6k tokensUpdated 10 mo ago
    Auto-check passed
  • Prisma

    blencorp/claude-code-kit

    Prisma ORM patterns including Prisma Client usage, queries, mutations, relations, transactions, and schema management.

    106 GitHub stars~2.7k tokensUpdated 10 mo ago
    Auto-check passed
  • React

    blencorp/claude-code-kit

    Core React 19 patterns including hooks, Suspense, lazy loading, component structure, TypeScript best practices, and performance optimization.

    106 GitHub stars~2.5k tokensUpdated 10 mo ago
    Auto-check passed

Works with

Questions about Tanstack Router

What does Tanstack Router do?

TanStack Router file-based routing patterns including route creation, navigation, loaders, type-safe routing, and lazy loading. Tanstack Router is an agent skill from blencorp/claude-code-kit. TanStack Router file-based routing patterns including route creation, navigation, loaders, type-safe routing, and lazy loading.

When should I use Tanstack Router?

Tanstack Router fits situations like: creating routes; implementing navigation; working with TanStack Router.

How do I install Tanstack Router in Claude Code?

Run `npx skills add blencorp/claude-code-kit --skill tanstack-router -a claude-code`. Or copy the skill folder (cli/kits/tanstack-router/skills/tanstack-router in blencorp/claude-code-kit) 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 blencorp/claude-code-kit --skill tanstack-router -a codex`. Or copy the skill folder (cli/kits/tanstack-router/skills/tanstack-router in blencorp/claude-code-kit) 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 blencorp/claude-code-kit --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?

SKILL.md names no scripts, command-line tools or credentials: Tanstack Router is instructions for the agent only.

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 no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Tanstack Router use?

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

How many tokens does Tanstack Router use?

About 2.4k tokens (SKILL.md is roughly 9.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Tanstack Router?

Skills that share tags, products or a category with Tanstack Router: React Frontend Development Guidelines (diet103/claude-code-infrastructure-showcase, 10k stars), Wagmi Feature Development (wevm/wagmi, 6.8k stars), Tanstack Router (Mindrally/skills, 268 stars) and Tanstack Router Best Practices (DeckardGer/tanstack-agent-skills, 222 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Tanstack Router?

blencorp (a GitHub organization) maintains it in blencorp/claude-code-kit, which has 106 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on November 28, 2025.

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