Skip to main content

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.

v1.0.0New

Unsigned, install at your own risk

Unverified

This skill has no cryptographic signature attached. We can't verify the contents match what the publisher intended.

Install this skill

No account required. Pick your tool, or use the command that detects it for you.

Run in your terminal. It detects your AI tool.

npx @skills-hub-ai/cli install elixir-phoenix-codex-loop
Or get the file:
Browse all CLI commands →
Manual setup by platform

Claude Code

~/.claude/skills/elixir-phoenix-codex-loop/SKILL.md

Setup guide →
0Save

Instructions

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: 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
    (/phx:init). Parse the output file, NOT the exit code (0 even with
    findings). Recipes: ${CLAUDE_SKILL_DIR}/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 /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; model fallback 0.162.1)
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Reviews (0)

Browse all →

More from Elixir & Phoenix

View source →

More Build skills

Browse category →
senior-frontendBuild and review React, Next.js, TypeScript or Tailwind frontends: components, scaffolding, performance and bundle size. Use whenever the user wants a new component or app, a page feels slow, the bundle is too big, or asks for a frontend code review.635 installsui-design-systemUse when building a design system: tokens, component docs, responsive scales or developer handoff. Generates tokens with design_token_generator.py.535 installsfrontend-designGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.346 installssenior-backendBuild and fix backend services: REST or GraphQL APIs, auth, microservices, PostgreSQL queries, migrations and load tests. Use whenever the user's API is slow or broken, needs login or auth added, a schema change, or a new endpoint or service scaffolded.246 installsself-improving-agentCurate what the agent has learned into durable project knowledge. Reviews Claude Code auto-memory (MEMORY.md and its topic files) for learnings worth keeping, promotes proven ones into CLAUDE.md or .claude/rules/, records a correction as a lesson that persists across sessions, prunes stale or duplicate entries, and turns a recurring fix into a reusable skill. Use whenever the user asks what you have learned or saved about the project, which memories should become permanent rules, to remember a lesson or stop repeating a mistake, or to clean up, audit or check memory health.173 installsusing-superpowersUse when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions145 installs

Frequently asked questions about codex-loop

What does the codex-loop skill do?

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. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the codex-loop skill?

Run `npx @skills-hub-ai/cli install elixir-phoenix-codex-loop` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/elixir-phoenix-codex-loop/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does codex-loop work with?

codex-loop runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the codex-loop skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use codex-loop after installing it?

In Claude Code, type `/elixir-phoenix-codex-loop` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the codex-loop skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.