Skip to content
Skills Library
Programming · Automation

phx-codex-loop

/phx-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.

Licence
MIT
Last repository change
22.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 22.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

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.

Original author description

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.

How it works

  1. Usage
  2. Iron Laws
  3. Workflow
  4. Integration
  5. References
Original SKILL.md headings · 134 lines, 787 words
SKILL.md preview
---
name: phx-codex-loop
description: 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.
---

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

## Usage

```
/skill:phx-codex-loop                    # diff vs default branch, interactive
/skill:phx-codex-loop --uncommitted      # staged + unstaged + untracked
/skill:phx-codex-loop --base develop     # explicit base branch
/skill:phx-codex-loop --auto             # auto-approve P0/P1/P2, skip P3
/skill: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
   `/skill: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 `/skill: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 `/skill: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):

   ```bash
   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`
   (`/skill: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:

   ```bash
   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

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

## Integration

```text
implement → /skill:phx-codex-loop (YOU ARE HERE) → clean → commit/PR → /skill:phx-watch-pr --codex
     ↑ or arrive from /skill: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)
Files in this package (2)
  • SKILL.md 6 KB
  • references/codex-cli.md 6 KB

Versions

RepositoryScoreLicence
This page · oliver-kriska/claude-elixir-phoenix100MIT
oliver-kriska/claude-elixir-phoenix100MIT
oliver-kriska/claude-elixir-phoenix100MIT
oliver-kriska/claude-elixir-phoenix100MIT

Database snapshot: 13.11.2026 · package version 0202c1640b3f (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100codex-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.
  • 100phx-help
    Recommend the right $elixir-phoenix:phx-* workflow. Use when choosing a plugin skill, not for Codex /help.
  • 95codex-review
    Run OpenAI Codex CLI to review code changes and iterate until clean. Use this skill whenever the user says "codex review", "have codex check", "run codex on that", "codex loop", "review with codex", or asks you to get a second opinion on your commit from Codex/OpenAI. Also use…
  • 100pr-workflow
    Pull request lifecycle: commit, codex review, sync, review, fix, status, cleanup, and PR mining. Use when user wants to commit changes, get a second-opinion code review from Codex, push changes, create a PR, check PR status, fix review comments, clean up branches after merge, or…
  • 100gendiff
    Use elixirstream.dev's gendiff API to see exactly what changed between two versions (and flag sets) of an Elixir/Phoenix code generator, so you upgrade from real diffs instead of guessing. Trigger this whenever the user wants to upgrade or bump Phoenix, phx.new, phx.gen.auth,…
  • 95using-elixir-skills
    This skill should be used when the user works on any .ex or .exs file, mentions Elixir/Phoenix/Ecto/OTP, the project has a mix.exs, or asks "which skill should I use", "new to Elixir", "help with Elixir". Routes to the correct thinking skill BEFORE exploring code. Triggers on…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.