router-core-type-safety

Infer and validate route types for React web applications.

7|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/hashintel/brunch --skill router-core-type-safety-hashintel
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: router-core-type-safety
Source: https://github.com/hashintel/brunch/tree/main/.agents/skills/router-core-type-safety
Command: npx skills add https://github.com/hashintel/brunch --skill router-core-type-safety-hashintel

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It guarantees type safety and inference consistency across route definitions and navigation in complex web applications.

Core Features & Use Cases

  • Type inference for route parameters, search, context, and loader data without explicit annotations.
  • Type-safe navigation and hooks such as useParams, useSearch, and useNavigate with route narrowing.
  • Utilities for validating, narrowing, and optimizing route data handling, plus code-splitting support.
  • Use Case: A developer configures a React app with fully type-checked routes, ensuring correct parameter passing and data usage during development and refactoring.

Quick Start

Import createRouter, register it in module augmentation, define routes with inferred types, and use the hooks without annotations for full type safety.

Frequently Asked Questions about router-core-type-safety

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

FAQPage Schema
How do I ensure type-safe routing in a React application without manual type annotations?

Type-safe routing in React is achieved by using automatic type inference for route parameters, search, context, and loader data. This approach eliminates manual annotations and prevents common routing type errors during navigation.

How do I get type inference for route parameters and loader data in TypeScript?

Type inference for route parameters and loader data is provided automatically when you import createRouter and register it in module augmentation. This allows hooks like useParams to use inferred types without explicit annotations.

Does type-safe routing work with code-splitting and complex route structures?

Yes, type-safe routing supports complex route structures and code-splitting while maintaining type validation. It provides utilities for narrowing and optimizing route data handling, ensuring correct parameter passing across split code.

Why do I get type errors when passing parameters with useNavigate and useSearch in React?

Type errors with useNavigate and useSearch occur when route definitions lack consistent type inference. Using a router with built-in type narrowing ensures these hooks validate parameters against the specific route context.

What is the best way to configure type-safe navigation hooks for complex React routes?

The best way to configure type-safe navigation hooks is to define routes with inferred types using createRouter. This provides type narrowing for useNavigate and useSearch, ensuring correct data usage during development and refactoring.