MCPInstall

skill-codex-delegation

Delegate coding tasks from Claude Code to OpenAI Codex CLI for autonomous code analysis, refactoring, and multi-file editing workflows

Installs
236
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/reason-machines/codex-skills --skill skill-codex-delegation
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads skill-codex-delegation automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Codex Delegation Skill

Skill by ara.so — Codex Skills collection.

Overview

skill-codex enables Claude Code (or other AI coding agents) to delegate complex coding tasks to the OpenAI Codex CLI. This is useful when you need autonomous multi-file editing, deep code analysis, or refactoring workflows that benefit from Codex's specialized reasoning models.

The Codex CLI supports:

  • Multiple GPT models (gpt-5.5, gpt-5.4, gpt-5.3-codex-spark, etc.)
  • Adjustable reasoning effort levels (low, medium, high)
  • Sandbox modes (read-only, docker, off) for safe execution
  • Session resumption for iterative workflows
  • Full automation mode for autonomous task completion

Installation

Prerequisites

  1. Install Codex CLI:

    # Installation method depends on your OS
    # Verify installation:
    codex --version
    
  2. Configure Codex credentials:

    # Set up API keys (use environment variables)
    export OPENAI_API_KEY=your_api_key_here
    
    # Or configure via codex config
    codex config set api_key $OPENAI_API_KEY
    
  3. Verify installation:

    codex --version
    # Should output version info without errors
    

Install as Claude Code Plugin (Recommended)

/plugin marketplace add skills-directory/skill-codex
/plugin install skill-codex@skill-codex

Install as Standalone Skill

git clone --depth 1 https://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

Key Commands

Basic Execution

# Simple execution with default model
codex exec "analyze this codebase and suggest improvements"

# Specify model
codex exec -m gpt-5.3-codex-spark "refactor this module for better performance"

# With reasoning effort
codex exec -m gpt-5.4 --config model_reasoning_effort="high" "complex architectural review"

Sandbox Modes

# Read-only (safe for analysis)
codex exec --sandbox read-only "analyze code quality"

# Docker sandbox (isolated execution)
codex exec --sandbox docker "run tests and fix failing ones"

# No sandbox (full file system access)
codex exec --sandbox off "update configuration files"

Full Automation Mode

# Autonomous execution without prompts
codex exec --full-auto --skip-git-repo-check \
  "implement user authentication feature"

Session Management

# Resume last session
codex resume

# Resume specific session
codex resume --session abc123

# List sessions
codex sessions list

Configuration

Model Selection

Available models (as of documentation):

  • gpt-5.5 - Latest flagship model
  • gpt-5.4 - Previous generation flagship
  • gpt-5.4-mini - Faster, cost-effective option
  • gpt-5.3-codex-spark - Specialized for code with enhanced reasoning
  • gpt-5.3-codex - Code-specialized model

Reasoning Effort Levels

  • low - Fast responses, basic reasoning
  • medium - Balanced reasoning and speed (default)
  • high - Deep analysis, slower but more thorough

Common Configurations

# Set default model
codex config set default_model gpt-5.3-codex-spark

# Set default reasoning effort
codex config set model_reasoning_effort medium

# Set default sandbox mode
codex config set sandbox_mode read-only

Usage Patterns

Pattern 1: Code Analysis

When user asks: "analyze this codebase for security issues"

codex exec -m gpt-5.3-codex-spark \
  --config model_reasoning_effort="high" \
  --sandbox read-only \
  --full-auto \
  --skip-git-repo-check \
  "Perform comprehensive security audit of this codebase. Identify: 1) SQL injection risks, 2) XSS vulnerabilities, 3) insecure dependencies, 4) authentication weaknesses. Provide specific file locations and remediation steps." 2>/dev/null

Note: 2>/dev/null suppresses thinking tokens (stderr). Omit to see Codex's reasoning process.

Pattern 2: Refactoring Workflow

When user asks: "refactor this module to use dependency injection"

codex exec -m gpt-5.4 \
  --config model_reasoning_effort="medium" \
  --sandbox docker \
  --full-auto \
  "Refactor src/services/user-service.js to use dependency injection pattern. Update all imports, add constructor injection, create service container. Maintain backward compatibility." 2>/dev/null

