code-enforce-route-data
CommunityWarm route data and avoid SSR hydration drift
Software Engineering#tanstack start#react query#react router#route loader#SSR hydration#cache prefetch#intent navigation
Authorwebdevcody
Version1.0.0
Installs0
System Documentation
What problem does it solve?
It prevents cache drift and SSR/client mismatches by enforcing a single, consistent pattern for how TanStack Start routes prefetch server data and how components read from React Query.
Core Features & Use Cases
- Colocated queryOptions + hooks: For each feature, routes import a single source of truth from src/queries so the queryKey and queryFn stay identical between loader and component.
- Loader prefetch with ensureQueryData: Routes pre-warm the React Query cache using queryClient.ensureQueryData (including Promise.all for multiple queries) so the first paint has data and there is no loading flash.
- Intent prefetch via <Link> navigation: In-app navigation uses @tanstack/react-router <Link> (including Button-as-child patterns) to warm loader cache before the user clicks, aligning navigation behavior with data requirements.
Quick Start
Use this skill when adding or editing any TanStack Start route that reads server data, ensuring you add a loader that calls ensureQueryData with the colocated queryOptions and read the same query in the route component.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: code-enforce-route-data Download link: https://github.com/webdevcody/go-mailing-list/archive/main.zip#code-enforce-route-data Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.