跳到正文
cccskills
免费在 GitHub 公开

phx-codex-loop

Fix Elixir/Phoenix code until Codex CLI review comes back clean; Use when codex is installed and you want an external…

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(2)

  • SKILL.md5.6 KB
  • references/codex-cli.md5.8 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Codex Loop (fix until clean)

Critic→Refiner loop with the Codex CLI as external critic: review → fix approved findings → verify → re-review, until codex is clean or rounds run out. Codex reviews; Claude fixes. Complements $elixir-phoenix:phx-review (Claude panel) — run either or both before a PR.

Usage

$elixir-phoenix:phx-codex-loop                    # diff vs default branch, interactive
$elixir-phoenix:phx-codex-loop --uncommitted      # staged + unstaged + untracked
$elixir-phoenix:phx-codex-loop --base develop     # explicit base branch
$elixir-phoenix:phx-codex-loop --auto             # auto-approve P0/P1/P2, skip P3
$elixir-phoenix:phx-codex-loop --max-rounds 2     # default 3

Iron Laws

  1. BOUNDED rounds — never exceed --max-rounds (default 3) — each round costs codex quota; report remaining findings instead of looping on
  2. Verify BEFORE re-review — mix compile --warnings-as-errors + tests must pass before burning a codex round on broken code
  3. NEVER commit or push — leave git to the user
  4. Codex findings get Iron Law scrutiny — decline suggestions that violate an Iron Law, with explanation in the round report
  5. Skipped findings are reported, never dropped — every finding ends as fixed, declined (with reason), or deferred-by-user
  6. Missing CLI stops the skill with an install hint — suggest $elixir-phoenix:phx-review as the codex-free alternative; never crash

Workflow

Step 1: Preflight

Run command -v codex. If missing: STOP. Show the install hint (brew install codex or npm i -g @openai/codex, then codex login; codex doctor to diagnose) and suggest $elixir-phoenix:phx-review.

Then two cheap checks that save review rounds:

  • Dirty tree (git status --short, only when using --base): codex inspects working-tree state too and WILL flag local dirt (stray edits, dirty submodules) as findings. Surface the dirt and ask: clean/stash first, or proceed knowing round 1 may spend findings on it.
  • Missing rubric: if AGENTS.md has no ## Review guidelines section, note once that $elixir-phoenix:phx-init installs the Elixir rubric that steers codex priorities — then proceed (it works without, on defaults).

Step 2: Detect Diff Mode

  • Flag passed (--base/--uncommitted) → use as given
  • Commits ahead of the default branch → --base {default}
  • No commits yet → --uncommitted

Step 3: Review Round (max --max-rounds, default 3)

  1. Review — ONE foreground Bash call, explicit timeout: 600000 (large diffs run 10+ min). On timeout with the process alive: ONE until [ -f {out} ]; do sleep 5; done wait — never poll-spam or pkill a running review (quota is spent either way). ALWAYS silence the streams — only the -o file matters (10k+ lines otherwise):

    codex exec review --base {branch} --ephemeral \
      -o /tmp/codex-round-{n}.md > /tmp/codex-round-{n}.log 2>&1
    

    NEVER pass custom instructions with a diff-mode flag — the CLI rejects the combination; the rubric comes from AGENTS.md ## Review guidelines ($elixir-phoenix:phx-init). Parse the output file, NOT the exit code (0 even with findings). Recipes: references/codex-cli.md.

    Retired model (exit 1, no -o file, log: model is not supported / Model not found): resolve the account default — MODEL=$(codex debug models | jq -r '.models | map(select(.visibility == "list")) | sort_by(.priority) | .[0].slug') — retry once with -m "$MODEL" -c review_model="$MODEL" (both: a pinned review_model beats -m), reuse it every round, never hardcode a slug. Tell the user once to set model/review_model = "$MODEL" in ~/.codex/config.toml.

  2. Clean check — parse the output file; no - [P{n}] bullets means CLEAN → go to Step 5.

Step 4: Triage, Fix, Verify

  1. Triage — emit the findings table (# | P | file:line | title | proposed action) as visible response text BEFORE any AskUserQuestion call — a table composed only in thinking never renders. Then ask approve-or-skip per finding (AskUserQuestion). With --auto: approve P0/P1/P2, skip P3 (list skipped in the round report).

  2. Fix — apply approved fixes with user-visible diffs. Check each against Iron Laws first (Law 4).

  3. Verify — scoped, before the next round:

    mix format {changed_files} && \
    mix compile --warnings-as-errors && mix test {affected_tests}
    

    If verification fails 3 times, STOP with a BLOCKER report — do not burn another codex round on broken code.

  4. Next round (n+1) — back to Step 3.

Step 5: Final Report

## Codex Loop Report — {CLEAN | MAX ROUNDS REACHED | BLOCKED}
Rounds: {n}/{max} | Fixed: {n} | Declined (Iron Law): {n} | Deferred: {n}
{per-round: findings → outcome}
{remaining findings if not CLEAN}

On CLEAN: suggest $elixir-phoenix:phx-compound for non-obvious fixes, then commit/PR. On MAX ROUNDS: list remaining findings; offer $elixir-phoenix:phx-plan to convert them into a follow-up plan.

Integration

implement → $elixir-phoenix:phx-codex-loop (YOU ARE HERE) → clean → commit/PR → $elixir-phoenix:phx-watch-pr --codex
     ↑ or arrive from $elixir-phoenix:phx-review --codex verdict REQUIRES CHANGES

References

  • references/codex-cli.md — invocation recipes, parse patterns, verified gotchas (CLI 0.142.5; model fallback 0.162.1)

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

analyze

免费

Analyze a legacy app in any language before rewriting it in Elixir: inventory, features as goals, why each mechanism exists, runtime topology, external contracts. Use to start or refresh a rewrite.

中文简介正在准备中。当前显示原文说明。

oliver-kriska/claude-elixir-phoenix5672026年10月17日 更新

architect

免费

Design the idiomatic Elixir architecture for a rewrite: set the compatibility bar (ADR-000), consult phx specialists on open questions, then build contexts, ledger and ADRs. Use after /rewrite:analyze.

中文简介正在准备中。当前显示原文说明。

oliver-kriska/claude-elixir-phoenix5672026年10月17日 更新

Ash Framework — resources, actions, policies, aggregates; Use when generating resources via mix ash.codegen, editing…

中文简介正在准备中。当前显示原文说明。

oliver-kriska/claude-elixir-phoenix5672026年10月17日 更新

Ash Framework — resources, actions, policies, aggregates, calculations, AshPhoenix.Form, LiveView, migrations. Use when generating resources via mix ash.codegen, editing changes, checks, types, validations, or domain code interfaces.

中文简介正在准备中。当前显示原文说明。

oliver-kriska/claude-elixir-phoenix5672026年10月17日 更新

assigns

免费

Compatibility alias for the Elixir/Phoenix plugin's LiveView assigns audit. Invoke explicitly with /lv:assigns.

中文简介正在准备中。当前显示原文说明。

oliver-kriska/claude-elixir-phoenix5672026年10月17日 更新

Inspect LiveView socket assigns for memory bloat — missing temporary_assigns, unused assigns, unbounded lists needing streams, memory estimates. Use when LiveView memory grows or you need to add temporary_assigns.

中文简介正在准备中。当前显示原文说明。

oliver-kriska/claude-elixir-phoenix5672026年10月17日 更新

查看 oliver-kriska 的全部技能

报告此技能的问题