Agent skill

Tanstack Router Best Practices

by DeckardGer in DeckardGer/tanstack-agent-skills

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

MITAuto-check passedDevelopment

Install Tanstack Router Best Practices

skills CLI
$ npx skills add DeckardGer/tanstack-agent-skills --skill tanstack-router-best-practices -a claude-code

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

GitHub CLI
$ gh skill install DeckardGer/tanstack-agent-skills tanstack-router-best-practices --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/DeckardGer/tanstack-agent-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/tanstack-router .claude/skills/tanstack-router-best-practices && 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-best-practices
GitHub stars
222
Token cost
~1.1k tokens
SKILL.md length
453 words
Files
37
Skills in repo
4
Repo updated
First seen
Licence
MIT

At a glance

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

  • Works in 4 steps: Explanation — Why this pattern matters → Bad Example — Anti-pattern to avoid → Good Example — Recommended implementation → …
  • Tasks that involve Type safety
  • SKILL.md covers When to Apply, Rule Categories by Priority, Quick Reference and How to Use, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Tanstack Router Best Practices is an agent skill from DeckardGer/tanstack-agent-skills. TanStack Router best practices for type-safe routing, data loading, search params, and navigation. Activate when building React applications with complex routing needs.

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 37 other files (for example `rules/ctx-before-load.md`, `rules/ctx-dependency-injection.md` and `rules/ctx-root-context.md`).

It sits in Development, covering Type safety. It works with TanStack and React. The repository describes itself as: TanStack Agent Skills: Best practices for TanStack Query, Router, and Start for AI coding agents. The licence is MIT.

When your agent uses it

  • Tasks that involve Type safety

Example prompts

  • “/tanstack-router-best-practices”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Explanation — Why this pattern matters
  2. Bad Example — Anti-pattern to avoid
  3. Good Example — Recommended implementation
  4. Context — When to apply or skip this rule

What it can do on your machine

Read from SKILL.md and the folder at commit b2fc14c. 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.

    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 Best Practices loads about 1.1k tokens when it runs. Until then it costs about 50 tokens; SKILL.md has 453 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~50
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k

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 DeckardGer/tanstack-agent-skills at commit b2fc14c, republished under its MIT licence (© DeckardGer). 453 words, ~1,125 tokens.

