From mutils
This skill should be used when the user asks about 'codex の使い方', 'codex exec のやり方', 'codex でレビュー', 'codex review', 'codex の設定', 'how to use codex', 'codex CLI guide', or wants to run OpenAI Codex CLI from within Claude Code. Covers exec patterns, sandbox modes, output separation, configuration, and integration guidelines.
How this skill is triggered — by the user, by Claude, or both
Slash command
/mutils:codex-guideThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
OpenAI Codex CLI (`codex`) is a terminal-based AI coding agent powered by OpenAI models. This skill covers how to invoke Codex from within Claude Code sessions — primarily as a second-opinion reviewer or non-interactive task runner.
OpenAI Codex CLI (codex) is a terminal-based AI coding agent powered by OpenAI models. This skill covers how to invoke Codex from within Claude Code sessions — primarily as a second-opinion reviewer or non-interactive task runner.
!codex --version 2>/dev/null || echo "codex not installed"
Codex CLI has two main execution modes:
codex "prompt"): Opens a TUI session. Not suitable for use within Claude Code — use exec insteadcodex exec "prompt"): Runs headlessly, returns output. This is the primary integration point with Claude CodeSandbox controls what file-system and network access Codex-spawned commands have:
read-only: Can read the repo but cannot write files or run destructive commands. Use for reviews and analysisworkspace-write: Can write within the project directory. Use for code generation and fixesdanger-full-access: No sandbox restrictions. Use only when explicitly neededSet via -s flag: codex exec -s read-only "prompt"
codex execRun Codex as a reviewer with output separated from logs. This is the standard pattern used by the planner persona.
cat <file> | codex exec -s read-only -o <output-file> "review instructions" > <log-file> 2>&1
-o <file>: Write only the final answer to this file. Read this file for results> <log> 2>&1: Redirect verbose execution logs (thinking, tool calls) to a separate file. Do NOT read this unless debugging — it is large and will bloat context<stdin> block to the promptfunction review_with_codex(content_path, instructions):
output = tmp_file("codex-output.txt")
log = tmp_file("codex-log.txt")
exit_code = run("cat {content_path} | codex exec -s read-only -o {output} '{instructions}' > {log} 2>&1")
if exit_code != 0:
record_failure(reason: "codex failed", exit_code)
return fallback_to_self_review()
return read(output)
Failure handling: If codex is not installed, not logged in, times out, or exits non-zero — record the failure reason and fall back to self-review. Never block the main workflow on Codex failure.
codex reviewDedicated review subcommand that automatically diffs against a base branch or commit.
codex review --base main
codex review --uncommitted
codex review --commit <sha>
--base <branch>: Review diff between current branch and the base branch--uncommitted: Review staged, unstaged, and untracked changes--commit <sha>: Review changes introduced by a specific commit--title <title>: Optional commit title for the review summaryRun a one-shot task with Codex and capture the result.
codex exec -s workspace-write -o result.txt "implement the function described in TODO.md"
Use -s workspace-write when Codex needs to write files. Use -s read-only for analysis-only tasks.
Attach images for visual context.
codex exec -i screenshot.png "describe what this UI shows"
Codex has a built-in image generation tool (DALL-E). Unlike Claude Code, Codex can generate actual raster images (PNG) — not just SVG, HTML, or Mermaid diagrams. To trigger it, explicitly instruct Codex to use its image generation tool in the prompt.
codex exec -s workspace-write -o result.txt "画像生成ツールを使用して、<description> の画像を生成し、<path> に保存して"
-s workspace-write so Codex can write the generated image file to diskWhen calling codex exec from within Claude Code:
-o <file> to capture the final answer separately> log.txt 2>&1)-o output file for resultsGlobal config: ~/.codex/config.toml (TOML format)
Key settings:
model: Default model (e.g., "gpt-5.5")model_reasoning_effort: Reasoning effort level (e.g., "high", "xhigh")sandbox_mode: Default sandbox modepersonality: Agent personality styleOverride any config value inline with -c:
codex exec -c model="gpt-5.5" -s read-only "prompt"
Place .codex/ directory in the project root:
.codex/config.toml: Project-specific configuration overrides.codex/instructions.md: Project-specific instructions (equivalent to CLAUDE.md)Add external MCP servers to Codex:
codex mcp add <name> -- <command> [args...]
codex mcp list
codex mcp remove <name>
Manage Codex plugins from marketplace:
codex plugin list
codex plugin add <name>
codex plugin remove <name>
codex resume: Resume a previous interactive session (picker UI)codex resume --last: Resume the most recent sessioncodex fork: Fork a previous session to start from a checkpointcodex archive <id>: Archive a saved sessioncodex delete <id>: Permanently delete a sessionSession index: ~/.codex/session_index.jsonl
Archived sessions: ~/.codex/archived_sessions/*.jsonl
codex doctor # Full diagnostic report
codex doctor --json # Machine-readable report
codex doctor --summary # Grouped summary only
Check installation health, auth status, config validity, and runtime availability.
When Claude Code calls Codex, treat Codex as an advisory tool — not an authority:
The planner persona demonstrates this pattern: it pipes plan files to codex exec -s read-only for review, treats the feedback as input, and makes the final judgment itself.
(No bundled resources found)
npx claudepluginhub masseater/claude-code-plugin --plugin mutilsGuides collaborative design exploration before implementation: explores context, asks clarifying questions, proposes approaches, and writes a design doc for user approval.
Creates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.
Implements work from a spec or tickets using TDD at agreed seams, with regular typechecking and test runs, followed by code review.