tanstack-router

Configure type-safe TanStack Router routes with validated params and loaders.

3|Updated May 11, 2026
One-click install
npx skills add https://github.com/JeromyJSmith/lattice-platform --skill tanstack-router-jeromyjsmith
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tanstack-router
Source: https://github.com/JeromyJSmith/lattice-platform/tree/main/.agents/skills/skills/tanstack-router
Command: npx skills add https://github.com/JeromyJSmith/lattice-platform --skill tanstack-router-jeromyjsmith

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TanStack Router eliminates fragile, stringly-typed routing by providing end-to-end TypeScript inference for route params, validated search params, and loader-driven data fetching.

Core Features & Use Cases

  • Type-safe routing for React/Solid: Define route trees (including file-based routing) with strong typing for params, search, and loader data.
  • Validated search params & serialization: Enforce schemas (e.g., with Zod) so query string inputs become typed values.
  • Data loading and route lifecycle hooks: Use loaders, loaderDeps, and beforeLoad for predictable fetching, authentication guards, and cache/staleness control.

Quick Start

Use the tanstack-router skill to generate a file-based route like /posts that validates its page/search parameters, loads posts in a route loader, and renders the result in a strongly typed component.

Frequently Asked Questions about tanstack-router

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I get type-safe search params in React routing?

Type-safe search params in React routing are enforced by defining validation schemas within your route definitions, ensuring query string inputs become strongly typed values. This eliminates stringly-typed routing by serializing and validating inputs before they reach your components.

How do I set up file-based routing with validated route params in React?

File-based routing with validated route params is set up by integrating the router-cli to generate a route tree, then defining routes using createFileRoute. This configuration strictly types path parameters and validates them before the component renders.

What is the best way to load data before rendering a route in a React application?

The best way to load data before rendering a route is by using built-in loaders and beforeLoad hooks. These provide predictable fetching, authentication guards, and cache control via loaderDeps and staleTime before the component mounts.

Does TanStack Router work with Solid applications?

Yes, TanStack Router works with Solid applications to provide type-safe client-side routing. It supports nested route trees, file-based routing setups, and strongly typed params, search parameters, and loader data for both React and Solid.

How do I enforce authentication guards during React navigation?

Authentication guards during React navigation are enforced using the beforeLoad route lifecycle hook. This allows you to intercept navigation, verify user sessions, and control access predictably before the target route component loads.

Why use validated search params instead of standard string queries in React routing?

Validated search params replace standard string queries to provide end-to-end TypeScript inference and enforce schemas, preventing runtime errors from malformed data. This ensures query string inputs become predictable, typed values before reaching application components.