Skip to content
Development
Command

/codex-exec

**Easy wrapper for running Codex CLI commands from Claude Code with proper syntax.**

From plugin
claude-code-skill-factory
89820 skills5 agents20 commands

Command definition

codex-exec.md

/codex-exec - Execute Codex CLI Commands

**Easy wrapper for running Codex CLI commands from Claude Code with proper syntax.**

---

Usage

/codex-exec [analysis|edit|search|resume] "your task"
/codex-exec --model [gpt-5|gpt-5-codex] "your task"
/codex-exec --help

---

What This Command Does

**Executes Codex CLI commands with**:

  • ✅ Correct syntax (always uses `codex exec`)
  • ✅ Intelligent model selection
  • ✅ Appropriate sandbox modes
  • ✅ High reasoning effort
  • ✅ Error handling

**CRITICAL**: Always uses `codex exec` not plain `codex` (required for Claude Code environment)

---

Command Types

Analysis (Read-Only)

Safe code analysis without modifications.

**Usage**:

/codex-exec analysis "analyze security vulnerabilities"

**Executes**:

codex exec -m gpt-5 -s read-only \
  -c model_reasoning_effort=high \
  --skip-git-repo-check \
  "analyze security vulnerabilities"

**Use for**:

  • Code review
  • Security analysis
  • Architecture review
  • Documentation reading
  • Performance analysis

---

Edit (Workspace Write)

Code editing and file modifications.

**Usage**:

/codex-exec edit "refactor main.py for async patterns"

**Executes**:

codex exec -m gpt-5-codex -s workspace-write \
  -c model_reasoning_effort=high \
  --full-auto \
  --skip-git-repo-check \
  "refactor main.py for async patterns"

**Use for**:

  • Code refactoring
  • Bug fixes
  • Feature implementation
  • Test generation
  • Documentation updates

---

Search (Web Search Enabled)

Tasks requiring latest information from the web.

**Usage**:

/codex-exec search "research latest Python async patterns"

**Executes**:

codex exec -m gpt-5 -s read-only \
  -c model_reasoning_effort=high \
  --search \
  --skip-git-repo-check \
  "research latest Python async patterns"

**Use for**:

  • Technology research
  • Best practices lookup
  • Library comparisons
  • Latest trends
  • Documentation lookup

---

Resume (Continue Session)

Resume previous Codex session.

**Usage**:

/codex-exec resume

**Executes**:

codex exec resume --last

**Use for**:

  • Continuing previous work
  • Adding to prior analysis
  • Iterative development
  • Follow-up questions

---

Model Selection

GPT-5 (General Reasoning)

**Default for**: Analysis, Search, General tasks

**Best for**:

  • Architecture design
  • Code review
  • Documentation
  • Planning
  • Research

**Characteristics**:

  • High reasoning capability
  • General-purpose
  • Best for non-coding tasks

---

GPT-5-Codex (Code Specialized)

**Default for**: Edit tasks

**Best for**:

  • Code refactoring
  • Bug fixing
  • Feature implementation
  • Test generation
  • Code translation

**Characteristics**:

  • Optimized for coding
  • Better at code editing
  • Specialized knowledge

---

Examples

Example 1: Security Analysis

**User**:

/codex-exec analysis "analyze this codebase for security vulnerabilities"

**What happens**: 1. Uses GPT-5 (general reasoning) 2. Read-only mode (safe) 3. High reasoning effort 4. Analyzes entire codebase 5. Returns security report

**Output**:

🚀 Executing Codex CLI command...

Security Analysis Report:
- Found 3 SQL injection vulnerabilities
- Missing CSRF protection on 2 endpoints
- Weak password validation
- Recommendations: [detailed fixes]

✅ Analysis complete

---

Example 2: Code Refactoring

**User**:

/codex-exec edit "refactor database.py to use connection pooling"

**What happens**: 1. Uses GPT-5-Codex (code specialized) 2. Workspace-write mode (can modify files) 3. Full-auto enabled 4. Refactors database.py 5. Implements connection pooling

**Output**:

🚀 Executing Codex CLI command...

Refactored database.py:
- Added connection pool (max_connections=20)
- Implemented context managers
- Added retry logic
- Updated all database calls
- Added tests

✅ Refactoring complete
Files modified: database.py, tests/test_database.py

---

Example 3: Research Task

**User**:

/codex-exec search "compare FastAPI vs Flask for microservices"

**What happens**: 1. Uses GPT-5 with web search 2. Researches latest information 3. Compares frameworks 4. Provides recommendations

**Output**:

🚀 Executing Codex CLI command...

Framework Comparison: FastAPI vs Flask

FastAPI:
+ Modern async support
+ Automatic API documentation (OpenAPI)
+ Type hints and validation (Pydantic)
+ Better performance (async)
- Smaller ecosystem
- Less mature

Flask:
+ Large ecosystem
+ Mature and stable
+ Flexible and minimal
- Synchronous by default
- Manual API documentation

Recommendation: FastAPI for new microservices

✅ Research complete

---

Example 4: Continue Previous Work

**User**:

/codex-exec resume

**What happens**: 1. Resumes last Codex session 2. Continues context from previous work 3. No need to repeat information

**Output**:

🚀 Resuming last Codex session...

Continuing from: "refactor database.py"

Ready to continue. What's next?

---

Advanced Usage

Custom Model Selection

/codex-exec --model gpt-5 edit "task"

Forces GPT-5 instead of default GPT-5-Codex for edit tasks.

---

Show Command Only (Dry Run)

/codex-exec --dry-run analysis "task"

Shows the command that would be executed without running it.

**Output**:

Would execute:
codex exec -m gpt-5 -s read-only \
  -c model_reasoning_effort=high \
  --skip-git-repo-check \
  "task"

---

Troubleshooting

Error: "Codex CLI not found"

**Solution**:

# Install Codex CLI
which codex  # Check if installed
codex --version  # Verify works

---

Error: "stdout is not a terminal"

**Cause**: Using plain `codex` instead of `codex exec`

**Solution**: This command automatically uses `codex exec` ✅

---

Task Times Out

**Symptom**: Command runs for > 5 minutes and times out

**Solution**:

# Break into smaller tasks
/codex-exec analysis "analyze auth module only"

# Instead of
/codex-exec analysis "analyze entire code
Read more
@alirezarezvani
Ships withclaude-code-skill-factory

A comprehensive toolkit for generating production-ready Claude Skills and Claude Code Agents at scale.

Stars on GitHub

Momentum

stars in total
898
Star history of alirezarezvani/claude-code-skill-factory on GitHub, a chart by star-history.com

Other commands on claude-code-skill-factory.

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command