Token导航 LogoToken导航

Agent Skill · 运维和基础设施

phoenix-controllers(Phoenix controllers 命令行)

phoenix-controllers 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

phoenix-controllers 是运维和基础设施类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描已通过,按安装量在运维和基础设施类的 2,449 个 Skill 里排第 1,300。

总安装 682周安装 29GitHub Stars 142下载 239核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

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

这个 Skill 是做什么的

运维和基础设施类 Skill 处理部署、监控、日志和云资源,多数需要较高的执行权限。

用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态或协作事项进行整理。通过 npx skills add 命令从指定仓库安装,需确认权限和维护状态。使用前建议核验是否会触发联网、命令执行或文件读写操作。

phoenix-controllers 属于运维和基础设施类 Skill,可作为该场景下的辅助能力补充。

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

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

phoenix-controllers 怎么安装?

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

phoenix-controllers 支持哪些 AI 工具?

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

phoenix-controllers 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

phoenix-controllers 是免费的吗?

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

phoenix-controllers 用的人多吗?

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

phoenix-controllers 安全吗?

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

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

值得选的地方

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

先想清楚的地方

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

适不适合你

更适合

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

不太适合

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

运维和基础设施类 Skill 对比

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

头脑风暴 · Codex、Claude

3,148,776173,131操作浏览器MIT通过
copywriting

文案写作 · Codex、Claude

1,996,72425,583需要联网MIT通过
openclaw-secure-linux-cloud

OpenClaw secure linux cloud 命令行 · Codex、Claude

1,853,08840接触敏感数据未明确未通过
xget

xget 命令行 · Codex、Claude

1,799,28040执行命令未明确未通过
requesting-code-review

代码审查请求 · Codex、Claude

1,590,144173,103权限未标注MIT通过
phoenix-controllers

Phoenix controllers 命令行 · 本页

682142需要联网MIT通过

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

SKILL.md 原文

Phoenix Controllers

Phoenix controllers are the intermediary modules between the router and views in a Phoenix application. They handle HTTP requests, process parameters, interact with contexts, and determine what response to send back to the client. Controllers are stateless and receive a connection struct (conn) that represents the current HTTP request.

Basic Controller Structure

The simplest Phoenix controller uses the HelloWeb,:controller macro and defines actions as functions that receive the connection and parameters:

defmodule HelloWeb.PageController do
  use HelloWeb, :controller

  def home(conn, _params) do
    render(conn, :home, layout: false)
  end
end

Each controller action receives:

  • conn - The Plug.Conn struct representing the HTTP request/response
  • params - A map containing request parameters from the URL, query string, and request body

Controller Actions and Parameter Handling

Extracting Specific Parameters

Use pattern matching to extract specific parameters from the params map:

defmodule HelloWeb.HelloController do
  use HelloWeb, :controller

  def show(conn, %{"messenger" => messenger}) do
    render(conn, :show, messenger: messenger)
  end
end

Accessing Full Parameter Map

To access both a specific parameter and the full params map, use pattern matching with the = operator:

def show(conn, %{"messenger" => messenger} = params) do
  # Access to both messenger and the full params map
  render(conn, :show, messenger: messenger)
end

Ignoring Parameters

When an action doesn't need parameters, prefix the variable with an underscore to avoid compiler warnings:

def index(conn, _params) do
  render(conn, :home)
end

Renaming Actions

Action names can be customized independently of the template name:

defmodule HelloWeb.PageController do
  use HelloWeb, :controller

  def index(conn, _params) do
    # Renders :home template but action is named :index
    render(conn, :home)
  end
end

Update the router accordingly:

get "/", PageController, :index

Rendering Responses

Rendering HTML Templates

Use the render/3 function to render HTML templates via Phoenix Views:

defmodule HelloWeb.HelloController do
  use HelloWeb, :controller

  def show(conn, %{"messenger" => messenger}) do
    render(conn, :show, messenger: messenger)
  end
