Review TanStack Router
Review the TanStack Router setup in front-app for alignment with current official best practices - route-tree generation, type-safe search params, loading/preloading strategy, and developer experience on a React 19 SPA deployed via Cloudflare. Your reply must be a plan of suggested changes: concise, actionable, structured - not only prose.
Invocation
Text after the slash command is additional scope/focus (e.g. "search params", "code splitting") - narrow the review accordingly.
Ground truth (mandatory)
Your pre-trained knowledge of TanStack Router may be outdated (frequent minor releases). Do not draft suggestions from memory alone.
- Resolve "TanStack Router" via the Context7 MCP (
resolve-library-id→query-docs): file-based routing conventions,createFileRoute/route APIs at the installed version, search-param validation with Zod, code-based splitting/lazyRouteComponentpatterns, devtools. - Cross-check with local skill
.agents/skills/tanstack-router/SKILL.mdfor repo-relevant depth. - For anything Context7 lacks, use Firecrawl search/scrape restricted to the official domain (
tanstack.com/router) - guides and changelog. - Version currency: catalog entries (
@tanstack/react-router,@tanstack/router-plugin,@tanstack/router-cli,-devtools) in pnpm-workspace.yaml vs latest stable; plugin and runtime version skew is a classic drift point. - Cite the retrieved source next to every finding; label anything unverifiable as Unverified.
Scope artifacts
- Route files under apps/front-app/src/routes/ and generated route tree artifact
- apps/front-app/tsr.config.json, router-plugin options in apps/front-app/vite.config.ts
- CLI usage (
@tanstack/router-cligenerate task) in package scripts; generated-file ignore policy (oxlint/knip/git) - Devtools wiring (
@tanstack/react-router-devtools)
Analysis axes
- Route-tree generation: generator config current; generated file committed/ignored per repo policy and excluded from lint/format noise; regeneration wired into dev/build reliably.
- Type safety:
validateSearchwith Zod schemas shared with DTOs where applicable; fully typedLink/navigateusage; noas anyescapes around params. - Loading & data: loaders used appropriately vs TanStack Query composition (loader awaiting queryClient.ensureQueryData or deferring); Suspense/error boundaries per route; no waterfall-prone sequential awaits.
- Code splitting & preloading: route-level lazy chunks;
preloadintent configuration sensible; defaultgcTime/stale-time interplay with query cache understood. - Devtools: gated out of production builds; version aligned with runtime.
- Version currency: breaking changes between catalog pin and latest noted when relevant to used APIs.
DX & AI-agentic workflow
Verify agent-friendliness: adding a route is a documented repeatable procedure (nested AGENTS.md); generated artifacts never hand-edited; type errors from the route tree actionable via turbo run check-types --filter=front-app.
Steps
- Collect ground truth before reading code.
- Read tsr config + vite plugin options + all route files.
- Walk each analysis axis; note findings or explicit one-line "no issues".
- Compose the plan grouped Critical / Improvements / Optional with what, where, why, and source citations.
Output format
- Critical - broken generation, untyped/unvalidated params reaching logic, stale plugin/runtime mismatch.
- Improvements - loader/splitting/search-param alignment with current guidance.
- Optional - nice-to-haves; prefix pure polish with Nit:.
Read-only review: produce the plan only; implement nothing unless explicitly asked afterwards.