Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

react-tanstack-router

БесплатноБез исполняемых скриптовНе проверен

Use when implementing routing in a React app (NOT Next.js) with TanStack Router — file-based routes, loaders, search params.

Fusengineот Fusengine★ 36 звёзд на GitHub

Об этом скилле

Implements TanStack Router for React SPAs (Vite/Webpack/Rspack, not Next.js): file-based routing with auto-generated type safety, dynamic route params (`$postId`), search-params validation with Zod/Valibot, loaders (`Route.useLoaderData()`) integrated with TanStack Query (`ensureQueryData`), nested layouts with `Outlet`, route context for dependency injection, protected routes via `beforeLoad` guards, and preloading on intent/render.

Covers the full SOLID module structure (modules/cores/lib/router/, feature modules with interfaces//queries//components/), migration from React Router (useParams()→Route.useParams(), loader→loader option), and error boundaries/404 handling. Does not cover state management (react-state) or forms (react-forms) — those are separate skills; for Next.js routing use the App Router (nextjs-16), not this skill.

TanStack Router

100% type-safe router for React with file-based routing, loaders, search params validation, and deep TanStack Query integration.

Agent Workflow (MANDATORY)

Before ANY implementation, spawn 3 agents in parallel, one Agent call each with a name:

  1. fuse-ai-pilot:explore-codebase - Analyze existing routes and navigation patterns
  2. fuse-ai-pilot:research-expert - Verify latest TanStack Router docs via Context7/Exa
  3. mcp__context7__query-docs - Check file-based routing and type-safe patterns

After implementation, run fuse-ai-pilot:sniper for validation.


Overview

Why TanStack Router?

TanStack Router is the recommended choice for React SPAs requiring type-safe routing with search params validation.

Feature TanStack Router React Router v7
Type Safety Full inference Auto-generated
File-based Routing Built-in Framework mode
Search Params Validation Zod, Valibot Manual
Preloading Intent, render Limited
TanStack Query Integration Native Manual

When to Use


Critical Rules

  1. ALWAYS use file-based routing - Auto-generated type safety → file-based-routing.md
  2. ALWAYS validate search params - Pass the Zod v4 schema directly to validateSearch (zodValidator only for Zod v3) → search-params.md
  3. ALWAYS use Route.useLoaderData() - Not global useLoaderData → hooks.md
  4. ALWAYS register router types - declare module '@tanstack/react-router' → typescript.md
  5. PREFER loaders over useEffect - Data fetching before render → loaders.md
  6. INTEGRATE TanStack Query - For caching, mutations, optimistic updates → tanstack-query.md
  7. FOLLOW SOLID architecture - Modules, interfaces, file size limits → solid-react skill

Quick Reference: What to Read

Starting a new project

  1. Read installation.md for configuration
  2. Copy template basic-setup.md as base

Creating a feature module (posts, users, etc.)

  1. Follow architecture in templates/feature-module.md
  2. Use patterns from tanstack-query.md for queries

Implementing authentication

  1. Read auth-guards.md for concepts
  2. Copy template auth-protected-routes.md

Creating a page with filters/search

  1. Read search-params.md for Zod validation
  2. Copy template search-filters.md

Creating a dashboard with nested layouts

  1. Read nested-routes.md for concepts
  2. Copy template dashboard-layout.md

Project Structure (SOLID Architecture)

Recommended structure following SOLID principles from solid-react skill.

src/
├── modules/
│   ├── cores/                      # Shared between features
│   │   ├── lib/
│   │   │   ├── router/router.ts    # Router configuration
│   │   │   └── query/client.ts     # QueryClient configuration
│   │   ├── components/layouts/     # Shared layouts
│   │   └── interfaces/             # Shared types
│   └── [feature]/                  # Feature module
│       ├── src/
│       │   ├── interfaces/         # Module types
│       │   ├── queries/            # TanStack Query options
│       │
Полный SKILL.md на GitHub

Установить react-tanstack-router в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/auth-guards.mdreferences/code-splitting.mdreferences/components.mdreferences/devtools.mdreferences/error-handling.mdreferences/file-based-routing.mdreferences/hooks.mdreferences/installation.mdreferences/loaders.mdreferences/navigation.mdreferences/nested-routes.mdreferences/preloading.mdreferences/route-context.mdreferences/route-params.mdreferences/search-params.mdreferences/ssr.mdreferences/tanstack-query.mdreferences/templates/auth-protected-routes.mdreferences/templates/basic-setup.mdreferences/templates/dashboard-layout.mdreferences/templates/feature-module.mdreferences/templates/search-filters.mdreferences/typescript.md

FAQ

Что делает скилл react-tanstack-router?

Use when implementing routing in a React app (NOT Next.js) with TanStack Router — file-based routes, loaders, search params.

Как установить скилл react-tanstack-router?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл react-tanstack-router запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить react-tanstack-router с