end

The controller and view must share a root name (e.g., HelloController and HelloHTML).

Rendering Without Layout

Disable the layout for specific actions:

def home(conn, _params) do
  render(conn, :home, layout: false)
end

Assigning Values to Templates

Using assign/3

Pass data to templates using assign/3:

def show(conn, %{"messenger" => messenger}) do
  conn
  |> assign(:messenger, messenger)
  |> render(:show)
end

Chaining Multiple Assigns

Chain multiple assigns for cleaner code:

def show(conn, %{"messenger" => messenger}) do
  conn
  |> assign(:messenger, messenger)
  |> assign(:receiver, "Dweezil")
  |> render(:show)
end

Passing Assigns Directly to render/3

For concise syntax, pass assigns directly to render/3:

def show(conn, %{"messenger" => messenger}) do
  render(conn, :show, messenger: messenger, receiver: "Dweezil")
end

Configuring Controller Formats

Configure supported response formats in your controller configuration:

def controller do
  quote do
    use Phoenix.Controller,
      formats: [:html, :json]
    ...
  end
end

This allows controllers to respond with different formats based on the request.

Flash Messages

Setting Flash Messages

Use put_flash/3 to set temporary messages:

defmodule HelloWeb.PageController do
  use HelloWeb, :controller

  def home(conn, _params) do
    conn
    |> put_flash(:error, "Let's pretend we have an error.")
    |> render(:home, layout: false)
  end
end

Flash message types:

  • :info - Informational messages
  • :error - Error messages
  • :warning - Warning messages (custom)
  • :success - Success messages (custom)

Clearing Flash Messages

Remove all flash messages from the connection:

clear_flash(conn)

Flash with Redirects

Combine flash messages with redirects to provide context after navigation:

def home(conn, _params) do
  conn
  |> put_flash(:error, "Let's pretend we have an error.")
  |> redirect(to: ~p"/redirect_test")
end

Redirects

Basic Redirect

Redirect to another route using the verified routes syntax:

def create(conn, params) do
  # ... create logic
  redirect(conn, to: ~p"/posts")
end

Redirect with Parameters

Include dynamic parameters in redirects:

def create(conn, params) do
  # ... create post
  redirect(conn, to: ~p"/posts/#{post}")
end

External Redirects

Redirect to external URLs:

def external(conn, _params) do
  redirect(conn, external: "https://example.com")
end

Action Fallback

Action fallback controllers handle error cases elegantly by centralizing error handling logic:

defmodule HelloWeb.MyController do
  use Phoenix.Controller

  action_fallback HelloWeb.MyFallbackController

  def show(conn, %{"id" => id}, current_user) do
    with {:ok, post} <- fetch_post(id),
         :ok <- authorize_user(current_user, :view, post) do
      render(conn, :show, post: post)
    end
  end
end

The fallback controller handles non-ok tuples:

defmodule HelloWeb.MyFallbackController do
  use Phoenix.Controller

  def call(conn, {:error, :not_found}) do
    conn
    |> put_status(:not_found)
    |> put_view(HelloWeb.ErrorHTML)
    |> render(:"404")
  end

  def call(conn, {:error, :unauthorized}) do
    conn
    |> put_status(403)
    |> put_view(HelloWeb.ErrorHTML)
    |> render(:"403")
  end
end

Testing Controllers

HTML Controller Tests

Test controller actions using ConnCase:

defmodule HelloWeb.PostControllerTest do
  use HelloWeb.ConnCase

  import Hello.BlogFixtures

  @create_attrs %{body: "some body", title: "some title"}
  @update_attrs %{body: "some updated body", title: "some updated title"}
  @invalid_attrs %{body: nil, title: nil}

  describe "index" do
    test "lists all posts", %{conn: conn} do
      conn = get(conn, ~p"/posts")
      assert html_response(conn, 200) =~ "Listing Posts"
    end
  end

  describe "show" do
    test "displays a single post", %{conn: conn} do
      post = post_fixture()
      conn = get(conn, ~p"/posts/#{post}")
      assert html_response(conn, 200) =~ post.title
    end
  end
