Token导航 LogoToken导航

Agent Skill · 前端设计

phoenix-routing(Phoenix routing 前端)

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

phoenix-routing 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证为 MIT,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 6,472。

总安装 499周安装 20GitHub Stars 142下载 162核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:phoenix-routing(Phoenix routing 前端)
来源仓库:https://github.com/thebushidocollective/han
仓库路径:skills/phoenix-routing
安装命令:
npx skills add https://github.com/thebushidocollective/han --skill phoenix-routing
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/thebushidocollective/han --skill phoenix-routing

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。适合生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码。使用时需要结合项目现有设计系统、路由和构建方式,避免生成孤立片段。涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

phoenix-routing 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

来源仓库内路径:skills/phoenix-routing

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/thebushidocollective/han --skill phoenix-routi…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

phoenix-routing 怎么安装?

在终端执行 npx skills add https://github.com/thebushidocollective/han --skill phoenix-routing。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

phoenix-routing 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

phoenix-routing 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

phoenix-routing 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

phoenix-routing 用的人多吗?

公开数据是累计安装 499 次,近一周安装 20 次,下载 162 次,GitHub 142 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

phoenix-routing 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
phoenix-routing

Phoenix routing 前端 · 本页

499142操作浏览器MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Phoenix Routing

Phoenix routing maps incoming HTTP requests to controller actions. The router is the entry point for all web requests and determines which controller action should handle each request. Phoenix provides powerful routing macros for RESTful resources, scopes, pipelines, and verified routes.

Basic Route Declaration

Single Routes

Define individual routes using HTTP verb macros:

get "/", PageController, :home

Phoenix supports all standard HTTP verbs:

get "/users", UserController, :index
post "/users", UserController, :create
patch "/users/:id", UserController, :update
put "/users/:id", UserController, :update
delete "/users/:id", UserController, :delete

Routes with Dynamic Segments

Capture URL parameters using the :param_name syntax:

get "/hello/:messenger", HelloController, :show

The :messenger segment becomes available in the controller's params map.

Resource Routes

Basic Resource Declaration

Generate all standard RESTful routes with the resources macro:

resources "/users", UserController

This generates eight routes:

GET     /users           UserController :index
GET     /users/:id/edit  UserController :edit
GET     /users/new       UserController :new
GET     /users/:id       UserController :show
POST    /users           UserController :create
PATCH   /users/:id       UserController :update
PUT     /users/:id       UserController :update
DELETE  /users/:id       UserController :delete

Limiting Resource Routes

Use :only to generate specific routes:

resources "/users", UserController, only: [:show]
resources "/posts", PostController, only: [:index, :show]

Use :except to exclude specific routes:

resources "/users", UserController, except: [:create, :delete]

Aliasing Resources

Customize the route path helper name with :as:

resources "/users", UserController, as: :person

This generates path helpers like ~p"/person" instead of ~p"/users".

Nested Resources

Create hierarchical resource relationships:

resources "/users", UserController do
  resources "/posts", PostController
end

Generated routes include the parent resource ID:

GET     /users/:user_id/posts           PostController :index
GET     /users/:user_id/posts/:id/edit  PostController :edit
GET     /users/:user_id/posts/new       PostController :new
GET     /users/:user_id/posts/:id       PostController :show
POST    /users/:user_id/posts           PostController :create
PATCH   /users/:user_id/posts/:id       PostController :update
PUT     /users/:user_id/posts/:id       PostController :update
DELETE  /users/:user_id/posts/:id       PostController :delete

Verified Routes

Using the ~p Sigil

Phoenix provides compile-time verified routes using the ~p sigil:

# Static paths
~p"/users"
~p"/posts/new"

# Dynamic segments with variables
~p"/users/#{user_id}"
~p"/users/#{user_id}/posts/#{post_id}"

Verified Routes with Structs

Pass structs directly to generate paths:

~p"/users/#{@user}"
# Generates: "/users/42"

~p"/users/#{user}/posts/#{post}"
# Generates: "/users/42/posts/17"

Phoenix automatically extracts the ID using the Phoenix.Param protocol.

Benefits of Verified Routes

  1. Compile-time validation - Catch routing errors during compilation
  2. Refactoring safety - Route changes are caught immediately
  3. Type safety - Ensure correct parameter types
  4. URL slug support - Easy transition to slug-based URLs

Scopes

Basic Scopes

Group routes under a common path prefix:

scope "/admin", HelloWeb.Admin do
  pipe_through :browser

  resources "/users", UserController
end

Generated paths include the scope prefix:

~p"/admin/users"

Scopes with Aliases

Reduce repetition by aliasing controller modules:

scope "/", HelloWeb do
  pipe_through :browser

  get "/", PageController, :home
  resources "/posts", PostController
end

Nested Scopes

Create hierarchical route organization:

scope "/api", HelloWeb.Api, as: :api do
  pipe_through :api

  scope "/v1", V1, as: :v1 do
    resources "/users", UserController
  end

  scope "/v2", V2, as: :v2 do
    resources "/users", UserController
  end
end

Generated path helpers reflect the nesting:

~p"/api/v1/users"
~p"/api/v2/users"

