react-router-file-routes

Documents React Router v7 file-based routing conventions including nested and dynamic routes.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/atman-33/skills --skill react-router-file-routes
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: react-router-file-routes
Source: https://github.com/atman-33/skills/tree/main/skills/react-router-file-routes
Command: npx skills add https://github.com/atman-33/skills --skill react-router-file-routes

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a concise reference guide for React Router v7 file-based routing conventions, helping developers understand how file names map to routes, how to define dynamic and nested routes, and how to implement special routing patterns in app/routes.

Core Features & Use Cases

  • File naming conventions map to URL paths in app/routes, including index, nested, and dynamic routes.
  • Support for dynamic segments using $param, optional segments with ?, pathless layouts using _ prefix, and splat routes with $. Also escaping special characters with bracket notation.
  • Use Case: When starting a new React Router v7 project, organize route files to automatically create routes, including dynamic segments like /concerts/:city and /settings/profile.

Quick Start

Open your app's routes directory and apply the naming patterns shown in this guide. For example, create _index.tsx for the root, about.tsx for /about, concerts.tsx for the layout, concerts._index.tsx for /concerts, and concerts.$city.tsx for /concerts/:city.

Frequently Asked Questions about react-router-file-routes

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

FAQPage Schema
How do I map file names to URL paths in React Router v7 file-based routing?▼

React Router v7 file-based routing maps file names in the app/routes directory directly to URL paths, where creating a file like about.tsx automatically generates the /about route without manual configuration. This convention uses specific naming patterns to define the routing structure.

How do I define dynamic and nested routes using React Router v7 file conventions?▼

To define dynamic and nested routes in React Router v7, you use specific file naming conventions within app/routes. Nested routes are created by prefixing child files with the parent route's name, such as concerts._index.tsx for /concerts, while dynamic segments use the $param syntax, like concerts.$city.tsx for /concerts/:city.

What are pathless layouts, splat routes, and optional segments in React Router v7?▼

Pathless layouts in React Router v7 use an underscore prefix to render components without adding to the URL path. Optional segments are denoted with a question mark, splat routes use a dollar sign to catch all remaining URL segments, and special characters can be escaped using bracket notation.

How do I create an index route for the root path in a React Router v7 app?▼

To create an index route for the root path in a React Router v7 app, you create a file named _index.tsx within the app/routes directory. This specific file naming convention automatically maps to the root URL and renders when the parent route is exactly matched.

Does React Router v7 file-based routing require manual route configuration?▼

React Router v7 file-based routing does not require manual route configuration, as it automatically generates routes based on the file naming conventions in the app/routes directory. This design speeds up route implementation by organizing route files to directly map to URL paths.