New to Claude Skills? Learn how to install them →

remix-run on GitHub

React Router

Free

Efficiently manage routing in React applications.

Get this skill

Free · Opens the source repo

What React Router does

React Router is a tool designed to help developers manage routing in React applications across different modes: Framework, Data, Declarative, and the unstable RSC (React Server Components) modes. Each mode has specific patterns and configurations that developers need to follow, making it essential to identify the correct mode before making changes to an application. This skill provides comprehensive guidance on how to configure routes, route modules, loaders, actions, forms, and navigation based on the identified mode.

To effectively use React Router, developers must first determine which mode their application is operating in. The skill outlines clear indicators for each mode, such as specific dependencies and file structures. For example, Framework Mode is indicated by the presence of @react-router/dev in dependencies and specific file types like app/routes.ts. Once the mode is identified, developers can refer to the corresponding documentation to ensure they apply the correct routing patterns and practices.

Additionally, React Router includes markdown documentation bundled with the package, ensuring that users have access to the most relevant and version-specific information. This feature is particularly useful for developers who need to reference the documentation while working within their applications. The skill emphasizes the importance of using the installed documentation as the primary source of truth, which helps maintain consistency and accuracy in routing configurations.

This skill is ideal for developers working with React who need to implement or modify routing in their applications. By following the structured approach provided, users can avoid common pitfalls associated with routing configurations and ensure their applications function as intended across different modes.

When to use it

Use this skill when you need to configure routing in a React application, especially when dealing with different routing modes.

When not to use it

This skill may not be suitable for applications that do not utilize React Router or for developers unfamiliar with React's routing concepts.

What you can build with it

Configuring Framework Mode

When building a new application with React Router in Framework Mode, use this skill to identify the necessary configurations and file structures.

Migrating to Data Mode

If you're transitioning an app from Declarative to Data Mode, the skill provides specific documentation to guide you through the migration process.

Implementing Server Components

For applications utilizing React Server Components, refer to the skill for insights on integrating RSC with existing routing strategies.

How to install React Router

View source

1. Install with the skills CLI

npx skills add remix-run/react-router/react-router --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by remix-run

React Router

React Router is mode-specific. Before changing an app, identify the mode, load the matching reference, then read the installed docs for the installed package version.

Identify the Mode

Do not apply Framework/Data patterns to a Declarative app unless you are intentionally migrating modes.

Framework Mode

Use Framework Mode guidance when you see:

  • @react-router/dev in dependencies
  • react-router.config.ts
  • app/routes.ts
  • app/entry.server.tsx and/or app/entry.client.tsx files
  • route modules under app/routes/
  • route exports like loader, action, clientLoader, clientAction, ErrorBoundary, meta, links, or headers
  • imports from ./+types/...
  • the React Router Vite plugin from @react-router/dev/vite

Framework examples usually use the default app/ directory, but check react-router.config.ts for a custom appDirectory before assuming exact paths.

Then read references/framework-mode.md.

Data Mode

Use Data Mode guidance when you see:

  • createBrowserRouter, createHashRouter, createMemoryRouter, or createStaticRouter
  • <RouterProvider router={router}>
  • route objects with properties like path, children, loader, action, Component, ErrorBoundary, or lazy
  • data APIs without the Framework Vite plugin

Then read references/data-mode.md.

Declarative Mode

Use Declarative Mode guidance when you see:

  • <BrowserRouter>, <HashRouter>, or <MemoryRouter>
  • <Routes> and <Route> JSX route configuration
  • route components passed with element={<Component />}
  • no data router, no route module convention, and no loaders/actions

Then read references/declarative-mode.md.

RSC Framework and RSC Data Modes

React Server Components support is unstable and exists in both Framework and Data variants. Use RSC guidance when you see:

  • unstable_reactRouterRSC
  • @vitejs/plugin-rsc
  • unstable_RSCRouteConfig
  • RSC entry files such as entry.rsc
  • ServerComponent, ServerErrorBoundary, ServerLayout, or ServerHydrateFallback
  • React directives or boundary packages such as "use client", "server-only", or "client-only"

For RSC Framework, read both references/framework-mode.md and references/rsc.md. For RSC Data, read both references/data-mode.md and references/rsc.md.

Use Installed Docs as Source of Truth

React Router ships markdown docs in the package so guidance can match the installed version:

node_modules/react-router/docs/

Key docs paths:

node_modules/react-router/docs/index.md
node_modules/react-router/docs/start/
node_modules/react-router/docs/how-to/
node_modules/react-router/docs/explanation/
node_modules/react-router/docs/upgrading/

When this skill references react-router/docs/..., read the matching file under node_modules/react-router/docs/. If the installed version does not include local docs, use the repo docs/ directory when working inside the React Router repository; in a consuming app, fall back to version-matched website docs.

Most docs include a mode marker near the top:

[MODES: framework, data, declarative]

Only apply a doc when its mode marker matches the app mode. If a task spans modes, prefer the section or file that matches the current app.

RSC is documented primarily in:

node_modules/react-router/docs/how-to/react-server-components.md

Skill References

Load the relevant reference after identifying the mode:

ReferenceUse When
references/framework-mode.mdFramework Mode or RSC Framework base behavior
references/data-mode.mdData Mode or RSC Data base behavior
references/declarative-mode.mdDeclarative Mode
references/rsc.mdAny unstable RSC app

Mode Migration Doc Index

If the user explicitly asks to switch modes, read the target mode reference plus the migration-relevant docs:

MigrationDocs to read
Declarative → Datareact-router/docs/start/modes.md, react-router/docs/start/data/routing.md, react-router/docs/start/data/data-loading.md, react-router/docs/start/data/actions.md
Declarative/Data → Frameworkreact-router/docs/start/modes.md, react-router/docs/start/framework/routing.md, react-router/docs/start/framework/route-module.md, react-router/docs/how-to/route-module-type-safety.md
Framework SPA/SSR/pre-render changesreact-router/docs/start/framework/rendering.md, react-router/docs/how-to/spa.md, react-router/docs/how-to/pre-rendering.md, react-router/docs/start/framework/data-loading.md, react-router/docs/start/framework/actions.md
Future flags/upgradesreact-router/docs/upgrading/future.md and relevant files under react-router/docs/upgrading/

Frequently asked questions about React Router

Similar skills