بنقرة واحدة
add-route
Add a new route to the Arizona router configuration. Use when creating new pages or endpoints.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Add a new route to the Arizona router configuration. Use when creating new pages or endpoints.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Scaffold a new Arizona handler module. Ask whether it's a route-level view or an embeddable stateful component.
Trace an event through the full Arizona stack from client click to DOM patch. Use when debugging event handling.
Profile Arizona hot paths with eprof/fprof. Use when investigating performance or picking the next optimization.
Add tests for an Arizona module. Use when creating CT suites, inline EUnit tests, or E2E tests.
Format, check, test, and commit changes. Use before committing any code changes.
Debug Arizona stream operations. Use when investigating stream insert/delete/update/move/sort/reset behavior.
| name | add-route |
| description | Add a new route to the Arizona router configuration. Use when creating new pages or endpoints. |
| argument-hint | ["path"] |
| allowed-tools | Read, Edit, Grep, Glob |
Add a route for path $ARGUMENTS to the router configuration.
Search for compile_routes calls to locate where routes are defined (typically in the app module or config).
Choose the appropriate route type based on the user's intent:
Live page (most common):
{live, Path, Handler, Opts}
Path -- route pattern, e.g. <<"/">> or <<"/users/:id">>Handler -- a handler module that includes arizona_stateful.hrl and exports mount/1, render/1Opts -- map with optional keys:
bindings => map() -- initial bindings passed to mount/1 (default #{})layout => {LayoutMod, LayoutFun} -- layout to wrap the page (optional)on_mount => [Hook] -- on_mount hooks run before the handler's mount/1middlewares => [fun((az:request(), map()) -> {cont, az:request(), map()} | {halt, az:request()})]WebSocket endpoint:
{ws, Path, Opts}
Static assets:
{asset, Path, {priv_dir, App, SubDir}}
{asset, Path, {dir, AbsoluteDir}}
Controller (HTTP, method-gated; reached via arizona_js:fetch/2):
{post, Path, Handler, Opts} %% also get/put/patch/delete/head/options
{match, Spec, Path, Handler, Opts} %% multi/custom/any-method (Spec: verb | [verbs] | binary | '*')
Opts is controller_opts(): #{state, action, middlewares, check_origin} (action
defaults to handle). A wrong-verb request gets 405 + Allow.
Also scaffold the handler module using the /new-handler skill pattern (choose "route-level page"):
arizona_stateful.hrlmount/1 takes (Bindings) and must set id => <<"page">> (or appropriate view id); request
data (path bindings, query params) arrives via middlewares => [arizona_middleware:extract([...])]render/1 with ?html(...)handle_event/3 if interactiveAfter adding the route, check that:
layout is specified in opts