react-router
Build applications with React Router in Framework, Data, Declarative, and unstable RSC modes. Use when configuring routes, route modules, loaders, actions, forms, fetchers, navigation, pending UI, SSR/SPA/pre-rendering, middleware, URL params/search params, or React Router upgrades.
- License 许可
- MIT
- 所属仓库
- carterdea/dots
- 最近更新
- 2026-11-12
- Stars
- ★ 4
- Forks
- 3
01 前言 Front Matter
- name
- react-router
- license
- MIT
- description
- Build applications with React Router in Framework, Data, Declarative, and unstable RSC modes. Use when configuring routes, route modules, loaders, actions, forms, fetchers, navigation, pending UI, SSR/SPA/pre-rendering, middleware, URL params/search params, or React Router upgrades.
02 资源文件 13
- 参考文档evals/eval_queries.json1.3 KB
- 参考文档evals/evals.json6.9 KB
- 参考文档references/data-mode.md4.7 KB
- 参考文档references/declarative-mode.md3.2 KB
- 参考文档references/framework-mode.md7.1 KB
- 参考文档references/rsc.md3.4 KB
- 脚本scripts/clear-album-artist.sh1.3 KB
- 脚本scripts/extract-apple-music-genres.sh2.8 KB
- 脚本scripts/inspect-metadata.sh2.8 KB
- 脚本scripts/set-album-artist.sh1.5 KB
- 脚本scripts/set-compilation.sh2.3 KB
- 脚本scripts/update-genre.sh1.4 KB
- 脚本scripts/update-track-count.sh2.2 KB
03 SKILL.md 正文
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/devin dependenciesreact-router.config.tsapp/routes.tsapp/entry.server.tsxand/orapp/entry.client.tsxfiles- route modules under
app/routes/ - route exports like
loader,action,clientLoader,clientAction,ErrorBoundary,meta,links, orheaders - 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, orcreateStaticRouter<RouterProvider router={router}>- route objects with properties like
path,children,loader,action,Component,ErrorBoundary, orlazy - 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-rscunstable_RSCRouteConfig- RSC entry files such as
entry.rsc ServerComponent,ServerErrorBoundary,ServerLayout, orServerHydrateFallback- 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:
| Reference | Use When |
|---|---|
references/framework-mode.md |
Framework Mode or RSC Framework base behavior |
references/data-mode.md |
Data Mode or RSC Data base behavior |
references/declarative-mode.md |
Declarative Mode |
references/rsc.md |
Any 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:
| Migration | Docs to read |
|---|---|
| Declarative -> Data | react-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 -> Framework | react-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 changes | react-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/upgrades | react-router/docs/upgrading/future.md and relevant files under react-router/docs/upgrading/ |
04 同仓库更多 Skills
test-audit
Writing/changing/reviewing/sweeping tests: reject duplicate or implementation-coupled proof; remove test-only production seams.
untangle-codebase
Untangle a whole codebase in one pass, so agents working in it read less per change, break less without noticing, and debug faster.
write-swift
How to write modern Swift well — modeling with value types, Swift 6 data-race safety and approachable concurrency (@concurrent, main-actor-by-default, actors, task groups), protocols and generics (some vs any), API design, performance and ARC, Swift Testing, macros, and the modern language features agents don't know about yet. Use when writing, reviewing, or migrating Swift, or when a concurrency error, a hang, a data race, a retain cycle, or a performance problem needs fixing.
stageshow
Build faux product UI that looks like a real product, as a still illustration or an animated demo with a cursor. Browser and app windows, dashboards, phones, notifications, terminals, bento grids and cursor walkthroughs, framed, masked and cropped the way a marketing page, feature card or docs hero needs them. Use whenever someone wants a fake or mocked UI, a product demo or walkthrough animation, a hero or feature-card illustration of an app, a product shot in the style of a polished marketing site, or an animated cursor doing things in an interface, even if they never say "faux UI". React and plain CSS.
review-animations
Reviews animation and motion code against a high craft bar derived from Emil Kowalski's design engineering philosophy. Default to flagging; approval is earned.
remove-animations
Find the animations an interface doesn't need and remove them — motion on keyboard actions, high-frequency surfaces, functional data, and decoration with no purpose — then clean up what they leave behind. Edits code, but only to subtract; it never adds or retunes motion. Use when the user says the app "feels slow", "has too much animation", "feels over-animated", wants to "tone down the motion", or asks what animations to remove. For finding places that should animate, use find-animation-opportunities; for fixing animations that should stay, use improve-animations or review-animations.