Pipelines

Defining Pipelines

Pipelines group plugs that run for specific routes:

pipeline :browser do
  plug :accepts, ["html"]
  plug :fetch_session
  plug :fetch_live_flash
  plug :put_root_layout, html: {HelloWeb.Layouts, :root}
  plug :protect_from_forgery
  plug :put_secure_browser_headers
end

pipeline :api do
  plug :accepts, ["json"]
end

Applying Pipelines to Scopes

Use pipe_through to apply pipelines:

scope "/", HelloWeb do
  pipe_through :browser

  get "/", PageController, :home
  resources "/users", UserController
end

scope "/api", HelloWeb.Api do
  pipe_through :api

  resources "/users", UserController
end

Custom Plugs in Pipelines

Add application-specific plugs:

pipeline :browser do
  plug :accepts, ["html"]
  plug :fetch_session
  plug :fetch_live_flash
  plug :put_root_layout, html: {HelloWeb.Layouts, :root}
  plug :protect_from_forgery
  plug :put_secure_browser_headers
  plug HelloWeb.Plugs.Locale, "en"
end

Nesting Pipelines

Compose pipelines for complex authentication flows:

pipeline :auth do
  plug :browser
  plug :ensure_authenticated_user
  plug :ensure_user_owns_review
end

scope "/reviews", HelloWeb do
  pipe_through :auth

  resources "/", ReviewController
end

This applies the :browser pipeline first, then the authentication plugs.

Advanced Pipeline Patterns

Session Management Pipeline

Create a pipeline for session-based features:

pipeline :browser do
  plug :accepts, ["html"]
  plug :fetch_session
  plug :fetch_live_flash
  plug :put_root_layout, html: {HelloWeb.Layouts, :root}
  plug :protect_from_forgery
  plug :put_secure_browser_headers
  plug :fetch_current_scope_for_user
end

defp fetch_current_scope_for_user(conn, _opts) do
  if id = get_session(conn, :scope_id) do
    assign(conn, :current_scope, MyApp.Scope.for_id(id))
  else
    id = System.unique_integer()

    conn
    |> put_session(:scope_id, id)
    |> assign(:current_scope, MyApp.Scope.for_id(id))
  end
end

Multi-tenant Routing

Assign organization context from URL parameters:

pipeline :browser do
  plug :accepts, ["html"]
  plug :fetch_session
  plug :fetch_live_flash
  plug :put_root_layout, html: {HelloWeb.Layouts, :root}
  plug :protect_from_forgery
  plug :put_secure_browser_headers
  plug :fetch_current_scope_for_user
  plug :assign_org_to_scope
end

defp assign_org_to_scope(conn, _opts) do
  case conn.params["org"] do
    nil -> conn
    org_slug ->
      scope = conn.assigns.current_scope
      org = MyApp.Organizations.get_by_slug!(org_slug)
      assign(conn, :current_scope, Map.put(scope, :organization, org))
  end
end

Shopping Cart Pipeline

Fetch or create a cart for the current session:

pipeline :browser do
  plug :accepts, ["html"]
  plug :fetch_session
  plug :fetch_live_flash
  plug :put_root_layout, html: {HelloWeb.Layouts, :root}
  plug :protect_from_forgery
  plug :put_secure_browser_headers
  plug :fetch_current_scope_for_user
  plug :fetch_current_cart
end

alias MyApp.ShoppingCart

defp fetch_current_cart(%{assigns: %{current_scope: scope}} = conn, _opts)
    when not is_nil(scope) do
  if cart = ShoppingCart.get_cart(scope) do
    assign(conn, :cart, cart)
  else
    {:ok, new_cart} = ShoppingCart.create_cart(scope, %{})
    assign(conn, :cart, new_cart)
  end
end

defp fetch_current_cart(conn, _opts), do: conn

Forwarding

Forward to Plugs

Delegate a path prefix to another plug or application:

defmodule HelloWeb.Router do
  use HelloWeb, :router

  scope "/", HelloWeb do
    pipe_through :browser
    get "/", PageController, :home
  end

  forward "/jobs", BackgroundJob.Plug
end

