Codex code review

From tykisgod/quick-question · View interactive version

Codex code review is an AI agent skill from the GitHub repository tykisgod/quick-question. Cross-model code review via Codex CLI — reviews uncommitted changes by default, loops until no critical issues remain. Use after implementation (e.g. /qq:execute), before /qq:test and /qq:commit-push.

How to use this skill

Skill file

Run qq scripts as ${CLAUDE_PLUGIN_ROOT}/bin/<name>: they are not on PATH, so a bare code-review.sh exits 127.

Respond in the user's preferred language (detect from their recent messages, or fall back to the language setting in CLAUDE.md).

Workflow: take --workflow <name> from $ARGUMENTS if present, else run qq-config.py field workflow. On prototype-loop, run the single round of CODE4 §Code review instead of the loop below (it ends with recording the review and, when the work is finished, §Closeout); on heavy-review (the default), follow this file as written.

Arguments: $ARGUMENTS

Review Scope Selection (no scope argument)

--spec, --prompt, and the other flags do not choose the scope. Unless $ARGUMENTS has --base, --commits, or --files, pick the scope below and pass it along with the other flags. --auto belongs to this skill and the script ignores it; --workflow <name> the script uses only to decide whether to open the review gate.

Default: uncommitted changes. Run { git diff --name-only HEAD -- '*.cs'; git ls-files --others --exclude-standard -- '*.cs'; } | sort -u to get the changed and new files.

Override order:

  1. User specified a scope (e.g. "review Phase 8") → follow user intent
  2. No uncommitted changes but branch has commits → git diff --name-only develop...HEAD -- '*.cs'
  3. User says "review the whole branch" → --base develop

Pass the file list to the review script as --files.

Spec Check

When the changes finish a feature or a milestone, also pass its design doc and plan with --spec (next to the scope from above). The review then also lists what the specs ask for that the code does not do, what it does differently, and protections or restrictions nobody asked for. Skip it for small fixes. Rounds 2+ use the same scope (recomputed the same way, plus every file this review's fixes created or changed) and the same flags, without --spec: the [Spec] items were listed and verified in round 1.

Execution Flow

1. Review Loop

Loop automatically, no need to ask the user each round. Stop when any is true:

Each round:

a. Send to Codex for Review

If qq-policy-check.sh is available, first run it on the same changed .cs files and treat its deterministic findings as established.

Run in the background (Bash tool, run_in_background: true):

${CLAUDE_PLUGIN_ROOT}/bin/code-review.sh $ARGUMENTS

The script runs codex exec on a diff it builds, with the Unity best-practice checklist in the prompt (sent on stdin; long argv is truncated on Windows), at the model's highest reasoning level by default. It always adds a test-quality section (and a spec-conformance section with --spec), even with a custom --prompt; don't repeat them in your round-2 prompt. Results go to stdout and Docs/qq/<branch-name>/codex-code-review_<timestamp>.md.

Override reasoning effort per run with --effort <level> (any level the model supports, e.g. high, xhigh, ultra; config inherits ~/.codex/config.toml) or globally via the QQ_CODEX_EFFORT env var. If Codex answers 400 "model is not supported when using Codex with a ChatGPT account", the CLI is usually older than the model: npm i -g @openai/codex@latest.

A review takes 5-15 minutes and you are notified when it finishes; meanwhile you can keep talking with the user.

From round 2 onward: If the previous round had findings deemed over-engineered, append --prompt to the round-2 arguments (see Spec Check):

${CLAUDE_PLUGIN_ROOT}/bin/code-review.sh <round-2 arguments> --prompt "Review these code changes using the same criteria as round 1 (bugs, architecture, performance, security, style). Additional context: the following suggestions from the previous round were deemed over-engineered and replaced with simpler solutions: <list items and rationale>. Do not re-suggest more complex approaches unless the simpler version introduces a real defect. Classify by severity: [Critical] [Moderate] [Suggestion]."
b. Read and Summarize Review Results

Read the output file and summarize the findings for the user by severity ([Critical], [Moderate], [Suggestion]), with any [Spec] items (only with --spec) listed apart from the severities.

c. Independent Verification

Verify every critical and moderate finding with a subagent, not with a quick look of your own. Verify Missing, Wrong, and Unrequested [Spec] items the same way, passing the spec paths. Needs-runtime-check items and the not-due-yet line are not verified: give the user at most 5 runtime checks (the likeliest to be wrong); the rest stay in the review file.

In a Unity project, work out the live Editor channel once — qq-unity-cli.py channel --project "$PWD" prints unity-cli (calls go through unity command --project-path "$PWD" --json --no-banner …), tykit or none; see CODE5 — and name it in each verifier's prompt (on tykit, also give it CODE7). Item 7 of the verification prompt says how a verifier uses it.

Dispatch the verifiers with the Agent tool (subagent_type: "general-purpose", model: "opus"). By default hand all of this round's findings to one verifier, which gives a verdict for each; split them into a few groups verified in parallel only when there are too many for one agent to check properly. Each prompt must include the original findings (verbatim), relevant file paths, and the instructions from ../../shared/verification-prompt.md.

The review script leaves a gate: Edit/Write on .cs and Docs/*.md files stays blocked until you write the number of verifiers to it and that many have returned. Write it right after dispatching them:

source "${CLAUDE_PLUGIN_ROOT}/scripts/platform/detect.sh"
if qq_session_id && [[ -f "$QQ_TEMP_DIR/review-gate-$QQ_SESSION_ID" ]]; then
  IFS=: read -r ts count _ < "$QQ_TEMP_DIR/review-gate-$QQ_SESSION_ID"
  echo "${ts}:${count}:N" > "$QQ_TEMP_DIR/review-gate-$QQ_SESSION_ID"
fi

(N = the number of verification subagents dispatched. The gate file is per session; if this session has none, there is nothing to write.)

Aggregation: After all subagents return, present each finding's verdict and evidence to the user.

d. Fix the Code

Test failures unrelated to this change (e.g. existing bugs in other modules): ask the user whether to investigate and fix them, or note them and continue the review. Don't decide on your own that they can be skipped.

e. Determine Whether to Continue

Output === Round N/5 === at the start of each round.

2. Clean Up Gate

After the review loop ends, close the review gate.

If the review passed, meaning the loop ended with no confirmed [Critical] left unfixed (rejected ones don't count), first record that for this session so /qq:go stops recommending the review. Do it even when a round had nothing to verify: no verifier was dispatched then, so nothing else writes this record. Skip it when 5 rounds ran out with a confirmed [Critical] still open, or when one is waiting on the user's decision:

"${CLAUDE_PLUGIN_ROOT}/bin/qq-run-record.py" record --project . --stage review_gate --command "/qq:codex-code-review" --status verified --state-only

Then, however the loop ended, remove the gate:

source "${CLAUDE_PLUGIN_ROOT}/scripts/platform/detect.sh"
if qq_session_id; then rm -f "$QQ_TEMP_DIR/review-gate-$QQ_SESSION_ID"; fi

Handoff

After the review loop ends, recommend the next step:

--auto mode: run qq-execute-checkpoint.py pipeline-advance --project . --completed-skill "/qq:codex-code-review" --next-skill "/qq:test", then invoke /qq:test --auto.

Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.