// Use OpenAI's Codex CLI as an independent code reviewer to provide second opinions on code implementations, architectural decisions, code specifications, and pull requests. Trigger when users request code review, second opinion, independent review, architecture validation, or mention Codex review. Provides unbiased analysis using GPT-5-Codex model through the codex exec command for non-interactive reviews.
| name | codex-reviewer |
| description | Use OpenAI's Codex CLI as an independent code reviewer to provide second opinions on code implementations, architectural decisions, code specifications, and pull requests. Trigger when users request code review, second opinion, independent review, architecture validation, or mention Codex review. Provides unbiased analysis using GPT-5-Codex model through the codex exec command for non-interactive reviews. |
This skill enables Claude to leverage OpenAI's Codex CLI as an independent third-party reviewer for code, architectural decisions, and specifications. Codex runs as a separate AI agent with GPT-5-Codex, providing an unbiased second opinion to improve code quality and catch issues that might be missed in single-reviewer scenarios.
Use this skill when:
Before using this skill, verify:
which codex)Identify what needs review:
Use codex exec for non-interactive reviews. The command runs Codex in a separate, isolated session:
Basic syntax:
codex exec [flags] "review prompt"
Key flags:
--model gpt-5-codex: Use the specialized coding model (recommended)--sandbox read-only: Always use this for reviews - provides read-only access (required for review-only workflow)-a/--ask-for-approval <mode>: Control when to ask for approval before actions (never, on-request, on-failure, always)
-a never or omit (defaults to appropriate mode based on sandbox)--json: Output structured JSON events for parsing (useful with jq or --output-schema)--output-schema <path>: Output structured summary as JSON matching provided schema--full-auto: Convenience flag that expands to --sandbox workspace-write -a on-failure - Do not use for review-only workflows-o output.txt: Write final message to file--profile <name>: Use saved configuration profile (useful for team defaults)--cd <path>: Change to specified directory before running (useful for scoping repos)--skip-git-repo-check: Skip git repository validation (useful for spec-only reviews)Input methods:
For longer or reusable prompts, you can:
codex exec --model gpt-5-codex --sandbox read-only - < review-prompt.txtcodex exec --profile review "Review src/auth.py" (profiles can set model, sandbox, and other defaults)Parse Codex's response for:
Provide the user with:
Review a specific implementation:
codex exec --model gpt-5-codex --sandbox read-only "Review the file src/auth/login.py for security issues, bugs, and code quality. Look for authentication vulnerabilities, injection risks, and edge cases."
Compare branches and review changes:
codex exec --model gpt-5-codex --sandbox read-only "First run 'git diff main...HEAD' to see all changes in the current branch. Then review those changes focusing on: 1) Breaking changes, 2) Performance implications, 3) Test coverage, 4) Security concerns. Provide detailed feedback on each modified file with specific line references."
For multi-repo or complex PR reviews:
codex exec --model gpt-5-codex --sandbox read-only --cd /path/to/repo "Run 'git status' and 'git diff main...HEAD' to understand the PR scope. Review all modified files for correctness, security issues, and adherence to project patterns."
Validate design decisions:
codex exec --model gpt-5-codex --sandbox read-only "Review the architecture described in docs/ARCHITECTURE.md and the implementation in src/. Are there any inconsistencies? Does the implementation follow the intended design? Suggest improvements."
Check if code matches spec:
codex exec --model gpt-5-codex --sandbox read-only "Compare the specification in SPEC.md with the implementation in src/api/. Does the code correctly implement all specified requirements? Are there any deviations or missing features?"
Review spec quality with code context:
codex exec --model gpt-5-codex --sandbox read-only --skip-git-repo-check "Review the specification in docs/FEATURE_SPEC.md. Then examine the existing codebase in src/ to understand current patterns, architecture, and constraints. Evaluate if the spec is: 1) Complete and clear, 2) Consistent with existing code patterns, 3) Technically feasible, 4) Missing any edge cases or requirements."
Target specific concerns:
codex exec --model gpt-5-codex --sandbox read-only "Review src/database/ focusing only on: 1) SQL injection vulnerabilities, 2) Connection pooling issues, 3) Transaction handling bugs. Ignore style issues."
Get architectural alternatives:
codex exec --model gpt-5-codex --sandbox read-only "Review the current microservices architecture in the codebase. Suggest alternative approaches that might be more suitable. Consider: scalability, maintainability, and deployment complexity."
--sandbox read-only for reviews - This skill is for review feedback only, never implementation--full-auto or --sandbox workspace-write - Codex should only read and analyze, not modify filesWhen Claude and Codex disagree:
For programmatic processing:
codex exec --model gpt-5-codex --sandbox read-only --json "Review auth.py for vulnerabilities" > review.jsonl
Parse JSONL output for structured data:
turn.started: Review beginsitem.completed: Contains reasoning and findingsagent_message: Final review summaryturn.completed: Includes token usagePost-process JSON output with jq:
# Extract only the final agent message
codex exec --model gpt-5-codex --sandbox read-only --json "Review src/api/" | jq 'select(.type=="agent_message")'
# Get just the review text
codex exec --model gpt-5-codex --sandbox read-only --json "Review src/api/" | jq -r 'select(.type=="agent_message") | .message.content[0].text'
Use output schema for structured summaries:
# Create a schema file (review-schema.json)
cat > review-schema.json << 'EOF'
{
"security_issues": ["string"],
"performance_concerns": ["string"],
"bugs": ["string"],
"recommendations": ["string"]
}
EOF
# Get structured output matching the schema
codex exec --model gpt-5-codex --sandbox read-only --output-schema review-schema.json "Review auth.py and output findings in the specified format"
Continue a previous review session (model and sandbox are already set in the session):
# Resume the most recent session
codex exec resume --last "Now focus on the error handling in the code you just reviewed"
# Resume a specific session by ID
codex exec resume 019a1b6a-1b29-7153-8f3e-40678da51ec8 "Please elaborate on the security issues you mentioned"
Session management for multi-turn reviews:
When performing complex reviews that require back-and-forth discussion, capture the session ID from the initial review output. The session ID appears in the header output:
session id: 019a1b6a-1b29-7153-8f3e-40678da51ec8
Save this ID to resume the same conversation later. This is especially important for:
When to use resume vs. new session:
Use different models or reasoning levels:
codex exec --model gpt-5-codex --sandbox read-only --config reasoning_effort=high "Perform deep analysis of the cryptographic implementation"
Claude should:
# 1. Claude performs initial review
# (Claude analyzes the code internally)
# 2. Invoke Codex for second opinion with read-only sandbox
codex exec --model gpt-5-codex --sandbox read-only "Review src/payment/processor.py for:
1. Race conditions in transaction processing
2. Proper error handling and rollback
3. Security issues with payment data
4. Edge cases that could cause data loss
Provide specific line numbers and severity ratings."
# Note: Capture the session ID from output for potential follow-ups
# 3. If follow-up needed, resume the session
codex exec resume --last "Can you suggest specific fixes for the race conditions you identified?"
# 4. Compare findings
# (Claude compares its findings with Codex's output)
# 5. Present synthesized review to user
# (Claude creates unified report with both perspectives)
"codex: command not found"
"Authentication required"
codex interactively first to authenticateCODEX_API_KEY environment variable"Permission denied" errors
Codex review seems shallow
--config reasoning_effort=high for complex tasks