All requests to /jobs/* are handled by BackgroundJob.Plug.

Common Forward Use Cases

# Admin interface
forward "/admin", HelloWeb.AdminRouter

# API documentation
forward "/api/docs", PhoenixSwagger.Plug.SwaggerUI

# Background job dashboard
forward "/jobs", Oban.Web.Router

Inspecting Routes

Using mix phx.routes

View all defined routes in your application:

mix phx.routes

Output shows HTTP verb, path, controller, and action:

GET     /                HelloWeb.PageController :home
GET     /users           HelloWeb.UserController :index
GET     /users/:id/edit  HelloWeb.UserController :edit
GET     /users/new       HelloWeb.UserController :new
GET     /users/:id       HelloWeb.UserController :show
POST    /users           HelloWeb.UserController :create
PATCH   /users/:id       HelloWeb.UserController :update
PUT     /users/:id       HelloWeb.UserController :update
DELETE  /users/:id       HelloWeb.UserController :delete

Filtering Routes

Grep for specific routes:

mix phx.routes | grep users
mix phx.routes | grep POST

Building Paths Programmatically

Static Paths

Build static paths easily:

~p"/users"
# Returns: "/users"

~p"/posts/new"
# Returns: "/posts/new"

Paths with Integer IDs

Interpolate IDs directly:

user_id = 42
post_id = 17
~p"/users/#{user_id}/posts/#{post_id}"
# Returns: "/users/42/posts/17"

Paths with Structs

Let Phoenix extract IDs from structs:

~p"/users/#{user}/posts/#{post}"
# Returns: "/users/42/posts/17"

This uses the Phoenix.Param protocol to extract the ID.

Custom Param Implementation

Implement custom URL generation for structs:

defimpl Phoenix.Param, for: MyApp.Blog.Post do
  def to_param(%{slug: slug}), do: slug
end

# Now this generates slug-based URLs:
~p"/posts/#{post}"
# Returns: "/posts/my-great-post"

Router Configuration Example

Complete Router Setup

A typical Phoenix router includes multiple pipelines and scopes:

defmodule HelloWeb.Router do
  use HelloWeb, :router

  pipeline :browser do
    plug :accepts, ["html"]
    plug :fetch_session
    plug :fetch_live_flash
    plug :put_root_layout, html: {HelloWeb.Layouts, :root}
    plug :protect_from_forgery
    plug :put_secure_browser_headers
  end

  pipeline :api do
    plug :accepts, ["json"]
  end

  scope "/", HelloWeb do
    pipe_through :browser

    get "/", PageController, :home
    get "/hello", HelloController, :index
    get "/hello/:messenger", HelloController, :show
  end

  scope "/api/v1", HelloWeb.Api.V1, as: :api_v1 do
    pipe_through :api

    resources "/users", UserController, only: [:index, :show]
  end

  # Admin interface
  scope "/admin", HelloWeb.Admin, as: :admin do
    pipe_through [:browser, :admin_auth]

    resources "/users", UserController
    resources "/posts", PostController
  end

  # Enable LiveDashboard in development
  if Mix.env() in [:dev, :test] do
    import Phoenix.LiveDashboard.Router

    scope "/" do
      pipe_through :browser
      live_dashboard "/dashboard", metrics: HelloWeb.Telemetry
    end
  end
end

When to Use This Skill

Use this skill when you need to:

  1. Define new routes for controllers and actions
  2. Create RESTful resource routes for CRUD operations
  3. Organize routes with scopes and namespaces
  4. Build nested resource relationships
  5. Configure request processing pipelines
  6. Generate verified route paths in controllers and templates
  7. Implement API versioning with scoped routes
  8. Debug routing issues and inspect available routes
  9. Forward requests to external plugs or applications
  10. Implement custom URL slug generation
  11. Set up authentication and authorization pipelines
  12. Create multi-tenant routing architectures
  13. Build admin interfaces with separate scopes
  14. Configure different response formats (HTML, JSON, etc.)

Best Practices

  1. Use verified routes - Always use ~p sigil for compile-time safety
  2. Group related routes - Use scopes to organize routes logically
  3. Limit resource actions - Only generate routes you actually need
  4. Name scopes clearly - Use descriptive scope prefixes and aliases
  5. Keep pipelines focused - Each pipeline should have a single responsibility
  6. Order routes carefully - More specific routes should come before general ones
  7. Use resources - Prefer resources over individual route declarations
  8. Document custom routes - Add comments for non-standard routing patterns
  9. Avoid deep nesting - Limit nested resources to 2-3 levels maximum
  10. Version APIs - Use scopes for API versioning
  11. Secure sensitive routes - Apply authentication pipelines appropriately
  12. Test route resolution - Verify routes resolve to correct controllers
  13. Use forward wisely - Forward to well-defined plug interfaces
  14. Inspect regularly - Use mix phx.routes during development
  15. Follow conventions - Stick to RESTful conventions for resources

Common Pitfalls

  1. Hardcoding paths - Using strings instead of verified routes
  2. Over-nesting resources - Creating deeply nested resource hierarchies
  3. Missing pipeline - Forgetting to pipe routes through required pipelines
  4. Wrong route order - General routes catching specific route requests
  5. Exposing all actions - Generating unnecessary CRUD routes
  6. Not using scopes - Repeating controller module prefixes
  7. Inconsistent naming - Mixing naming conventions for routes
  8. Skipping CSRF protection - Removing security plugs without understanding implications
  9. Missing authentication - Not protecting sensitive routes
  10. Duplicate routes - Defining the same route in multiple places
  11. Incorrect HTTP verbs - Using wrong verbs for actions (GET for destructive actions)
  12. Not testing routes - Failing to verify route configuration
  13. Exposing internal routes - Making debug/admin routes available in production
  14. Complex route logic - Putting business logic in route definitions
  15. Ignoring route conflicts - Not checking for overlapping route patterns

Resources

平台分布

OpenCode

27.52%
按下载量换算45

Codex

23.51%
按下载量换算38

Claude Code

18.85%
按下载量换算31

Antigravity

11.21%
按下载量换算18

windsurf

7.75%
按下载量换算13

trae

3.63%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills