tanstack-router-patterns

tanstack-router-patterns is a skill for Claude Code, Codex from LooseWireDev/mealforge. It costs 53 tokens per session (731 once invoked), scanned A, original, MIT.

A project guide for using TanStack Router and TanStack Query in a web application. TanStack Router maps files to URLs, while TanStack Query helps load and manage data from APIs.

In plain words
What is it for?
Use it when adding pages, routes, URL parameters, navigation links, API data fetching, or shared web-app features.
Why use it?
It prevents routing and data-fetching changes from breaking the generated route tree or the application's type safety.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/loosewiredev/mealforge/tanstack-router-patterns
Any agent
npx skills add LooseWireDev/mealforge --skill tanstack-router-patterns
Clone the repo
git clone --depth 1 https://github.com/LooseWireDev/mealforge

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tanstack-router-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/loosewiredev/mealforge/tanstack-router-patterns.svg)](https://agentmods.dev/skills/loosewiredev/mealforge/tanstack-router-patterns)
Your own site
<a href="https://agentmods.dev/skills/loosewiredev/mealforge/tanstack-router-patterns"><img src="https://agentmods.dev/badge/skills/loosewiredev/mealforge/tanstack-router-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 53 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 731 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00053 $0.00731
Opus 5 $0.00026 $0.00365
Sonnet 5 $0.00011 $0.00146
Haiku 4.5 $0.00005 $0.00073

Measured 3d ago against content hash f9f005bd1269, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

tanstack-router-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/tanstack-router-patterns/SKILL.md · 52 lines

How it starts

The opening of the file, as written. The whole thing — 52 lines — stays where its author put it; the contents beside it link to each section on GitHub.

TanStack Router Patterns (apps/web)

File-based routing

Routes live in apps/web/src/routes/. The route tree is generated into src/routeTree.gen.ts by the TanStack Router Vite plugin — never edit that file, and never import route components manually to "wire" them; creating the file in src/routes/ IS the wiring.

  • __root.tsx — root layout: createRootRoute({ component: RootLayout }), renders shared nav and <Outlet />.
  • index.tsx/ via createFileRoute('/').
  • about.tsx/about; posts.$postId.tsx/posts/:postId; _layout.tsx files create pathless layouts.
import { createFileRoute } from '@tanstack/react-router';

export const Route = createFileRoute('/about')({
  component: AboutPage,
});

function AboutPage(): React.ReactElement {
  return <div>…</div>;
}

Type safety comes from the declare module '@tanstack/react-router' { interface Register { router: typeof router } } block in main.tsx — leave it in place. Use <Link to="/..."> (typed) instead of raw anchors, and Route.useParams() / Route.useSearch() for route data.

Pages vs features

Route files stay thin: layout + composition. Real UI and logic live in src/features/<name>/ (scaffolded by the feature generator — see the feature-development skill) and shared pieces in src/components/. A route file imports the feature's components; it does not contain business logic.

Data fetching

main.tsx already provides a QueryClientProvider.

  • Hono backend: use the typed tRPC hooks from src/lib/trpc.tstrpc.<feature>.<procedure>.useQuery() / .useMutation(). When adding the FIRST tRPC call, wrap the app in <trpc.Provider client={createTRPCClient()} queryClient={queryClient}> in main.tsx (the scaffold leaves a comment marking the spot). Types flow from @<project>/shared/types — never define API response types by hand.
  • Python backend: use src/lib/apiClient.ts (reads VITE_API_URL) with TanStack Query (useQuery({ queryKey, queryFn })), types from src/lib/api-schema.ts (regenerate with pnpm run codegen).

Read the full file on GitHub · 52 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 52 lines · 53 tokens per session scan A f9f005bd1269

Subscribe to this mod's changes

tanstack-router-patterns is a skill published in the GitHub repository LooseWireDev/mealforge (1 stars, last pushed 1mo ago), licensed MIT. It adds 53 tokens to every session and 731 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

frontend-feature

Build a new page, view, or data-driven feature in the Next.js frontend. Use when adding a route under the dashboard/marketing area, wiring UI to a backend endpoint, adding client state, or creating a localized page. Covers App Router, data fetching, Zustand stores, and i18n.

vstorm-co/full-stack-ai-agent-template · 64 tokens

fix-issues

Fix a batch of open GitHub issues end to end - one git worktree and one agent per issue (feature-dev for implementation, review-pr for review), individual PRs into develop, a release PR to main with a final multi-agent integration review, and optional tag/release/issue-comment publishing. Use when the user asks to…

kossakovsky/selfhost-ai · 80 tokens

web-artifacts-builder

Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.

Prismer-AI/PrismerCloud · 64 tokens

add-mechanic

Add game mechanics with correct GDScript 4.x patterns -- movement, health, inventory, save/load.

n24q02m/better-godot-mcp · 26 tokens

debug-issue

Systematic Godot debugging decision trees for physics, signals, rendering, navigation, and input issues.

n24q02m/better-godot-mcp · 23 tokens

bulk-update

Update properties or content across many pages in a Notion database with dry-run and error recovery.

n24q02m/better-notion-mcp · 21 tokens