Download SKILL.mdSave it as .claude/skills/tanstack-router-best-practices/SKILL.md (or your agent's skills folder). This skill also uses 36 other files; get the full folder from GitHub.
name
tanstack-router-best-practices
description
TanStack Router best practices for type-safe routing, data loading, search params, and navigation. Activate when building React applications with complex routing needs.

TanStack Router Best Practices

Comprehensive guidelines for implementing TanStack Router patterns in React applications. These rules optimize type safety, data loading, navigation, and code organization.

When to Apply

  • Setting up application routing
  • Creating new routes and layouts
  • Implementing search parameter handling
  • Configuring data loaders
  • Setting up code splitting
  • Integrating with TanStack Query
  • Refactoring navigation patterns

Rule Categories by Priority

PriorityCategoryRulesImpact
CRITICALType Safety4 rulesPrevents runtime errors and enables refactoring
CRITICALRoute Organization5 rulesEnsures maintainable route structure
HIGHRouter Config1 ruleGlobal router defaults
HIGHData Loading6 rulesOptimizes data fetching and caching
HIGHSearch Params5 rulesEnables type-safe URL state
HIGHError Handling1 ruleHandles 404 and errors gracefully
MEDIUMNavigation5 rulesImproves UX and accessibility
MEDIUMCode Splitting3 rulesReduces bundle size
MEDIUMPreloading3 rulesImproves perceived performance
LOWRoute Context3 rulesEnables dependency injection

Quick Reference

Type Safety (Prefix: ts-)
  • ts-register-router — Register router type for global inference
  • ts-use-from-param — Use from parameter for type narrowing
  • ts-route-context-typing — Type route context with createRootRouteWithContext
  • ts-query-options-loader — Use queryOptions in loaders for type inference
Router Config (Prefix: router-)
  • router-default-options — Configure router defaults (scrollRestoration, defaultErrorComponent, etc.)
Route Organization (Prefix: org-)
  • org-file-based-routing — Prefer file-based routing for conventions
  • org-route-tree-structure — Follow hierarchical route tree patterns
  • org-pathless-layouts — Use pathless routes for shared layouts
  • org-index-routes — Understand index vs layout routes
  • org-virtual-routes — Understand virtual file routes
Data Loading (Prefix: load-)
  • load-use-loaders — Use route loaders for data fetching
  • load-loader-deps — Define loaderDeps for cache control
  • load-ensure-query-data — Use ensureQueryData with TanStack Query
  • load-deferred-data — Split critical and non-critical data
  • load-error-handling — Handle loader errors appropriately
  • load-parallel — Leverage parallel route loading
Show full SKILL.md (184 more words)Show less
  • search-validation — Always validate search params
  • search-type-inheritance — Leverage parent search param types
  • search-middleware — Use search param middleware
  • search-defaults — Provide sensible defaults
  • search-custom-serializer — Configure custom search param serializers
Error Handling (Prefix: err-)
  • err-not-found — Handle not-found routes properly
Navigation (Prefix: nav-)
  • nav-link-component — Prefer Link component for navigation
  • nav-active-states — Configure active link states
  • nav-use-navigate — Use useNavigate for programmatic navigation
  • nav-relative-paths — Understand relative path navigation
  • nav-route-masks — Use route masks for modal URLs
Code Splitting (Prefix: split-)
  • split-lazy-routes — Use .lazy.tsx for code splitting
  • split-critical-path — Keep critical config in main route file
  • split-auto-splitting — Enable autoCodeSplitting when possible
Preloading (Prefix: preload-)
  • preload-intent — Enable intent-based preloading
  • preload-stale-time — Configure preload stale time
  • preload-manual — Use manual preloading strategically
Route Context (Prefix: ctx-)
  • ctx-root-context — Define context at root route
  • ctx-before-load — Extend context in beforeLoad
  • ctx-dependency-injection — Use context for dependency injection

How to Use

Each rule file in the rules/ directory contains:

  1. Explanation — Why this pattern matters
  2. Bad Example — Anti-pattern to avoid
  3. Good Example — Recommended implementation
  4. Context — When to apply or skip this rule

Full Reference

See individual rule files in rules/ directory for detailed guidance and code examples.

© DeckardGer, 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 36 other files in skills/tanstack-router of DeckardGer/tanstack-agent-skills.

  • SKILL.md
  • rules/ctx-before-load.md
  • rules/ctx-dependency-injection.md
  • rules/ctx-root-context.md
  • rules/err-not-found.md
  • rules/load-deferred-data.md
  • rules/load-ensure-query-data.md
  • rules/load-error-handling.md
  • rules/load-loader-deps.md
  • rules/load-parallel.md
  • rules/load-use-loaders.md
  • rules/nav-active-states.md
  • rules/nav-link-component.md
  • rules/nav-relative-paths.md
  • rules/nav-route-masks.md
  • rules/nav-use-navigate.md
  • rules/org-file-based-routing.md
  • rules/org-index-routes.md
  • rules/org-pathless-layouts.md
  • rules/org-route-tree-structure.md
  • … and 17 more

Open the folder on GitHubat commit b2fc14c

Compare with similar skills

Tanstack Router Best Practices 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 Best Practices compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Tanstack Router Best Practices this skillDeckardGer/tanstack-agent-skills222—~1.1kAutomated safety check: PassMIT
Wagmi Feature Developmentwevm/wagmi6.8k—~3.8kAutomated safety check: PassMIT
Tanstack Routerbskimball/tanstack-hono119—~4.4kAutomated safety check: PassMIT
Tanstack Routersecondsky/claude-skills227—~1.9kAutomated safety check: NotesMIT
Tanstack RouterMindrally/skills267—~1.9kAutomated safety check: PassApache-2.0
Olore Tanstack Router Latestolorehq/olore103—~477Automated 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
  • 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
  • Tanstack Router

    secondsky/claude-skills

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

    227 GitHub stars~1.9k tokensUpdated 9 days ago
    DevelopmentAuto-check: notes
  • 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
  • Local TanStack Router documentation reference (latest). An agent skill from olorehq/olore.

    103 GitHub stars~477 tokensUpdated today
    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 DeckardGer/tanstack-agent-skills

  • Tanstack Query Best Practices

    DeckardGer/tanstack-agent-skills

    TanStack Query (React Query) best practices for data fetching, caching, mutations, and server state management.

    222 GitHub starsUsed in 1 repo~1.2k tokens
    Auto-check passed
  • Tanstack Start Best Practices

    DeckardGer/tanstack-agent-skills

    TanStack Start best practices for full-stack React applications.

    222 GitHub stars~1k tokensUpdated 28 days ago
    Auto-check passed
  • Tanstack Integration Best Practices

    DeckardGer/tanstack-agent-skills

    Best practices for integrating TanStack Query with TanStack Router and TanStack Start.

    222 GitHub stars~644 tokensUpdated 28 days ago
    Auto-check passed

Works with

Categories

Questions about Tanstack Router Best Practices

What does Tanstack Router Best Practices do?

TanStack Router best practices for type-safe routing, data loading, search params, and navigation. Tanstack Router Best Practices is an agent skill from DeckardGer/tanstack-agent-skills. TanStack Router best practices for type-safe routing, data loading, search params, and navigation.

When should I use Tanstack Router Best Practices?

Tanstack Router Best Practices fits situations like: tasks that involve Type safety.

How do I install Tanstack Router Best Practices in Claude Code?

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

How do I install Tanstack Router Best Practices in Codex?

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

Can I use Tanstack Router Best Practices 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 DeckardGer/tanstack-agent-skills --skill tanstack-router-best-practices -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-best-practices, .gemini/skills/tanstack-router-best-practices, .github/skills/tanstack-router-best-practices and .opencode/skills/tanstack-router-best-practices in your project.

What does Tanstack Router Best Practices need to run?

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

Does Tanstack Router Best Practices 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 Best Practices 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 Best Practices use?

Tanstack Router Best Practices 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 Best Practices use?

About 1.1k tokens (SKILL.md is roughly 4.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 Best Practices?

Skills that share tags, products or a category with Tanstack Router Best Practices: Wagmi Feature Development (wevm/wagmi, 6.8k stars), Tanstack Router (bskimball/tanstack-hono, 119 stars), Tanstack Router (secondsky/claude-skills, 227 stars) and Tanstack Router (Mindrally/skills, 267 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Tanstack Router Best Practices?

DeckardGer (a GitHub user) maintains it in DeckardGer/tanstack-agent-skills, which has 222 GitHub stars. The repository holds 4 skills in this directory. The repository was last updated on September 9, 2026.

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