links

Generates type-safe URLs for named routes in Rango React Server Components applications.

Updated Nov 7, 2025
One-click install
npx skills add https://github.com/rangojs/rango --skill links-rangojs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: links
Source: https://github.com/rangojs/rango/tree/main/packages/rangojs-router/skills/links
Command: npx skills add https://github.com/rangojs/rango --skill links-rangojs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Hardcoded URL paths break when routes move or get mounted elsewhere, and manually tracking mount prefixes and route params across server and client code is error-prone. This Skill provides the correct URL generation API for every context in a Rango router application. ## Core Features & Use Cases - Server-side URL generation: Use ctx.reverse() in route handlers to resolve local (.name) and global (name.sub) route names, with automatic filling of mount params from the current request context. - Client-side patterns: Receive URLs as props, loader data, or action returns from the server, or use useReverse(routes) with a generated .gen.ts route map for typed, mount-aware in-module URL generation. - Static and mount-relative paths: Use href() for compile-time validated absolute paths, useHref() for mount-prefixed local navigation, and useMount() to read the current include mount path. - Use Case: A product page handler calls ctx.reverse(".cart") to link to the cart within a shop module mounted at /shop, while a client navigation component uses useReverse(blogRoutes) to generate typed links that stay correct when the blog module is remounted under a different path. ## Quick Start Ask the assistant to generate a type-safe link to a named route in your Rango app, specifying whether the code runs in a server handler or a client component.

Frequently Asked Questions about links

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

FAQPage Schema
How do I generate a URL for a named route in Rango?

Use ctx.reverse("name", params) inside a server route handler, passing the route name and any path params. Dot-prefixed names like ".cart" resolve within the current include scope, while unprefixed names resolve against the global named-routes map.

How do I create links in Rango client components?

Client components cannot call ctx.reverse, so either receive URLs as props, loader data, or action returns from the server, or call useReverse(routes) with a routes map imported from a urls module's generated .gen.ts file. For static paths, use the href() function.

What is the difference between href and useHref in Rango?

href() is a plain function returning compile-time validated absolute paths with no mount awareness. useHref() is a hook that automatically prepends the current include() mount prefix, so it suits local navigation inside a mounted module.

Does ctx.reverse work in client components?

No, ctx.reverse is server-only because it depends on the full route manifest and handler context, which do not exist in the browser bundle. On the client, pass URLs from the server or use useReverse with an imported routes map.

Why does useReverse throw an unknown route error?

useReverse only knows names present in the imported routes map, so a name from another module throws "Unknown route". Import that module's own .gen.ts routes map, and re-run rango generate after changing path or include definitions.