MCPInstall

codex-cli

Use when an agent needs to delegate a task to the OpenAI Codex CLI from another agent environment such as Claude Code, OpenClaw, or similar. Covers checking whether Codex CLI is installed, running one-off Codex prompts with codex exec, resuming sessions, collecting outputs, attaching images or files as input with -i/stdin, and handling Codex image generation including finding and reporting generated image file paths.

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

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/sugarforever/01coder-agent-skills --skill codex-cli
  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 codex-cli 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 CLI

Use this skill when the user asks this agent to talk to Codex, consult Codex, delegate a coding/review/research task to Codex CLI, or ask Codex to generate an image.

The core interface is:

codex exec "prompt"

For automation, prefer non-interactive codex exec over interactive codex.

First Check

Before using Codex CLI, verify it is available:

command -v codex
codex --version
codex exec --help

If codex is missing, tell the user Codex CLI is not available in this environment and stop. Do not simulate a Codex response.

If codex exec --help is available, use it as the source of truth for the installed CLI flags. Codex CLI changes over time.

One-Off Task Workflow

Use this for normal delegation:

codex exec -C "$PWD" -s read-only "Review this repository and identify likely bugs"

For tasks that may edit files, use the sandbox the user requested or the host agent allows:

codex exec -C "$PWD" -s workspace-write "Implement the requested change"

For a response file:

codex exec -C "$PWD" -o /tmp/codex-last-message.md "Summarize this project"

For machine-readable events:

codex exec -C "$PWD" --json -o /tmp/codex-last-message.md "Analyze this project"

If the prompt is long, pass it via stdin:

codex exec -C "$PWD" - < /tmp/prompt.txt

When using shell commands from another agent, avoid dangerous flags unless the user explicitly asked for them. Prefer read-only for review, planning, critique, image generation, and analysis.

Prompt Shape

For non-trivial tasks, shape the delegated prompt with OpenAI's Codex best-practices structure:

Goal:
Context:
Constraints:
Done when:

Keep the prompt scoped to one task. For complex implementation work, ask Codex for a plan first in read-only mode, then run a separate write task after the plan is accepted.

Session Resume

Codex emits a session id in normal startup output and in JSONL events as thread.started.

To resume:

codex exec resume <session-id> "Continue from the previous task"

If the installed CLI supports a different resume syntax, follow codex exec resume --help.

Image and File Input

Codex cannot browse or read image files on its own. To let Codex see an image, attach it explicitly with -i/--image. This is the input side; image generation (below) is the output side.

Attach a single image:

codex exec -C "$PWD" -s read-only -i screenshot.png "Explain the error shown here"

Attach multiple images. Both forms work — comma-separated or a repeated flag:

codex exec -i before.png,after.png "Compare these two UI states"
codex exec -i mock1.png -i mock2.png "Which layout is closer to the spec?"

Best practices:

  • Put -i flags before the prompt text.
  • Use common raster formats: PNG (best for screenshots/UI, lossless) or JPEG. Keep images reasonably small; very large images slow the request.
  • Combine images with a clear text instruction — the image alone is rarely enough context.
  • For visual review/analysis, pair with -s read-only so Codex inspects but does not edit.

For non-image files there is no attach flag. Two options:

  • Let Codex read the file from the workspace: point it at the directory with -C "$PWD" and name the file in the prompt ("Review src/auth.ts"). Use this for files already in the repo.
  • Pipe file contents via stdin. With a prompt also present, stdin is appended to the prompt as a <stdin> block:
codex exec -C "$PWD" "Summarize the attached log" < /tmp/build.log

Image Generation Workflow

Codex can generate images through its built-in image generation tool when asked through codex exec.

Example:

codex exec "Generate a black banana image with aspect ratio 16:9"

Important behavior:

  • Built-in image generation commonly saves files under $CODEX_HOME/generated_images/<codex-session-id>/.
  • If CODEX_HOME is unset, use ~/.codex/generated_images/<codex-session-id>/.
  • Codex may not print the path in its final response.
  • The agent using this skill must proactively locate and report generated image paths after image generation.
  • The PNG metadata may not expose the exact image model. Do not claim a specific backend model unless Codex output, CLI logs, or metadata clearly show it.

Finding Generated Images

After any Codex image-generation request, find the image path before replying.

First extract the Codex session id from output if available. It may look like:

session id: 019e8cbf-5054-7131-9440-ee592f0d8a17

Then check:

ls -l "${CODEX_HOME:-$HOME/.codex}/generated_images/<session-id>"

If the session id is not known, list recent generated images:

find "${CODEX_HOME:-$HOME/.codex}/generated_images" -type f -maxdepth 3 -print

When possible, sort by modification time:

find "${CODEX_HOME:-$HOME/.codex}/generated_images" -type f -maxdepth 3 -print0 \
  | xargs -0 ls -lt

