Skip to content
FunCoding

Search

Search docs, Skills and MCP

codex-loop

Fix Elixir/Phoenix code until Codex CLI review comes back clean — bounded review, fix, verify loop before opening a PR. Use when codex is installed and you want an external cross-model critic on your changes before pushing.

AI 与智能体565plugins/elixir-phoenix/skills/codex-loop/SKILL.md

Install

Send this to Claude Code, Codex or Cursor. The agent checks the Skill for safety first and installs it only after you confirm.

读取 https://funcoding.ai/skills/oliver-kriska/claude-elixir-phoenix/codex-loop/install.md ,按里面的步骤帮我安装这个 Skill。

SKILL.md

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 /phx:review (Claude panel) — run either or both before a PR.

Usage

/phx:codex-loop                    # diff vs default branch, interactive
/phx:codex-loop --uncommitted      # staged + unstaged + untracked
/phx:codex-loop --base develop     # explicit base branch
/phx:codex-loop --auto             # auto-approve P0/P1/P2, skip P3
/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 /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 /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 /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: Round Loop (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 (/phx:init). Parse the output file, NOT the exit code (0 even with findings). Recipes: ${CLAUDE_SKILL_DIR}/references/codex-cli.md.

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

  3. 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).

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

  5. 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.

  6. Next round (n+1).

Step 4: 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 /phx:compound for non-obvious fixes, then commit/PR. On MAX ROUNDS: list remaining findings; offer /phx:plan to convert them into a follow-up plan.

Integration

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

References

  • ${CLAUDE_SKILL_DIR}/references/codex-cli.md — invocation recipes, parse patterns, verified gotchas (CLI 0.142.5)

Similar Skills

brand-guidelines
anthropics/skills180k

brand-guidelines

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

AI & agents

internal-comms
anthropics/skills180k

internal-comms

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

AI & agents

template-skill
anthropics/skills180k

template-skill

Replace with description of the skill and when Claude should use it.

AI & agents

mcp-builder
anthropics/skills180k

mcp-builder

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

AI & agents

algorithmic-art
anthropics/skills180k

algorithmic-art

Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.

AI & agents

academy-guide
anthropics/skills180k

academy-guide

Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content.

AI & agents