/beagle-react:remix-v2-routingfrom beagle-react
Remix v2 flat-routes conventions: file naming, nested layouts, resource routes, pathless layouts, splats, and optional segments.
Ships in beagle-react. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Flat-routes v2 filename rules (all files live in app/routes/):
_index.tsx → /
concerts.tsx → /concerts (acts as layout when dotted children exist; otherwise leaf for /concerts)
concerts._index.tsx → /concerts (renders under layout)
concerts.$city.tsx → /concerts/:city params.city
concerts.trending.tsx → /concerts/trending
_auth.tsx + _auth.login.tsx → /login (pathless layout, no URL segment)
files.$.tsx → /files/* params["*"]
($lang)._index.tsx → / and /en (or /fr etc.) — optional segment
sitemap[.]xml.tsx → /sitemap.xml (escape literal)
concerts_.mine.tsx → /concerts/mine (opts out of layout)
dashboard/route.tsx → /dashboard (folder + route.tsx)
reports.$id[.pdf].tsx → /reports/:id.pdf (no default export = resource)
Imports — always use @remix-run/react, never react-router-dom:
import { Outlet, Link, useLoaderData, useParams } from "@remix-run/react";
import type { LoaderFunctionArgs } from "@remix-run/node"; // or /cloudflare, /deno
Dots in filenames create URL slashes and parent/child nesting. Underscore prefix marks pathless segments (_auth.tsx) and index routes (_index.tsx). Trailing underscore (concerts_.mine.tsx) opts out of layout nesting while keeping the URL nested. Brackets escape literal characters: sitemap[.]xml.tsx. Splat is the single dollar sign: $.tsx exposes the rest of the path under params["*"]. Optional segments are wrapped in parens: ($lang).
See references/conventions.md for the full table and edge cases.
A parent module (concerts.tsx) renders <Outlet />; child routes (concerts.$city.tsx, concerts._index.tsx) mount inside it automatically based on the dot-delimited filename.
// app/routes/concerts.tsx
import { Outlet } from "@remix-run/react";
export default function ConcertsLayout() {
return (
<section>
<nav>{/* concerts subnav */}</nav>
<Outlet />
</section>
);
}
// app/routes/concerts._index.tsx (renders at exactly /concerts)
export default function ConcertsIndex() {
return <h1>Browse concerts</h1>;
}
For a layout with no URL contribution, prefix with a single underscore:
// app/routes/_auth.tsx → wraps /login, /signup; no URL segment
// app/routes/_auth.login.tsx → /login (inherits _auth layout)
// app/routes/_auth.signup.tsx → /signup
$name captures a single segment; $.tsx captures the rest of the path. Loader receives values via params:
// app/routes/concerts.$city.tsx
import type { LoaderFunctionArgs } from "@remix-run/node";
import { json } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
export async function loader({ params }: LoaderFunctionArgs) {
if (!params.city) throw new Response("Not found", { status: 404 });
return json({ city: params.city });
}
export default function City() {
const { city } = useLoaderData<typeof loader>();
return <h1>{city}</h1>;
}
Splat values live under "*" — there is no params.splat:
// app/routes/files.$.tsx
export async function loader({ params }: LoaderFunctionArgs) {
const rest = params["*"]; // bracket access only
return new Response(await readBlob(rest), { headers: { "Content-Type": "application/octet-stream" } });
}
app/root.tsx is the only required route. It owns the document shell and must render <Meta />, <Links />, <Outlet />, <ScrollRestoration />, <Scripts />, and (during dev) <LiveReload />. See references/root.md.
A route module without a default export is a resource route — it returns raw Response objects (PDF, JSON, RSS, webhooks). Parent loaders do not run, and <Link> must use reloadDocument (or be replaced with <a>) to trigger a real document request. See references/resource-routes.md.
Answer in order. Pass means the condition is true; pick the answer on the same line and stop.
about.tsx, pricing.tsx); no layout module needed. Stop.concerts.$city.tsx under concerts.tsx). Stop.concerts_.mine.tsx). Stop._auth.tsx + _auth.login.tsx). Stop.default component. UI route. Stop.Response?
default export — module becomes a resource route. Use reloadDocument on any <Link> pointing to it. Stop._index.tsx vs index.tsx_index.tsx (leading underscore). Stop.@remix-run/v1-route-convention and wire it in remix.config.js. See references/v1-migration.md. Stop._index, _layout, $param, splat, optional, escape, folder + route.tsx, trailing underscore).root.tsx scaffold and the required document elements.default-export rule, parent-loader skipping, and reloadDocument.__double underscore folders, index.tsx, @remix-run/v1-route-convention, ignoredRouteFiles).| Concern | v1 (nested folders) | v2 (flat routes) |
|---|---|---|
| Index route | index.tsx | _index.tsx |
| Pathless layout | __auth/ (double underscore) | _auth.tsx (single) |
| Nested URL | folder hierarchy | dot delimiter in filename |
| Dynamic segment | $param.tsx | $param.tsx (unchanged) |
| Splat | $.tsx | $.tsx (unchanged) |
| Escape literal | n/a | [.], [] brackets |
| Opt-out of layout | move out of folder | trailing _ (foo_.bar.tsx) |
| Co-location | adjacent files in folder | feature/route.tsx + siblings |
| Fallback adapter | n/a | @remix-run/v1-route-convention |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub existential-birds/beagle --plugin beagle-react28 skills in this plugin
/ai-elementsVercel AI Elements for workflow UI components. Use when building chat interfaces, displaying tool execution, showing reasoning/thinking, or creating job queues. Triggers on ai-elements, Queue, Confirmation, Tool, Reasoning, Shimmer, Loader, Message, Conversation, PromptInput./dagre-react-flowAutomatic graph layout using dagre with React Flow (@xyflow/react). Use when implementing auto-layout, hierarchical layouts, tree structures, or arranging nodes programmatically. Triggers on dagre, auto-layout, automatic layout, getLayoutedElements, rankdir, hierarchical graph./react-flowReact Flow (@xyflow/react) for workflow visualization with custom nodes and edges. Use when building graph visualizations, creating custom workflow nodes, implementing edge labels, or controlling viewport. Triggers on ReactFlow, @xyflow/react, Handle, NodeProps, EdgeProps, useReactFlow, fitView.Other plugins' skills for the same job