ワンクリックで
codex-cli-delegation
Delegate complex code analysis, refactoring, and editing tasks to OpenAI Codex CLI from within Claude Code
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Delegate complex code analysis, refactoring, and editing tasks to OpenAI Codex CLI from within Claude Code
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | codex-cli-delegation |
| description | Delegate complex code analysis, refactoring, and editing tasks to OpenAI Codex CLI from within Claude Code |
| triggers | ["use codex to analyze this code","delegate this to codex","run codex on this repository","ask codex to refactor this","start a codex session","execute this with codex","use codex for code review","invoke codex cli"] |
Skill by ara.so — Codex Skills collection.
The Codex CLI (codex) is a command-line tool that enables automated code analysis, refactoring, editing, and agentic workflows using OpenAI's GPT models with specialized code-understanding capabilities. This skill enables AI coding agents to delegate tasks to Codex for multi-file operations, complex refactoring, and autonomous code editing.
Key capabilities:
codex execVerify Codex is installed and configured:
codex --version
If not installed, follow Codex installation instructions and configure credentials:
# Set OpenAI API key
export OPENAI_API_KEY="${OPENAI_API_KEY}"
# Verify configuration
codex config show
This skill is typically installed via Claude Code's plugin system:
/plugin marketplace add skills-directory/skill-codex
/plugin install skill-codex@skill-codex
Or as a standalone skill:
git clone --depth 1 git@github.com:skills-directory/skill-codex.git /tmp/skills-temp && \
mkdir -p ~/.claude/skills && \
cp -r /tmp/skills-temp/plugins/skill-codex/skills/codex ~/.claude/skills/codex && \
rm -rf /tmp/skills-temp
codex execExecute a one-off prompt with full configuration control:
# Basic execution
codex exec "Analyze error handling patterns in this codebase"
# With model selection
codex exec -m gpt-5.3-codex-spark "Refactor authentication module"
# With reasoning effort
codex exec --config model_reasoning_effort="high" "Find performance bottlenecks"
# With sandbox mode
codex exec --sandbox read-only "Review code quality"
codex exec --sandbox edit "Add type hints to Python files"
codex exec --sandbox full "Refactor and run tests"
# Full automation mode
codex exec --full-auto --skip-git-repo-check "Analyze this repository"
# Suppress thinking tokens (recommended for Claude Code context)
codex exec "Your prompt" 2>/dev/null
Continue previous Codex sessions with context:
# List available sessions
codex sessions list
# Resume a specific session
codex resume <session-id>
# Resume with additional prompt
codex resume <session-id> "Continue with the refactoring we discussed"
Choose the appropriate model for your task:
| Model | Best For | Reasoning |
|---|---|---|
gpt-5.5 | Most complex tasks, architectural decisions | Highest |
gpt-5.4 | Advanced refactoring, multi-file analysis | High |
gpt-5.4-mini | Faster analysis, simpler edits | Medium |
gpt-5.3-codex-spark | Quick code review, rapid prototyping | Low-Medium |
gpt-5.3-codex | Standard code operations | Low |
Example:
# For complex architectural analysis
codex exec -m gpt-5.5 --config model_reasoning_effort="high" \
"Design a plugin system for this application"
# For quick code review
codex exec -m gpt-5.3-codex-spark --config model_reasoning_effort="low" \
"Check for security issues in authentication"
Control computational depth:
low: Fast, surface-level analysismedium: Balanced speed and depthhigh: Deep reasoning, comprehensive analysiscodex exec --config model_reasoning_effort="high" \
"Analyze concurrency patterns and race conditions"
Control Codex's file system access:
read-only: Analysis only, no modificationsedit: Can modify files but limited executionfull: Full file system and execution access# Safe analysis
codex exec --sandbox read-only "Audit this codebase"
# Controlled editing
codex exec --sandbox edit "Add error handling to all API calls"
# Full automation (use with caution)
codex exec --sandbox full --full-auto "Implement feature X with tests"
# Comprehensive repository analysis
codex exec -m gpt-5.4 \
--config model_reasoning_effort="high" \
--sandbox read-only \
--full-auto \
"Analyze this repository comprehensively: architecture, patterns, code quality, potential improvements" \
2>/dev/null
# Security audit
codex exec -m gpt-5.5 \
--config model_reasoning_effort="high" \
--sandbox read-only \
"Perform security audit focusing on authentication, authorization, and data validation" \
2>/dev/null
# Extract reusable components
codex exec -m gpt-5.4 \
--sandbox edit \
"Identify duplicated code and extract into reusable functions" \
2>/dev/null
# Type safety improvements
codex exec -m gpt-5.3-codex-spark \
--sandbox edit \
"Add TypeScript type annotations to all exported functions" \
2>/dev/null
# Implement with tests
codex exec -m gpt-5.5 \
--config model_reasoning_effort="high" \
--sandbox full \
--full-auto \
"Implement user authentication with JWT tokens, including unit tests and integration tests" \
2>/dev/null
# Generate comprehensive docs
codex exec -m gpt-5.4 \
--sandbox edit \
"Add JSDoc comments to all public APIs and update README with usage examples" \
2>/dev/null
# OpenAI API key (required)
export OPENAI_API_KEY="${OPENAI_API_KEY}"
# Codex configuration directory (optional)
export CODEX_CONFIG_DIR="${HOME}/.config/codex"
Located at ~/.config/codex/config.yaml:
default_model: gpt-5.4
default_reasoning_effort: medium
default_sandbox: edit
auto_git_check: true
thinking_tokens: false
# Override config for single execution
codex exec \
--config model_reasoning_effort="high" \
--config auto_git_check="false" \
"Your prompt here"
By default, this skill suppresses Codex's reasoning output (stderr) to avoid bloating context:
# Suppressed (default for Claude Code)
codex exec "Analyze code" 2>/dev/null
# Show thinking tokens for debugging
codex exec "Analyze code"
When to show thinking tokens:
Codex includes built-in safety checks:
# Requires clean git state (recommended)
codex exec --sandbox edit "Refactor module"
# Skip git check (use with caution)
codex exec --sandbox edit --skip-git-repo-check "Quick fix"
# Full automation without prompts
codex exec --full-auto --skip-git-repo-check "Automated task"
Best practices:
read-only sandbox for analysis--full-auto only for well-defined, low-risk tasksAPI Key Not Set:
Error: OPENAI_API_KEY not found
Solution:
export OPENAI_API_KEY="${OPENAI_API_KEY}"
Codex Not Found:
codex: command not found
Solution: Install Codex CLI and ensure it's in PATH
Git Repository Required:
Error: Not a git repository
Solution: Initialize git or use --skip-git-repo-check
Rate Limiting:
Error: Rate limit exceeded
Solution: Reduce reasoning effort or switch to a faster model
When delegating to Codex from Claude Code:
read-only sandbox for analysis tasks2>/dev/nullExample integration pattern:
# In Claude Code skill activation
def invoke_codex(prompt, model=None, reasoning=None, sandbox="read-only"):
# Confirm model selection
if model is None:
# Ask user: "Which model? gpt-5.5, gpt-5.4, gpt-5.4-mini, gpt-5.3-codex-spark, gpt-5.3-codex"
model = get_user_choice()
# Confirm reasoning effort
if reasoning is None:
# Ask user: "Reasoning effort? low, medium, high"
reasoning = get_user_choice()
# Build command
cmd = f'codex exec -m {model} --config model_reasoning_effort="{reasoning}" --sandbox {sandbox} --full-auto --skip-git-repo-check "{prompt}" 2>/dev/null'
# Execute and return results
return execute_command(cmd)
# Initial analysis
codex exec -m gpt-5.4 "Analyze authentication module" > analysis.txt
# Resume with refinements
SESSION_ID=$(codex sessions list | head -1 | awk '{print $1}')
codex resume $SESSION_ID "Focus on OAuth2 implementation details"
# Stage 1: Analysis (read-only)
codex exec --sandbox read-only \
"Identify components that need refactoring" > refactor-plan.txt
# Stage 2: Refactoring (edit)
codex exec --sandbox edit \
"Refactor components listed in refactor-plan.txt"
# Stage 3: Testing (full)
codex exec --sandbox full \
"Run test suite and fix any failures"
#!/bin/bash
# automated-review.sh
echo "Starting Codex code review..."
# Security audit
codex exec -m gpt-5.5 \
--config model_reasoning_effort="high" \
--sandbox read-only \
"Security audit focusing on OWASP Top 10" \
2>/dev/null > security-report.md
# Code quality
codex exec -m gpt-5.4 \
--sandbox read-only \
"Code quality analysis: complexity, maintainability, test coverage" \
2>/dev/null > quality-report.md
echo "Reports generated: security-report.md, quality-report.md"
If Codex is slow:
--config model_reasoning_effort="low"-m gpt-5.3-codex-sparkIf hitting context limits:
--sandbox read-only to limit file scanningIf results vary significantly:
gpt-5.5 or gpt-5.4 for complex tasksConvert attached object images into code-only, animation-ready procedural Three.js models through guided sculpting workflow
Create and manage AI video storyboard projects with automated asset generation through Codex Storyboard workspace
Continue-thinking middleware that detects and handles reasoning truncation in Codex/OpenAI Responses-compatible APIs
Desktop manager for OpenAI Codex CLI with prompt injection, provider switching, and TOML/Auth visualization
Inject unrestricted developer mode instructions into Codex CLI (GPT-5.5) to bypass content filters
Install and use TradingCodex to build Codex-native investment research workflows with fixed-role agents, order approval gates, and local Django service plane