Invoke Codex CLI for complex coding tasks requiring high reasoning capabilities. Trigger phrases include "use codex", "ask codex", "run codex", "call codex", "codex cli", "GPT-5 reasoning", "OpenAI reasoning", or when users request complex implementation challenges, advanced reasoning, architecture
Install
mkdir -p .claude/skills/codex-diegosouzapw && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/16226" && unzip -o skill.zip -d .claude/skills/codex-diegosouzapw && rm skill.zipInstalls to .claude/skills/codex-diegosouzapw
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Invoke Codex CLI for complex coding tasks requiring high reasoning capabilities. Trigger phrases include "use codex", "ask codex", "run codex", "call codex", "codex cli", "GPT-5 reasoning", "OpenAI reasoning", or when users request complex implementation challenges, advanced reasoning, architecture design, or high-reasoning model assistance. Automatically triggers on codex-related requests and supports session continuation for iterative development.About this skill
Codex: High-Reasoning AI Assistant for Claude Code
DEFAULT MODEL: Task-Based Model Selection with Read-Only Default
Codex uses task-based model selection. Sandbox is read-only by default - only use workspace-write when user explicitly requests file editing.
| Task Type | Model | Sandbox (default) | Sandbox (explicit edit) |
|---|---|---|---|
| Code-related tasks | gpt-5.2-codex | read-only | workspace-write |
| General tasks | gpt-5.2 | read-only | workspace-write |
- Code-related tasks: Use
gpt-5.2-codex- optimized for agentic coding (56.4% SWE-Bench Pro) - General tasks: Use
gpt-5.2- high-reasoning general model - Sandbox default: Always
read-onlyunless user explicitly requests editing - Explicit editing: Only when user says "edit", "modify", "write changes", etc., use
workspace-write - Always use
-c model_reasoning_effort=xhighfor maximum capability
# Code task (read-only default)
codex exec -m gpt-5.2-codex -s read-only \
-c model_reasoning_effort=xhigh \
"analyze this function implementation"
# General task (read-only default)
codex exec -m gpt-5.2 -s read-only \
-c model_reasoning_effort=xhigh \
"explain this architecture"
# Code task with explicit edit request
codex exec -m gpt-5.2-codex -s workspace-write \
-c model_reasoning_effort=xhigh \
"edit this file to add the feature"
# General task with explicit edit request
codex exec -m gpt-5.2 -s workspace-write \
-c model_reasoning_effort=xhigh \
"modify the documentation file"
Model Fallback Chain
If the primary model is unavailable, fallback gracefully:
- Code tasks:
gpt-5.2-codex→gpt-5.2→gpt-5.1-codex-max - General tasks:
gpt-5.2→gpt-5.1→gpt-5.1-codex-max - Reasoning effort:
xhigh→high→medium
CRITICAL: Always Use codex exec
MUST USE: codex exec for ALL Codex CLI invocations in Claude Code.
NEVER USE: codex (interactive mode) - will fail with "stdout is not a terminal"
ALWAYS USE: codex exec (non-interactive mode)
Examples:
codex exec -m gpt-5.2 "prompt"(CORRECT)codex -m gpt-5.2 "prompt"(WRONG - will fail)codex exec resume --last(CORRECT)codex resume --last(WRONG - will fail)
Why? Claude Code's bash environment is non-terminal/non-interactive. Only codex exec works in this environment.
IMPORTANT: Interactive vs Exec Mode Flags
Some Codex CLI flags are ONLY available in interactive mode, NOT in codex exec.
| Flag | Interactive codex | codex exec | Alternative for exec |
|---|---|---|---|
--search | ✅ Available | ❌ NOT available | --enable web_search_request |
-a/--ask-for-approval | ✅ Available | ❌ NOT available | --full-auto or -c approval_policy=... |
--add-dir | ✅ Available | ✅ Available | N/A |
--full-auto | ✅ Available | ✅ Available | N/A |
For web search in exec mode:
# CORRECT - works in codex exec
codex exec --enable web_search_request "research topic"
# WRONG - --search only works in interactive mode
codex --search "research topic"
For approval control in exec mode:
# CORRECT - works in codex exec
codex exec --full-auto "task"
codex exec -c approval_policy=on-request "task"
# WRONG - -a only works in interactive mode
codex -a on-request "task"
Trigger Examples
This skill activates when users say phrases like:
- "Use codex to analyze this architecture"
- "Ask codex about this design decision"
- "Run codex on this problem"
- "Call codex for help with this implementation"
- "I need GPT-5 reasoning for this task"
- "Get OpenAI's high-reasoning model on this"
- "Continue with codex" or "Resume the codex session"
- "Codex, help me with..." or simply "Codex"
When to Use This Skill
This skill should be invoked when:
- User explicitly mentions "Codex" or requests Codex assistance
- User needs help with complex coding tasks, algorithms, or architecture
- User requests "high reasoning" or "advanced implementation" help
- User needs complex problem-solving or architectural design
- User wants to continue a previous Codex conversation
How It Works
Detecting New Codex Requests
When a user makes a request, first determine the task type (code vs general), then determine sandbox based on explicit edit request:
Step 1: Determine Task Type (Model Selection)
- Code-related tasks: Use
gpt-5.2-codex- for implementation, refactoring, code analysis, debugging, etc. - General tasks: Use
gpt-5.2- for architecture design, explanations, reviews, documentation, etc.
Step 2: Determine Sandbox (Edit Permission)
- Default:
read-only- safe for all tasks unless user explicitly requests editing - Explicit edit request:
workspace-write- ONLY when user explicitly says to edit/modify/write files
Code-related task examples:
- Read-only: "Analyze this function", "Review this implementation", "Debug this code"
- With editing: "Edit this file to fix the bug", "Modify the function", "Refactor and save"
General task examples:
- Read-only: "Design a queue data structure", "Explain this algorithm", "Review the architecture"
- With editing: "Update the documentation file", "Modify the README"
⚠️ Important: The key distinction for sandbox is whether the user explicitly asks for file modifications. Use workspace-write ONLY when user says "edit", "modify", "write changes", "save", etc.
Bash CLI Command Structure
IMPORTANT: Always use codex exec for non-interactive execution. Claude Code's bash environment is non-terminal, so the interactive codex command will fail with "stdout is not a terminal" error.
Code Task (Read-Only Default)
codex exec -m gpt-5.2-codex -s read-only \
-c model_reasoning_effort=xhigh \
--enable web_search_request \
"<code-related prompt>"
General Task (Read-Only Default)
codex exec -m gpt-5.2 -s read-only \
-c model_reasoning_effort=xhigh \
--enable web_search_request \
"<general prompt>"
Code Task with Explicit Edit Request
codex exec -m gpt-5.2-codex -s workspace-write \
-c model_reasoning_effort=xhigh \
--enable web_search_request \
"<edit code prompt>"
General Task with Explicit Edit Request
codex exec -m gpt-5.2 -s workspace-write \
-c model_reasoning_effort=xhigh \
--enable web_search_request \
"<edit general files prompt>"
Why codex exec?
- Non-interactive mode required for automation and Claude Code integration
- Produces clean output suitable for parsing
- Works in non-TTY environments (like Claude Code's bash)
Model Selection Logic
Step 1: Choose Model Based on Task Type
Use gpt-5.2-codex for code-related tasks:
- Implementation, refactoring, code analysis
- Debugging, fixing bugs, optimization
- Any task involving code understanding or modification
Use gpt-5.2 for general tasks:
- Architecture and system design
- Explanations, documentation, reviews
- Planning, strategy, general reasoning
Step 2: Choose Sandbox Based on Edit Intent
Use read-only (DEFAULT):
- Analysis, review, explanation tasks
- ANY task where user does NOT explicitly request file editing
Use workspace-write (ONLY when explicitly requested):
- User explicitly says "edit this file", "modify the code", "write changes"
- User explicitly asks to "make edits" or "save the changes"
- User explicitly requests "refactor and save" or "implement and write"
Fallback Models: gpt-5.1-codex-max and gpt-5.1 are available if primary models are unavailable. See fallback chain in DEFAULT MODEL section.
Default Configuration
All Codex invocations use these defaults unless user specifies otherwise:
| Parameter | Default Value | CLI Flag | Notes |
|---|---|---|---|
| Model (code tasks) | gpt-5.2-codex | -m gpt-5.2-codex | For code-related tasks |
| Model (general tasks) | gpt-5.2 | -m gpt-5.2 | For general tasks |
| Sandbox (default) | read-only | -s read-only | Safe default for ALL tasks |
| Sandbox (explicit edit) | workspace-write | -s workspace-write | Only when user explicitly requests editing |
| Reasoning Effort | xhigh | -c model_reasoning_effort=xhigh | Maximum reasoning capability |
| Verbosity | medium | -c model_verbosity=medium | Balanced output detail |
| Web Search | enabled | --enable web_search_request | Access to up-to-date information |
CLI Flags Reference
Codex CLI Version: 0.72.0+ (requires 0.72.0+ for gpt-5.2-codex and xhigh)
| Flag | Values | Description |
|---|---|---|
-m, --model | gpt-5.2-codex, gpt-5.2, gpt-5.1-codex-max, gpt-5.1 | Model selection |
-s, --sandbox | read-only, workspace-write, danger-full-access | Sandbox mode |
-c, --config | key=value | Config overrides (e.g., model_reasoning_effort=high) |
-C, --cd | directory path | Working directory |
-p, --profile | profile name | Use config profile |
--enable | feature name | Enable a feature (e.g., web_search_request) |
--disable | feature name | Disable a feature |
-i, --image | file path(s) | Attach image(s) to initial prompt |
--add-dir | directory path | Additional writable directory (repeatable) |
--full-auto | flag | Convenience for workspace-write sandbox with on-request approval |
--oss | flag | Use local open source model provider |
--local-provider | lmstudio, ollama | Specify local provider (with --oss) |
--skip-git-repo-check | flag | Allow running outside Git repository |
--output-schema | file path | JSON Schema file for response shape |
--color | always, never, auto | Color settings for output |
--json | flag | Print events as JSONL |
-o, --output-last-message | file path | Save last message to file |
| ` |
Content truncated.