codex-advisor
Get a second opinion from OpenAI Codex CLI for plan reviews, code reviews, architecture decisions, and hard problems. Use when you need external validation, want to compare approaches, or are stuck on a difficult problem.
Best use case
codex-advisor is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Get a second opinion from OpenAI Codex CLI for plan reviews, code reviews, architecture decisions, and hard problems. Use when you need external validation, want to compare approaches, or are stuck on a difficult problem.
Teams using codex-advisor should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/codex-advisor/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How codex-advisor Compares
| Feature / Agent | codex-advisor | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Get a second opinion from OpenAI Codex CLI for plan reviews, code reviews, architecture decisions, and hard problems. Use when you need external validation, want to compare approaches, or are stuck on a difficult problem.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
SKILL.md Source
# Codex Advisor
## Overview
Use OpenAI's Codex CLI as a second-opinion advisor when you need external validation on plans, code reviews, or are stuck on hard problems. This skill uses non-interactive mode (`codex exec`) for scripted/automated usage.
## When to Use
- Reviewing implementation plans before starting work
- Code review for complex or security-sensitive changes
- Architecture decisions with significant trade-offs
- Debugging problems where you've been stuck for >30 minutes
- Getting alternative approaches to a solution
- Validating assumptions about unfamiliar codebases
## Prerequisites
- OpenAI API key or ChatGPT Plus/Pro/Business account
- Codex CLI installed
### Installation
```bash
# Via npm
npm install -g @openai/codex
# Or via Homebrew
brew install --cask codex
```
### Authentication
```bash
# Option 1: API key (required for non-interactive mode in CI)
export OPENAI_API_KEY="your-key"
# Option 2: Codex-specific key for CI environments
export CODEX_API_KEY="your-key"
# Option 3: Interactive login (one-time setup)
codex --login
```
## Model Selection
Choose the right model for your task:
| Model | Best For | Use When |
|-------|----------|----------|
| `gpt-5.2` | General-purpose reasoning | Default for plan reviews, architecture questions, non-coding tasks |
| `gpt-5.2-codex` | Real-world software engineering | Code reviews, debugging, coding-specific tasks |
| `gpt-5.1-codex-max` | Extended multi-step workflows | Long-running tasks (>10 min), large migrations, complex refactors |
| `gpt-5.1-codex-mini` | Budget-conscious projects | Simple reviews when cost matters |
**Recommendation:**
- Start with `gpt-5.2` for general questions
- Use `gpt-5.2-codex` when the task is specifically about code
- Use `gpt-5.1-codex-max` for tasks involving many files or complex multi-step work
## Reasoning Effort Levels
Always use `xhigh` reasoning for thorough analysis:
| Level | Use Case |
|-------|----------|
| `xhigh` | **Default** - Deep analysis, security review, architecture decisions |
| `high` | Complex analysis when latency matters |
| `medium` | Quick responses for simple tasks |
| `low`/`none` | Not recommended for advisor use cases |
## Non-Interactive Mode
All commands use `codex exec` for non-interactive execution. This is essential for scripted usage and piping.
### Key Flags
| Flag | Purpose |
|------|---------|
| `--json` | Output JSON Lines for machine parsing |
| `-o <path>` | Save final message to file |
| `-C <path>` | Set working directory (use `-C .` for current codebase) |
| `--full-auto` | Enable file modifications (use with caution) |
| `--sandbox read-only` | Read-only sandbox (default, safest) |
| `--sandbox workspace-write` | Allow writes to workspace only |
### Output Handling
```bash
# JSON output for parsing
codex exec -m gpt-5.2 -c model_reasoning_effort="xhigh" \
--json "Your prompt" 2>/dev/null
# Save to file
codex exec -m gpt-5.2 -c model_reasoning_effort="xhigh" \
-o output.txt "Your prompt"
# Pipe input and capture output
git diff | codex exec -m gpt-5.2-codex -c model_reasoning_effort="xhigh" \
"Review this diff" > review.txt 2>/dev/null
```
## Command Reference
### Plan Review
Get feedback on an implementation plan:
```bash
codex exec -m gpt-5.2 -c model_reasoning_effort="xhigh" \
"Review this implementation plan. Identify potential issues, missing edge cases, security concerns, or better approaches:
<paste plan here>"
```
For plans involving the current codebase:
```bash
codex exec -m gpt-5.2 -c model_reasoning_effort="xhigh" -C . \
"Review this implementation plan in the context of this codebase. Identify potential issues, conflicts with existing patterns, or better approaches:
<paste plan here>"
```
### Code Review
Review code changes for bugs, security issues, and improvements:
```bash
# Review staged changes
git diff --staged | codex exec -m gpt-5.2-codex -c model_reasoning_effort="xhigh" \
"Review these changes before commit. Check for:
- Bugs or logic errors
- Security vulnerabilities
- Performance issues
- Missing error handling"
# Review a specific diff
git diff | codex exec -m gpt-5.2-codex -c model_reasoning_effort="xhigh" \
"Review this diff for bugs, security issues, and improvements"
# Review with codebase context
codex exec -m gpt-5.2-codex -c model_reasoning_effort="xhigh" -C . \
"Review src/auth/login.ts for bugs, security vulnerabilities, and suggest improvements"
```
### Hard Problem Solving
When stuck on a difficult problem:
```bash
codex exec -m gpt-5.2-codex -c model_reasoning_effort="xhigh" -C . \
"I'm stuck on this problem: <description>
What I've tried:
1. <attempt 1>
2. <attempt 2>
Error/behavior I'm seeing: <details>
Suggest solutions or debugging approaches."
```
### Architecture Decisions
Get input on design trade-offs:
```bash
codex exec -m gpt-5.2 -c model_reasoning_effort="xhigh" -C . \
"I need to decide between these approaches for <feature>:
Option A: <description>
Option B: <description>
Given this codebase, which approach is better and why? Consider maintainability, performance, and consistency with existing patterns."
```
### Alternative Approaches
When you want a fresh perspective:
```bash
codex exec -m gpt-5.2 -c model_reasoning_effort="xhigh" -C . \
"Here's my current approach to <problem>: <description>
What are alternative ways to solve this? What am I missing?"
```
## Workflow Examples
### Pre-Implementation Review
```bash
codex exec -m gpt-5.2 -c model_reasoning_effort="xhigh" -C . \
"Review this implementation plan for a user authentication system:
1. Add JWT middleware to Express routes
2. Create /auth/login and /auth/register endpoints
3. Store refresh tokens in Redis
4. Add rate limiting on auth endpoints
Identify missing pieces, security concerns, or better approaches."
```
### Pre-Commit Review
```bash
git diff --staged | codex exec -m gpt-5.2-codex -c model_reasoning_effort="xhigh" \
"Review these changes for a PR. Check for:
- Bugs or logic errors
- Security vulnerabilities
- Performance issues
- Missing error handling
- Test coverage gaps
Provide specific line-by-line feedback."
```
### Long-Running Migration
For complex, multi-file refactors, use `gpt-5.1-codex-max`:
```bash
codex exec -m gpt-5.1-codex-max -c model_reasoning_effort="xhigh" -C . \
"Help me migrate this codebase from Express to Fastify.
Review the current structure and create a detailed migration plan.
Identify all files that need changes and potential breaking changes."
```
## CI/Automation
For CI environments, use `CODEX_API_KEY`:
```bash
# In CI environment
CODEX_API_KEY=${{ secrets.CODEX_API_KEY }} \
codex exec -m gpt-5.2-codex -c model_reasoning_effort="xhigh" \
--json "Review this code" > review.json
```
### GitHub Actions Example
```yaml
- name: Code Review with Codex
env:
CODEX_API_KEY: ${{ secrets.CODEX_API_KEY }}
run: |
git diff origin/main...HEAD | codex exec \
-m gpt-5.2-codex \
-c model_reasoning_effort="xhigh" \
-o review.txt \
"Review this PR diff for bugs and security issues"
```
## Best Practices
### When to Use Codex Advisor
- Complex changes affecting multiple systems
- Security-sensitive code (auth, crypto, input validation)
- Performance-critical sections
- Unfamiliar codebases or languages
- When you've been stuck for >30 minutes
### When NOT to Use
- Simple, obvious changes (typos, formatting)
- Trivial bug fixes with clear solutions
- When you need to move fast on low-risk changes
- Repetitive tasks where the pattern is established
### Tips for Better Results
1. **Provide context**: Include relevant file paths, error messages, and what you've tried
2. **Be specific**: Ask focused questions rather than "review everything"
3. **Use `-C .`**: Let Codex see your codebase for context-aware advice
4. **Choose the right model**: `gpt-5.2` for general, `gpt-5.2-codex` for code, `gpt-5.1-codex-max` for complex
5. **Verify suggestions**: Always validate Codex's recommendations against your codebase
## Security Considerations
- Codex sends code to OpenAI's servers for analysis
- Review your organization's policies before sharing proprietary code
- Avoid sending sensitive credentials, API keys, or PII in code samples
- Use API keys with appropriate rate limits for usage monitoring
## Troubleshooting
### "stdin is not a terminal"
When piping data, always use `codex exec`:
```bash
# Wrong - interactive mode doesn't support piped input
git diff | codex -m gpt-5.2 "Review this..."
# Correct - use exec for non-interactive execution
git diff | codex exec -m gpt-5.2 "Review this..."
```
### "Command not found"
```bash
# Check installation
which codex
# Reinstall if needed
npm install -g @openai/codex
```
### Authentication errors
```bash
# Re-authenticate interactively
codex --login
# Or set API key
export OPENAI_API_KEY="your-key"
export CODEX_API_KEY="your-key" # For CI
```
### Rate limiting
For heavy usage, use an API key with appropriate tier limits rather than ChatGPT authentication.
### No output / empty response
Ensure stderr is handled separately from stdout:
```bash
# Capture output properly
codex exec -m gpt-5.2 -c model_reasoning_effort="xhigh" \
"Your prompt" 2>/dev/null > output.txt
# Or use -o flag
codex exec -m gpt-5.2 -c model_reasoning_effort="xhigh" \
-o output.txt "Your prompt"
```Related Skills
julien-workflow-advice-codex
Get OpenAI Codex CLI's opinion on code, bugs, or implementation. Use when you want a second AI perspective during coding sessions.
consult-codex
Compare OpenAI Codex GPT-5.2 and code-searcher responses for comprehensive dual-AI code analysis. Use when you need multiple AI perspectives on code questions.
codex-team
Use when you have 2+ tasks that Codex agents should execute. Runtime-native: Codex sub-agents when available, Codex CLI fallback otherwise. Handles file conflicts via merge/wave strategies. Triggers: "codex team", "spawn codex", "codex agents", "use codex for", "codex fix".
codex
Run OpenAI's Codex CLI agent in non-interactive mode using `codex exec`. Use when delegating coding tasks to Codex, running Codex in scripts/automation, or when needing a second agent to work on a task in parallel.
codex-sessions-skill-scan
Daily skill health scan: analyze ~/.codex/sessions plus per-repo session logs under ~/dev (default last 1 day) and summarize skill invocations + likely failures for personal skills in ~/dev/agent-skills (missing paths, tool failures, complex-task word triggers). Optional: include best-effort local OTel signals.
codex-reviewer
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.
codex-review
Two-pass adversarial review of design documents and implementation plans using OpenAI Codex CLI. Invokes Codex to review plans section-by-section (pass 1), then holistically (pass 2), feeding critique back for revision. Use when you have a design doc, architecture plan, or implementation plan that should be stress-tested before execution.
codex-cli-bridge
Bridge between Claude Code and OpenAI Codex CLI - generates AGENTS.md from CLAUDE.md, provides Codex CLI execution helpers, and enables seamless interoperability between both tools
architecture-advisor
Helps solo developers with AI agents choose optimal architecture (monolithic/microservices/hybrid)
advisor
Interactive workflow advisor that helps you choose optimal AI primitives from agentconfig.org based on your specific workflow needs, skill level, and tooling preferences. Use when deciding which primitives to implement or how to structure your AI configuration.
Advisory Board Builder
Recruit, structure, and manage advisory boards for strategic guidance
tech-advisor
Recomienda stack tecnológico óptimo basado en requisitos del proyecto