client-side-routing
What it does
This skill explains how to add pages to an Agent-Native app while keeping the shared shell mounted. The shell includes the agent sidebar and navigation. It is for developers adding routes to these React apps.
When to use it
- βWhen you are adding a new page to an Agent-Native app.
- βWhen the agent sidebar reloads every time the user changes page.
- βWhen you need to choose between a root layout and a pathless layout route.
Skill link
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/client-side-routing/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βCan you add a new reports page to my app without the agent sidebar reloading when I navigate there?β
5 new skills a week. 1 minute to read.
How it works
The agent mounts the shared shell once above the page outlet, and it uses a pathless layout route when some pages are public and others are private.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Client-Side Routing
Rule
All templates are single-page apps using React Router. Navigation must not remount the app shell. The agent sidebar, document tree, and any other persistent chrome must survive route changes.
Why
If the shell unmounts on every navigation, the agent chat reconnects/reloads, destroying in-progress work and hammering the backend.
Hard Rule
The app shell (AgentSidebar + any top-level navigation) must be mounted ONCE, above the <Outlet />. Never wrap each page in its own <AppLayout> / <Layout>. React sees a different component at the outlet position on each nav and unmounts the entire subtree.
Two Correct Patterns
1. All routes need the shell
Mount <AppLayout> in root.tsx around <Outlet />:
// app/root.tsx
<AppLayout>
<Outlet />
</AppLayout>
2. Mix of protected and public routes
Use a React Router pathless layout route:
app/routes/
_app.tsx # renders <AppLayout><Outlet /></AppLayout>
_app._index.tsx # / β under AppLayout
_app.settings.tsx # /settings β under AppLayout
_app.team.tsx # /team β under AppLayout
book.$slug.tsx # /book/:slug β no layout (public)
f.$.tsx # /f/* β no layout (public form filler)
The _ prefix on _app.tsx makes it a pathless parent β it contributes the layout but no URL segment. Route files prefixed with _app. nest under it and share the layout instance across navigations.
Anti-Pattern
// β BAD β each route wraps its own Layout, causing full remount on every nav
export default function Settings() {
return (
<AppLayout>
<SettingsContent />
</AppLayout>
);
}
If a page needs per-route data (e.g. sidebar highlighting the active document), derive it inside the layout from useParams() / useLocation() β don't pass it as a prop through every route file.
Chat-First Routes
If / is a full-page chat such as AgentChatHome, keep the app shell mounted
around it when possible so AgentSidebar URL sync and route warmup stay active.
If the chat route intentionally lives outside the shell, add a tiny app-owned
prewarm for the routes agents commonly open from that chat. In local dev,
React Router can update the address bar before a cold Vite route chunk commits,
which makes navigation look broken even when the URL is correct.
Adding a New Route
- Pattern #1 (AppLayout in
root.tsx): just render page content β nothing else. - Pattern #2 (pathless
_app.tsx): name the file_app.<segment>.tsxfor authed routes, or bare<segment>.tsxfor public routes.
Related Skills
adding-a-featureβ The four-area checklist referencing route layout patternscontext-awarenessβ Navigation state written on every route change
FAQ
Why does the agent sidebar reload?
It usually happens when each page wraps itself in its own layout, so the shell remounts on navigation.
What is a pathless layout route?
It is a parent route that adds a layout without adding a part to the web address.
Which framework is used?
The skill says the apps use React Router as single page apps.
Details
Original description by the author
How to add routes without remounting the app shell. Use when adding a new route, fixing agent sidebar reloads on navigation, or choosing between `root.tsx` layout and pathless `_app.tsx` layout patterns.
repo: BuilderIO/agent-native
Popularity
- GitHub stars
- 7.6k
- Ranking position
- #13146
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
design-exploration
7.6kHelps your agent explore several UI design directions side by side, let you pick one, and then refine the chosen design.
visual-edit
7.6kHelps your agent open a running local app in a visual editor so you can review and edit its real screens together.
turn-into-app
7.6kTurns a workflow, spreadsheet or project into a polished visual app, with populated screens and an agent working behind the controls.
visual-plan
7.6kTurns a plain text plan into an interactive visual plan with diagrams, file maps, code snippets and open questions.
Similar skills
angular-developer
280kHelps your agent create Angular code and give project structure advice. Useful for starting new projects, creating code parts, or improving performance and accessibility.
frontend-a11y
280kHelps your agent make web interfaces accessible to everyone. It ensures websites and apps work well with screen readers and keyboard navigation.
frontend-patterns
280kHas your agent apply modern patterns in frontend development. It optimizes performance, manages state, and follows best practices in React and Next.js.