router-core-navigation

Implements type-safe navigation in TanStack Router using Link, useNavigate, preloading, and blocking.

Updated Dec 21, 2025
One-click install
npx skills add https://github.com/Angael/veles --skill router-core-navigation-angael
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: router-core-navigation
Source: https://github.com/Angael/veles/tree/main/.agents/skills/router-core-navigation
Command: npx skills add https://github.com/Angael/veles --skill router-core-navigation-angael

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @tanstack/react-router.

What problem does it solve? Building navigation in a TanStack Router application requires correctly using typed links, programmatic navigation, preloading strategies, and navigation blocking without breaking type safety or losing search params. This Skill provides the correct patterns and common pitfalls for all navigation APIs in TanStack Router. ## Core Features & Use Cases - Type-Safe Links and Navigation: Use Link, useNavigate, Navigate, and router.navigate with params, relative paths via from, and active state styling through activeProps and activeOptions. - Preloading and Performance: Configure intent, viewport, or render preloading strategies with preloadDelay and preloadStaleTime, plus scroll restoration and MatchRoute pending UI. - Navigation Blocking and Reusable Options: Guard unsaved forms with useBlocker and withResolver, and share navigation config with linkOptions and createLink for custom components. - Use Case: When building a dashboard sidebar, define nav entries with linkOptions, render them as Link components with exact active matching, and block navigation away from dirty edit forms with a custom confirm dialog. ## Quick Start Add a type-safe Link to /posts/$postId with params, intent preloading, and active styling in my TanStack Router app.

Frequently Asked Questions about router-core-navigation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a type-safe Link in TanStack Router?

Use the Link component with the to prop set to a route path like /posts/$postId and pass dynamic segments through the params object. Never interpolate values into the to string, as that breaks type safety and param encoding.

How to navigate programmatically with useNavigate in TanStack Router?

Call useNavigate optionally with a from route, then invoke navigate with to and params after side effects like form submissions. For clickable elements, prefer Link since it provides an href, preloading, and accessibility.

How does preloading work in TanStack Router?

Set defaultPreload to intent, viewport, or render on the router, or per Link with the preload prop and preloadDelay. Preloaded data stays fresh for 30 seconds by default via defaultPreloadStaleTime.

How do I block navigation when a form has unsaved changes?

Use useBlocker with a shouldBlockFn that returns true when the form is dirty. Add withResolver to get proceed, reset, and status for rendering a custom confirmation dialog instead of the native confirm.

Why does my relative Link with to=".." navigate to the wrong place?

Without a from prop, relative paths like .. resolve from the root route instead of the current route. Pass from={Route.fullPath} so relative navigation resolves against the current route and stays type-safe.

Why do my search params disappear when navigating with Link?

Passing search as a plain object replaces all existing search params. Use the function form search={(prev) => ({ ...prev, page: 2 })} to preserve current params while updating specific values.