/codex:diff-reviewfrom codex
Reviews staged or unstaged git changes via Codex MCP server for bugs, security issues, and style problems. Useful as a final check before committing or when seeking a second opinion on code changes.
Ships in codex. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use Codex to review git changes for bugs, security issues, and style problems. Codex consults; Claude writes.
Always use the MCP tool. The plugin's MCP server (scripts/codex-mcp-server.mjs, started from .mcp.json) runs codex exec for each call. Tool name: mcp__plugin_codex_cli__codex. If the example below errors with an unknown-tool error, run /mcp and substitute the actual prefix (e.g., mcp__codex_cli__codex).
Pin model: "gpt-6.2-sol" with config: { "model_reasoning_effort": "medium" } for non-trivial diffs. For small diffs (~< 100 changed lines, single function, no security surface) use model: "gpt-6-luna" with config: { "model_reasoning_effort": "low" } to save quota. Security- or performance-focused reviews always stay on gpt-6.2-sol at medium — don't downgrade. Set model+effort on the opening call only; codex-reply reuses them unless you escalate. See ../references/patterns.md → Models and Reasoning effort. Escalate to gpt-6.2-astra (pass model + config on the codex-reply) from round 3, when a disagreement survives a round, or when re-reviewing the same diff in a fresh thread — see ../references/patterns.md → Escalating to Astra.
Codex reads files from the project root. Save the diff to a file there first:
git diff --cached > codex-review.diff
Then:
mcp__plugin_codex_cli__codex({
"prompt": "<task>\nReview codex-review.diff for bugs, security issues, and missing error handling. Read the surrounding source files as needed.\n</task>\n\n<structured_output_contract>\nFindings ordered by severity (critical, high, medium, low). For each: file:line, the problem, why it matters, and a concrete fix. If there are no material findings, say so in one line.\n</structured_output_contract>\n\n<grounding_rules>\nGround every finding in the diff or files you read. Label inferences. Skip style nits unless they hide a bug.\n</grounding_rules>\n\n<dig_deeper_nudge>\nAfter the first issue, check error paths, empty state, retries, and concurrency before finishing.\n</dig_deeper_nudge>",
"sandbox": "read-only",
"model": "gpt-6.2-sol",
"config": { "model_reasoning_effort": "medium" }
})
For a large diff, run the review through the codex:consult agent in the background (run_in_background: true); multi-file reviews can take several minutes. To challenge whether the change should ship at all (design, assumptions, failure modes) rather than find defects, use codex:adversarial-review.
Clean up after:
rm codex-review.diff
Uncommitted (staged + unstaged):
git diff HEAD > codex-review.diff
git diff never includes untracked files. If git status --short shows new files that belong to the change, run git add -N <file> first so they appear in the diff.
Branch vs base:
git diff main...HEAD > codex-review.diff
Specific commit:
git show <sha> > codex-review.diff
Security focus:
mcp__plugin_codex_cli__codex({
"prompt": "Security review of codex-review.diff:\n- XSS vulnerabilities\n- SQL/command injection\n- Sensitive data exposure\n- Auth/authz issues",
"sandbox": "read-only",
"model": "gpt-6.2-sol",
"config": { "model_reasoning_effort": "medium" }
})
Performance focus:
mcp__plugin_codex_cli__codex({
"prompt": "Performance review of codex-review.diff:\n- Inefficient algorithms\n- N+1 queries\n- Memory leaks\n- Blocking operations",
"sandbox": "read-only",
"model": "gpt-6.2-sol",
"config": { "model_reasoning_effort": "medium" }
})
codex-reply)When you're still working on the same diff, continue the existing thread rather than starting a new codex call. Codex keeps the diff and its prior findings in context; fresh calls lose that.
Typical loop: initial review → Claude implements a fix → codex-reply asking "does the revised code still have the issue?" → Codex confirms or flags new concern → repeat.
Cap at 3–4 rounds total, and run round 3 onward on gpt-6.2-astra. Diff reviews should converge fast; if you're still going at round 5, stop and surface the remaining disagreement to the user rather than letting the two models debate indefinitely.
threadId is an MCP argument — pass it as the threadId field of codex-reply, not in the prompt text. See ../references/mcp-schema.md for wrong-vs-right examples.
Example — three rounds on the same diff:
# Round 1 — initial review (opening call pins model + effort)
mcp__plugin_codex_cli__codex({
"prompt": "Review codex-review.diff for bugs, security issues, and missing error handling.",
"sandbox": "read-only",
"model": "gpt-6.2-sol",
"config": { "model_reasoning_effort": "medium" }
})
# → threadId: "019da14b-..." / flags: "parseToken doesn't handle malformed JWTs — will throw unhandled."
# Round 2 — Claude fixes and re-exports the updated diff
git diff --cached > codex-review.diff
mcp__plugin_codex_cli__codex-reply({
"threadId": "019da14b-...",
"prompt": "I've re-written codex-review.diff with a fix — please re-read the file. I added a try/catch around parseToken that returns 401 on any JWT parse error. Does this address your concern?"
})
# Round 3 — triage; escalate to gpt-6.2-astra (the thread keeps its history)
mcp__plugin_codex_cli__codex-reply({
"threadId": "019da14b-...",
"prompt": "Of the remaining issues, which are merge-blockers vs. nits we can defer?",
"model": "gpt-6.2-astra",
"config": { "model_reasoning_effort": "medium" }
})
Start a fresh thread when: reviewing a different diff, the threadId is no longer in context, or the diff has diverged so much that re-priming is cleaner than incremental updates. See ../references/patterns.md.
codex review subcommandDon't use this by default — the MCP flow above is the standard path. codex review is a separate, specialized diff-review subcommand that runs in Bash, doesn't go through MCP, and doesn't support --sandbox. Only reach for it when the user explicitly asks for Codex's built-in review output, or when MCP is unavailable:
codex review --uncommitted
codex review --base main
codex review --commit <sha>
Requires dangerouslyDisableSandbox: true.
Codex's findings are a second opinion, not a merge gate — weigh them, don't rubber-stamp them.
../references/patterns.md → Validation). Confirm each issue against the actual code before changing anything.../references/patterns.md → Presenting results.sandbox: "read-only".workspace-write, danger-full-access, or --dangerously-bypass-approvals-and-sandbox.If the MCP server is unavailable, see ../references/commands.md for the Bash codex exec form. Requires dangerouslyDisableSandbox: true.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub robbyt/claude-skills --plugin codex4 skills in this plugin
/adversarial-reviewHave Codex try to break a change before it ships — a skeptical review that challenges the design, assumptions, and failure modes of a diff or branch and returns structured findings (verdict, severity, file:line, confidence). Trigger on "adversarial review", "challenge this change/design with Codex", "pressure-test this before I ship", "have Codex try to break this", "is this safe to merge", or a review focused on a risk area (auth, data loss, rollback, race conditions, retries). Do NOT use for a routine bug/style pass over a diff (that's diff-review), for critiquing a plan before code exists (plan-review), or for mapping architecture (codebase-analysis)./codebase-analysisCodebase analysis via the Codex MCP server with a read-only sandbox. Trigger when user needs architecture overview ("analyze this codebase with Codex", "have Codex map dependencies"), onboarding to unfamiliar code, understanding legacy systems, or identifying technical debt./plan-reviewGet Codex's review of an implementation plan before the user starts building — trigger when they want Codex (or a named GPT model like gpt-6.2-sol) to review, critique, or pressure-test a plan. Applies to any plan-shaped artifact — a plan file, plan-mode plan, a migration/rearchitecture/integration/checkout write-up, or a doc describing how they intend to do something (pasted, at a repo path, or just described). Fire on any second-opinion phrasing — "poke holes in it", "sanity-check my plan", "run this past Codex", "get Codex's take", "flag the biggest risks", "look this over before I start", "did I miss edge cases, testing, or a rollback path?". The point is catching gaps, risks, missing steps, and better alternatives ahead of implementation. Do NOT use for reviewing already-written code or diffs (that's diff-review), mapping an existing codebase's architecture (codebase-analysis), or web/research questions.Other plugins' skills for the same job