agentleFS
malinskibeniaminmalinskibeniamin/skills/tanstack-router/SKILL.md

tanstack-router

Skill4 starsChanged 10 days agoMITView on GitHub

Apply TanStack Router patterns for Query ownership and typed search. Use when changing routes, loaders, navigation, route trees, or search parameters.

14 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 11 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run /tanstack-intent first for installed Router/Query API syntax.

    line 9
  2. Distinctive:

    Use Router pending UI/timing, not custom navigation timers.

    line 29
  3. Very specific:

    Use router navigation, not window.location.

    line 36

“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Run /tanstack-intent first for installed Router/Query API syntax. This skill owns local URL/data policy. See REFERENCE.md for shapes and SETUP.md for install.

Router + Query

Router loaders start server fetches after navigation intent; Query owns cache/refetch/invalidation/GC; components observe with useQuery/useSuspenseQuery.

Route-known inputs use one pipeline: validateSearch -> loaderDeps -> one queryOptions builder -> loader and observer. Return only query-driving fields. Components use useLoaderDeps, not parallel search reads. Share route-context options only when installed Intent guidance supports it.

  • Critical data: await ensureQueryData, observe with useSuspenseQuery.
  • Deferred route data: start in loader, observe with useQuery plus loading/empty/error.
  • Interaction-only data may start in components.
  • Query loaders use defaultPreloadStaleTime: 0 and createRootRouteWithContext.

Navigation lifetimes

  • Superseded navigation cannot publish; shared loader/Query work may remain useful.
  • beforeLoad is replay-safe auth, redirect, or context construction. No observable side effects or ordinary fetches.
  • Direct loader requests forward abortController.signal; Query functions forward Query's signal. Never cancel shared work on each navigation.
  • Throw redirect(...); never imperatively navigate from guards/loaders.
  • onResolved owns analytics/non-DOM cleanup; onRendered owns focus, scroll, measurement after commit.
  • Use Router pending UI/timing, not custom navigation timers.

Route rules

  • Scope useParams, useSearch, useLoaderData, useRouteContext with { from } or route API; reject strict: false.
  • Query-backed components read Query, not Route.useLoaderData.
  • Route files export config only; reusable components live elsewhere.
  • Use router navigation, not window.location.
  • react-router-dom, URLSearchParams, and nuqs are migration debt.
  • Regenerate route tree after changes.

Search

validateSearch owns typing. URL holds shareable tabs/filters/sort/page; storage holds personal density/page size/collapse. Validate enums/dates/bounded numbers; clamp stale pages. Merge prior search and use replace: true within a section so Back exits it.

Done

Types prove scope; loader and observer share options/inputs; Query has an active observer and all visible states; rapid/preloaded navigation cannot publish stale UI or duplicate app work; tests assert rendered landmarks after URL changes; history semantics and malformed/stale/shared URLs pass; route tree, tests, typecheck, lint pass.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.