nette-routing
БесплатноБез исполняемых скриптовНе проверенInvoke before writing or modifying a router, a RouterFactory or any URL mask in Nette. Use for RouteList, addRoute(), route masks (optional `[...]` parts…
от nette★ 47 звёзд на GitHubОб этом скилле
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:
$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
$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
- A defaulted parameter becomes optional only if everything after it is optional too:
'<presenter=Home>/<action=default>/<id=>'equals'[<presenter=Home>/[<action=default>/[<id>]]]', hence the trailing slash. Write the brackets yourself –'[<presenter=Home>[/<action=default>[/<id>]]]'– to drop it. Generation prefers the shortest variant;[!...]keeps an optional part in generated URLs while still accepting URLs without it ('<name>[!.html]'generates/hello.html). %basePath%,%host%,%domain%,%sld%,%tld%are substituted only in//-masks, and%basePath%is matched with its surrounding slashes – write//www.%domain%/%basePath%/<presenter>.- Query parameters can be renamed but not validated: in
'product ? id=<productId>'a regex would be silently discarded. - A parameter in the metadata array but not in the mask is constant: unchangeable from the query
string, and a link passing a different value makes the route decline and fall through – that is how
addRoute('tos', ['presenter' => 'Article', 'id' => 123])works.
RouteList, modules, nesting
$router = new Nette\Application\Routers\RouteList;
$router->withModule('Front')
->addRoute('rss.xml', 'Feed:rss') // presenter becomes Front:Feed
->addRoute('<presenter>/<action>', 'Home:default')
->end()
->withDomain('admin.%domain%')->withModule('Admin')
->addRoute('<presenter>/<action>', 'Dashboard:default');
return $router; // the ROOT, not the chain result
withModule()/withDomain()/withPath()create and attach a new child list and return it, not$this;end()returns the parent. Keep the root in a variable –return (new RouteList)->withModule('Front')->addRoute(...)returns the child and loses the siblings.- Without
withModule()(or a fixedmoduleparameter) the full presenter name lands in the URL, where each:becomes a dot and each PascalCase boundary a dash:Front:Admin:ProductListshows up asfront.admin.product-list. Dotted URLs mean a missingwithModule().<module>in a mask captures the whole module path, up to the last colon, andNette:presenters (Nette:Micro,Nette:Error) are never prefixed. $router[] = new Route(...)is deprecated and emitsE_USER_DEPRECATED– useaddRoute()/add(), which returnstatic;prepend()returnsvoid. Add aNette\Application\Routers\Route, never aNette\Routing\Route– only the former knows presenter/action/module inflection (importing the latter forRoute::Valueconstants is fine).
One-way routes
$router->addRoute('product-info', 'Product:detail', oneWay: true); // old URL, accepted only
$router->addRoute('product/<id>', 'Product:detail'); // canonical, generates links
oneWay is int|bool. One-way routes are skipped while the generation cache is built, so such a route
can never produce a URL; the old address is matched and then 301-redirected by canonicalization. Router::ONE_WAY still
works but is @deprecated on master – prefer the named argument.
Filters
Route::FilterIn converts URL -> application, FilterOut back; both take either one parameter (a
string) or, under the empty key '', the whole parameter array. Route::FilterTable is a declarative
url => app map for one parameter and Route::FilterStrict => true makes it reject unlisted values.
$router->add
Установить nette-routing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл nette-routing?
Invoke before writing or modifying a router, a RouterFactory or any URL mask in Nette. Use for RouteList, addRoute(), route masks (optional `[...]` parts, `<param regex>` constraints, defaults in the mask), withModule()/withDomain()/withPath(), pretty URLs and slugs, one-way routes for retired URLs, Route::FilterIn/FilterOut/FilterTable/FilterStrict, general filters under the `''` key, fixed parameters, SimpleRouter, the `routing:` NEON section, and canonical-URL redirects (canonicalize(), $autoCanonicalize). Also trigger for "wrong URL is generated", "link points to the wrong route", dots in URLs of a modular app, unexpected 301 redirect loops, or the Tracy routing panel. Not for `n:href`/`{link}` syntax (latte-templates) nor signal links (nette-components).
Как установить скилл nette-routing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл nette-routing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic