TanStack Router Agent Rules

Type-safe routing and the TanStack Start full-stack framework for React and Solid.

Overview

TanStack Router covers the shared core, framework bindings, and Start packages. Its test process narrows from affected packages to focused cases, limits sandbox recovery to one reset and retry, and uses example apps for checks in context.

Documents

├── 
└── 

Techniques in this file

01

Keep test filters inside the task graph

Tests are narrowed by package, file, and test name through Nx. The guide explains that direct runners can skip task dependencies, including required builds.

Source excerpt starting at line 50.
  - Prefer Nx targets over direct test runners so task dependencies (including required builds) remain in the graph.

02 / Hard prohibitions

Bound recovery from a stalled task runner

Sandbox instructions disable the daemon and remote cache, serialize Nx commands, and allow one reset and retry after a stall. Continued failure is surfaced instead of retried indefinitely.

Source excerpt starting at line 51.
  - In sandbox, run Nx with `CI=1 NX_DAEMON=false pnpm nx run <project>:<target> --outputStyle=stream --skipRemoteCache`  - Run only one Nx command at a time.  - If an Nx command shows no output for ~20 seconds, stop, run `pnpm nx reset` once, and retry once.  - Do not loop retries indefinitely. If it still hangs or sandbox blocks graph/daemon behavior, request escalation immediately.

03 / Verification by change type

Test both runtime behavior and types

Unit and type tests are required during development. The guide lists additional lint, build, end-to-end, and CI targets so different kinds of validation remain distinguishable.

Source excerpt starting at line 58.
- **Critical**: Always run unit and type tests during development - do not proceed if they fail- **Test types:** `pnpm test:unit`, `pnpm test:types`, `pnpm test:eslint`, `pnpm test:e2e`, `pnpm test:build`- **Full CI suite:** `pnpm test:ci`- **Fix formatting:** `pnpm format`

04 / Architecture as narrative

Keep framework-neutral logic separate from bindings

The package map places core routing and history beneath React and Solid bindings, with Start packages above them. It records the dependency direction to guide changes that cross package boundaries.

Source excerpt starting at line 116.
**Dependencies:** Uses workspace protocol (`workspace:*`) - core → framework → start packages

Ideas for your repo

  1. Keep filtered tests inside the build task graph.
  2. Set a finite recovery policy for stalled development tools.
  3. Treat public type behavior as a separate testing concern.
  4. Record dependency direction between core logic and framework integrations.
Sponsored byModem

Give your agents the whole story.

These instructions explain how to work in TanStack Router. Modem shows your agents what customers said, who is affected, and what changed.

See how Modem works