Pattern 3: Feature Implementation

When user asks: "add rate limiting to the API"

codex exec -m gpt-5.5 \
  --config model_reasoning_effort="high" \
  --sandbox off \
  --full-auto \
  "Implement rate limiting middleware for Express API. Requirements: 1) Redis-based storage, 2) configurable limits per endpoint, 3) proper error responses, 4) unit tests. Update routes and add documentation." 2>/dev/null

Pattern 4: Session Resume for Iterative Work

# Initial task
codex exec -m gpt-5.3-codex-spark "create REST API for user management"

# Review output, then resume to iterate
codex resume
# User provides feedback in the resumed session

Pattern 5: Multi-File Editing

When user asks: "update all components to use the new theme system"

codex exec -m gpt-5.4 \
  --config model_reasoning_effort="medium" \
  --sandbox docker \
  --full-auto \
  --skip-git-repo-check \
  "Update all React components in src/components/ to use the new theme system from src/styles/theme.js. Replace hardcoded colors with theme tokens. Update imports. Preserve all functionality." 2>/dev/null

Real-World Examples

Example 1: Repository Analysis

# User prompt: "Use codex to analyze this repo and suggest improvements"
# Agent execution:

codex exec -m gpt-5.3-codex-spark \
  --config model_reasoning_effort="high" \
  --sandbox read-only \
  --full-auto \
  --skip-git-repo-check \
  "Analyze this repository comprehensively:
  
1. Code Quality: Identify code smells, duplication, complexity issues
2. Architecture: Assess structure, separation of concerns, modularity
3. Performance: Find bottlenecks, inefficient algorithms, optimization opportunities
4. Testing: Evaluate test coverage, quality, missing test cases
5. Documentation: Review README, inline comments, API docs completeness
6. Security: Check for common vulnerabilities, insecure patterns
7. Dependencies: Review package.json for outdated or risky dependencies

Provide actionable recommendations prioritized by impact." 2>/dev/null

Example 2: TypeScript Migration

# User prompt: "migrate this JavaScript project to TypeScript"

codex exec -m gpt-5.5 \
  --config model_reasoning_effort="high" \
  --sandbox docker \
  --full-auto \
  "Migrate this JavaScript project to TypeScript:

1. Add tsconfig.json with appropriate settings
2. Rename .js files to .ts/.tsx
3. Add type annotations to all functions and variables
4. Create interface definitions for data structures
5. Fix all type errors
6. Update package.json scripts for TypeScript compilation
7. Ensure all tests pass after migration

Prioritize type safety while maintaining code clarity." 2>/dev/null

Example 3: Performance Optimization

# User prompt: "optimize database queries in this service"

codex exec -m gpt-5.4 \
  --config model_reasoning_effort="high" \
  --sandbox read-only \
  --full-auto \
  "Analyze and optimize database queries in src/services/:

1. Identify N+1 query problems
2. Find missing indexes
3. Detect inefficient joins or subqueries
4. Suggest query refactoring for better performance
5. Recommend caching strategies
6. Provide benchmarking approach

Focus on src/services/order-service.js and src/services/product-service.js" 2>/dev/null

Delegation Workflow

When delegating to Codex from Claude Code:

  1. Assess Task Complexity: Determine if Codex delegation is appropriate
  2. Select Model: Choose based on task complexity and speed requirements
  3. Set Reasoning Effort:
    • low for simple tasks
    • medium for standard refactoring
    • high for architectural changes or complex analysis
  4. Choose Sandbox Mode:
    • read-only for analysis tasks
    • docker for code changes (safe isolation)
    • off for config file updates or when docker isn't available
  5. Execute with Full Auto: Use --full-auto --skip-git-repo-check for autonomous completion
  6. Suppress/Show Thinking: Use 2>/dev/null to hide reasoning, omit to show

Troubleshooting

Codex Command Not Found

# Verify installation
which codex

# Add to PATH if needed
export PATH=$PATH:/path/to/codex/bin

# Verify again
codex --version

Authentication Errors

# Check API key is set
echo $OPENAI_API_KEY

# If empty, set it
export OPENAI_API_KEY=your_key_here