If the user requested a project asset, copy or move the selected image into the project after generation if permissions allow. Never leave a project-referenced asset only under $CODEX_HOME/generated_images.

Verifying Aspect Ratio

If the user requested a specific aspect ratio, verify dimensions before answering.

On macOS:

sips -g pixelWidth -g pixelHeight /path/to/image.png

Portable fallback:

file /path/to/image.png

Report actual dimensions and whether they match approximately or exactly. Many generated images use nearest integer dimensions, so a 16:9 request may produce dimensions like 1672 x 941, which is effectively 16:9 but not mathematically exact.

Reporting Results

For normal Codex tasks, report:

  • command used, summarized if long
  • Codex status or final answer
  • any files Codex changed, if known
  • any limitations, errors, or missing permissions

For image tasks, always report:

  • generated image path
  • actual dimensions if available
  • whether the path is in $CODEX_HOME or copied into the project
  • whether the exact image model is known or not

Example response:

Codex generated the image here:
/Users/me/.codex/generated_images/019e.../ig_....png

Actual size: 1672 x 941, effectively 16:9.
The output does not expose the exact image backend model, so I cannot verify whether it was gpt-image-2.

Failure Handling

If Codex exits with network, auth, or model refresh errors, report the error plainly and include the relevant stderr lines.

If Codex claims it generated an image but no image file exists under $CODEX_HOME/generated_images, say so explicitly and do not invent a path.

If the host agent cannot read $CODEX_HOME/generated_images, ask the user to grant access or run:

find "${CODEX_HOME:-$HOME/.codex}/generated_images" -type f -maxdepth 3 -print0 | xargs -0 ls -lt

Safety Notes

Do not pass secrets to Codex unless the user explicitly asks and understands the risk.

Use read-only for consultation. Use workspace-write only when Codex is expected to edit files. Avoid danger-full-access unless the user explicitly requested it in a controlled environment.

Do not claim Codex performed work solely from its final message. When file changes matter, inspect the filesystem or Git diff after the run.

FAQ

What does the codex-cli skill do?

Use when an agent needs to delegate a task to the OpenAI Codex CLI from another agent environment such as Claude Code, OpenClaw, or similar. Covers checking whether Codex CLI is installed, running one-off Codex prompts with codex exec, resuming sessions, collecting outputs, attaching images or files as input with -i/stdin, and handling Codex image generation including finding and reporting generated image file paths.

How do I install codex-cli?

Run npx skills add https://github.com/sugarforever/01coder-agent-skills --skill codex-cli 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/codex-cli/ (personal) or .claude/skills/codex-cli/ (project).

Which AI agents can use codex-cli?

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 codex-cli 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 codex-cli?

It is published by sugarforever in sugarforever/01coder-agent-skills. It has 231 recorded installs.

More from sugarforever/01coder-agent-skills

View all →

china-stock-analysis

sugarforever/01coder-agent-skills

A股价值投资分析工具,提供股票筛选、个股深度分析、行业对比和估值计算功能。基于价值投资理论,使用akshare获取公开财务数据,适合低频交易的普通投资者。

Business & Finance12.5K installs

publish-substack-article

sugarforever/01coder-agent-skills

Publish Markdown articles to Substack as drafts. Use when user wants to publish a Markdown file to Substack, or mentions "发布到 Substack", "Substack article", "publish to Substack". Handles Markdown-to-HTML conversion and saves as draft (never auto-publish).

Docs & Writing605 installs

next.js security scan

sugarforever/01coder-agent-skills

Comprehensive security vulnerability scanner for Next.js and TypeScript/JavaScript projects. Detects OWASP Top 10 vulnerabilities, XSS, injection flaws, authentication issues, hardcoded secrets, and Next.js-specific security problems. Audits dependencies for known CVEs and generates actionable security reports.

Security554 installs

python security scan

sugarforever/01coder-agent-skills

Comprehensive security vulnerability scanner for Python projects including Flask, Django, and FastAPI applications. Detects OWASP Top 10 vulnerabilities, injection flaws, insecure deserialization, authentication issues, hardcoded secrets, and framework-specific security problems. Audits dependencies for known CVEs and generates actionable security reports.

Security541 installs

subtitle-correction

sugarforever/01coder-agent-skills

Correct subtitle files (.srt) generated from speech recognition. Use when the user uploads subtitle files and asks to correct, fix, or proofread subtitles, especially for technical content like programming tutorials, AI/ML courses, or any content with domain-specific terminology. Supports Chinese and English subtitles with intelligent error detection and correction while preserving exact timeline information.

AI & Agents537 installs

diagram-to-image

sugarforever/01coder-agent-skills

Convert Mermaid diagrams and Markdown tables to images (PNG) for platforms that don't support rich formatting. Use when user asks to "convert to image", "export as PNG", "make this an image", or has content for X/Twitter that needs visual exports.

Media & Creative509 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