nette-routinglisted
Install: claude install-skill nette/agent-plugins
## Nette Routing
A route is **bidirectional**: the same object matches an incoming URL and generates links, and almost
every routing bug comes from forgetting the second direction. Related skills: **nette-architecture**
(`RouterFactory`, lifecycle), **nette-configuration** (registering it), **nette-components** (signal
links), **latte-templates** (`n:href`/`{link}`). Verified against nette/application 3.3.0 and
nette/routing 3.1.3.
### Order governs link GENERATION, not just matching
`RouteList::constructUrl()` walks the routes in declaration order and returns the URL from **the first
route that can build one** – so a catch-all placed first silently hijacks every link, with no error:
```php
$router->addRoute('admin/<presenter>/<action>', 'Admin:Default:default'); // WRONG order:
$router->addRoute('rss.xml', 'Feed:rss'); // link to Feed:rss generates '/admin/feed/rss'
```
Specific first, catch-all last. The **canonical URL of a page is whatever the first non-one-way matching
route generates**, so the order also decides where canonicalization redirects.
### Mask grammar
```php
$router->addRoute('chronicle/<year=2020>', 'History:show'); // default inside the mask
$router->addRoute('<presenter>/<action>[/<id \d+>]', 'Home:default'); // optional part + regex
$router->addRoute('<path .+>', 'File:serve'); // default pattern is [^/]+; only .+ eats slashes
$router->addRoute('//<lang>.example.com/<presenter>', /* ... */); // host part needs the // prefix
``