# Or configure via codex
codex config set api_key $OPENAI_API_KEY

Session Resume Fails

# List available sessions
codex sessions list

# Resume specific session by ID
codex resume --session <session_id>

# Start fresh if session is corrupted
codex exec "continue previous task: [describe task]"

Thinking Tokens Overflow Context

Always use 2>/dev/null to suppress stderr (thinking tokens) unless debugging:

# Good - suppresses thinking
codex exec "task" 2>/dev/null

# Only for debugging - shows thinking
codex exec "task"

Docker Sandbox Issues

# Verify Docker is running
docker ps

# Use read-only sandbox if Docker unavailable
codex exec --sandbox read-only "task"

# Or disable sandbox (use cautiously)
codex exec --sandbox off "task"

Model Not Available

# List available models
codex models list

# Use fallback model if preferred isn't available
codex exec -m gpt-5.4-mini "task"

Best Practices

  1. Always verify Codex installation before delegating tasks
  2. Use read-only sandbox for analysis tasks to prevent accidental changes
  3. Suppress thinking tokens (2>/dev/null) to avoid context overflow
  4. Choose appropriate reasoning effort - high for complex tasks, low for simple ones
  5. Resume sessions for iterative refinement rather than starting fresh
  6. Provide detailed prompts - Codex performs better with clear, structured instructions
  7. Use full-auto mode for autonomous completion without interruptions
  8. Review Codex output before applying changes to critical code

Environment Variables

# Required
export OPENAI_API_KEY=sk-...

# Optional
export CODEX_DEFAULT_MODEL=gpt-5.3-codex-spark
export CODEX_DEFAULT_SANDBOX=read-only
export CODEX_DEFAULT_REASONING=medium

Integration with Claude Code

When Claude Code activates this skill:

  1. Detect trigger phrases in user prompt
  2. Ask for model selection if not specified
  3. Ask for reasoning effort if not specified
  4. Determine appropriate sandbox mode based on task
  5. Construct and execute codex command
  6. Parse and summarize output for user
  7. Offer to resume session for follow-up

This enables seamless delegation of complex coding tasks while Claude Code maintains conversational context and user interaction.

FAQ

What does the skill-codex-delegation skill do?

Delegate coding tasks from Claude Code to OpenAI Codex CLI for autonomous code analysis, refactoring, and multi-file editing workflows

How do I install skill-codex-delegation?

Run npx skills add https://github.com/reason-machines/codex-skills --skill skill-codex-delegation in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/skill-codex-delegation/ (personal) or .claude/skills/skill-codex-delegation/ (project).

Which AI agents can use skill-codex-delegation?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is skill-codex-delegation safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains skill-codex-delegation?

It is published by reason-machines in reason-machines/codex-skills. It has 236 recorded installs.

More from reason-machines/codex-skills

View all →

academic-research-skills-codex

reason-machines/codex-skills

Open the skill to read its SKILL.md instructions.

codexplusplus-launcher

reason-machines/codex-skills

Enhanced launcher for Codex App that unlocks plugins, enables session deletion, exports conversations, and syncs provider sessions via CDP injection

Security286 installs

awesome-codex-subagents

reason-machines/codex-skills

A curated collection of 136+ specialized Codex subagents for development tasks across 10 categories

AI & Agents273 installs

codex-plugin-claude-code

reason-machines/codex-skills

Open the skill to read its SKILL.md instructions.

273 installs

awesome-codex-skills-curator

reason-machines/codex-skills

Open the skill to read its SKILL.md instructions.

270 installs

codex-plusplus-tweak-system

reason-machines/codex-skills

Open the skill to read its SKILL.md instructions.

270 installs

Popular ai & agents skills

View category →

google-agents-cli-publish

google/agents-cli

This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).

AI & Agents513.9K installs

google-agents-cli-eval

google/agents-cli

This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).

AI & Agents513.5K installs

skill-creator

anthropics/skills

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

OfficialAI & Agents416.4K installs

codex-pet

prime-skills/runcomfy-agent-skills

Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.

AI & Agents402.1K installs

full-output-enforcement

leonxlnx/taste-skill

Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.

AI & Agents401K installs

executing-plans

obra/superpowers

Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available

AI & Agents245.7K installs