end

Testing Redirects

Assert redirects in tests:

test "redirects after create", %{conn: conn} do
  conn = post(conn, ~p"/posts", post: @create_attrs)
  assert %{id: id} = redirected_params(conn)
  assert redirected_to(conn) == ~p"/posts/#{id}"
end

Testing Flash Messages

Verify flash messages are set correctly:

test "sets flash message on error", %{conn: conn} do
  conn = post(conn, ~p"/posts", post: @invalid_attrs)
  assert get_flash(conn, :error) == "Could not create post"
end

When to Use This Skill

Use this skill when you need to:

  1. Create new controller actions to handle HTTP requests
  2. Process and validate incoming request parameters
  3. Render HTML templates with dynamic data
  4. Implement user feedback with flash messages
  5. Handle redirects after form submissions or actions
  6. Test controller behavior and responses
  7. Implement error handling with action fallbacks
  8. Build RESTful API endpoints
  9. Integrate controller actions with Phoenix contexts
  10. Manage session data and user authentication flows
  11. Handle file uploads and multipart forms
  12. Implement pagination for list views
  13. Create custom response formats (JSON, XML, etc.)
  14. Debug request/response cycles

Best Practices

  1. Keep controllers thin - Move business logic to contexts, keep controllers focused on HTTP concerns
  2. Use pattern matching - Extract only the parameters you need from the params map
  3. Validate early - Validate parameters at the controller level before passing to contexts
  4. Use action fallback - Centralize error handling with action fallback controllers
  5. Leverage pipeline - Use plugs for common operations like authentication and authorization
  6. Be explicit with assigns - Pass only necessary data to templates to avoid exposing sensitive information
  7. Use verified routes - Always use ~p sigil for route paths to catch errors at compile time
  8. Test thoroughly - Write comprehensive tests for all controller actions and edge cases
  9. Handle errors gracefully - Provide meaningful error messages and appropriate HTTP status codes
  10. Use flash messages wisely - Provide clear, actionable feedback to users after actions
  11. Avoid business logic - Controllers should orchestrate, not implement business rules
  12. Return early - Use guard clauses and early returns for cleaner code
  13. Consistent naming - Follow Phoenix conventions for action names (index, show, new, create, edit, update, delete)
  14. Document complex actions - Add comments for non-obvious controller logic
  15. Use structs over maps - Work with structs from contexts rather than raw parameter maps when possible

Common Pitfalls

  1. Putting business logic in controllers - This makes code harder to test and reuse
  2. Not validating parameters - Always validate and sanitize user input
  3. Overusing assigns - Passing entire context modules or large data structures to views
  4. Ignoring error cases - Not handling errors from context functions properly
  5. Hard-coding paths - Using string paths instead of verified routes (~p)
  6. Not using action fallback - Repeating error handling logic across actions
  7. Testing implementation details - Test behavior, not internal implementation
  8. Exposing internal errors - Leaking stack traces or internal errors to users
  9. Not setting status codes - Forgetting to set appropriate HTTP status codes for errors
  10. Mutating params - Attempting to modify the params map instead of using assigns
  11. Skipping CSRF protection - Disabling security features without understanding implications
  12. Large controller files - Creating monolithic controllers instead of splitting concerns
  13. Not using with statements - Missing opportunities to chain operations cleanly
  14. Forgetting content negotiation - Not handling different response formats appropriately
  15. Mixing concerns - Handling both API and HTML responses in the same controller without proper separation

Resources

平台分布

Claude Code

28.82%
按下载量换算69

Antigravity

22.65%
按下载量换算54

windsurf

19.66%
按下载量换算47

OpenCode

14.71%
按下载量换算35

Gemini CLI

7.87%
按下载量换算19

Codex

3.6%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

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

继续浏览同类 Skills