← 返回
未分类 中文

Phoenix Code Review

Reviews Phoenix code for controller patterns, context boundaries, routing, and plugs. Use when reviewing Phoenix apps, checking controllers, routers, or cont...
审查 Phoenix 代码的控制器模式、上下文边界、路由和插件。用于审查 Phoenix 应用,检查控制器、路由器等。
anderskev anderskev 来源
未分类 clawhub v1.2.1 1 版本 100000 Key: 无需
★ 0
Stars
📥 398
下载
💾 1
安装
1
版本
#latest

概述

Phoenix Code Review

Quick Reference

Issue TypeReference
-----------------------
Bounded contexts, Ecto integrationreferences/contexts.md
Actions, params, error handlingreferences/controllers.md
Pipelines, scopes, verified routesreferences/routing.md
Custom plugs, authenticationreferences/plugs.md

Review Checklist

Controllers

  • [ ] Business logic in contexts, not controllers
  • [ ] Controllers return proper HTTP status codes
  • [ ] Action clauses handle all expected patterns
  • [ ] Fallback controllers handle errors consistently

Contexts

  • [ ] Contexts are bounded by domain, not technical layer
  • [ ] Public functions have clear, domain-focused names
  • [ ] Changesets validate all user input
  • [ ] No Ecto queries in controllers

Routing

  • [ ] Verified routes (~p sigil) used, not string paths
  • [ ] Pipelines group related plugs
  • [ ] Resources use only needed actions
  • [ ] Scopes group related routes

Plugs

  • [ ] Authentication/authorization via plugs
  • [ ] Plugs are composable and single-purpose
  • [ ] Halt called after sending response in plugs

JSON APIs

  • [ ] Proper content negotiation
  • [ ] Consistent error response format
  • [ ] Pagination for list endpoints

Valid Patterns (Do NOT Flag)

  • Controller calling multiple contexts - Valid for orchestration
  • Inline Ecto query in context - Context owns its data access
  • Using action_fallback - Centralized error handling pattern
  • Multiple pipelines per route - Composition is intentional
  • Plug.Conn.halt/1 without send - May be handled by fallback

Context-Sensitive Rules

IssueFlag ONLY IF
---------------------
Missing changeset validationField accepts user input AND no validation exists
Controller too largeMore than 7 actions OR actions > 20 lines
Missing authorizationRoute is not public AND no auth plug in pipeline

Gates (run in order; each step has a pass condition)

  1. Anchored evidence — For every planned finding, open the source and note file path + line number from that read (not from memory or diff snippets alone). Pass: each finding cites path:line that you opened.
  2. “Handled elsewhere” sweep — Before reporting “missing validation,” “missing auth,” or “wrong status,” search the router (pipelines/scopes), controller (action_fallback, plug), and relevant context for existing checks. Pass: you recorded whether handling exists elsewhere (yes + where, or no after search).
  3. Verification protocol — Load and apply review-verification-protocol for the issue type. Pass: that skill’s pre-report checks for that finding class are satisfied before you write the finding.
  4. Finding shape — Emit each issue as [FILE:LINE] ISSUE_TITLE with a one-line rationale tied to the cited code. Pass: every line matches that pattern.

Before Submitting Findings

Do not report until Gates above pass. For full anti-false-positive steps, follow review-verification-protocol.

版本历史

共 1 个版本

  • v1.2.1 当前
    2026-05-03 10:05 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Review Verification Protocol

anderskev
在报告任何代码审查结果前,必须先加载此技能,执行所有代码审查的强制验证步骤,以降低误报。
★ 0 📥 738

Rust Testing Code Review

anderskev
审查 Rust 测试代码,包括单元测试模式、集成测试结构、异步测试、模拟方式和属性测试,覆盖 Rust 2024 版。
★ 0 📥 784

Rust Code Review

anderskev
审查 Rust 代码,涵盖所有权、借用、生命周期、错误处理、trait 设计、unsafe 使用及常见错误,适用于 .rs 文件审查,检查...
★ 0 📥 769