tanstack-router

Provide type-safe routing and integrated data loading for React and Solid apps.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/SeanChenR/maestro-agent --skill tanstack-router-seanchenr
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: tanstack-router
Source: https://github.com/SeanChenR/maestro-agent/tree/main/.agents/skills/tanstack-router
Command: npx skills add https://github.com/SeanChenR/maestro-agent --skill tanstack-router-seanchenr

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TanStack Router removes the complexity and fragility of managing route definitions, navigation state, and data fetching across React and Solid single-page applications by providing a unified, type-safe routing system that prevents mismatched params, unvalidated search state, and ad-hoc data loading patterns.

Core Features & Use Cases

  • Type-safe route trees and params: Strong TypeScript inference for route params, search schemas, loader data, and route context to eliminate runtime mismatches.
  • First-class search params and validation: Declarative search param schemas and helpers for reading and updating query state robustly.
  • Route-level data loading and caching: Built-in loaders, loaderDeps, deferred loading, and integration points with TanStack Query for consistent cache behavior and code splitting.
  • Use Case: Build a blog or dashboard where the posts list is loaded and cached at the route level, pagination and filters are validated as search params, and each post details page uses a dynamic param with guarded access and lazy-loaded UI.

Quick Start

Generate a file-based TanStack Router setup for a React app with a root layout, a posts list route that validates search params and uses a loader, and a dynamic post details route protected by a beforeLoad authentication check.

Frequently Asked Questions about tanstack-router

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

FAQPage Schema
How do I add type-safe routing with validated search params in React?▼

Type-safe routing with validated search params in React is achieved by defining declarative search param schemas that provide strong TypeScript inference and robust query state validation. This prevents unvalidated search state and runtime mismatches across your route trees.

How do I set up file-based routing with route-level loaders in a React single-page app?▼

File-based routing with route-level loaders is set up by generating a route tree with integrated data loading, loaderDeps, and deferred loading. This ensures consistent data fetching and cache behavior directly at the route level for your single-page app.

Can I use TanStack Router for code splitting and data caching in Solid applications?▼

Yes, you can use TanStack Router for code splitting and data caching in Solid applications. It provides route-level data loading, lazy-loaded UI integration, and direct integration points with TanStack Query to maintain consistent cache behavior.

What is the best way to manage navigation state and prevent mismatched route params?▼

The best way to manage navigation state and prevent mismatched route params is using a unified, type-safe routing system. Strong TypeScript inference for route params, search schemas, and route context eliminates ad-hoc patterns and runtime fragility.

How do I protect a dynamic route with an authentication check before loading data?▼

Protecting a dynamic route with an authentication check before loading data is handled using a beforeLoad guard. This intercepts navigation to verify access control before executing route-level loaders and rendering lazy-loaded UI components.