codex-cli
Skill139 starsChanged 9 months agoMITView on GitHub
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.
23 other projects use a version of this.
Adopted by
Most recently taken up by
- kortix-ai/sunatheir own version, first seen Nov 8, 2026
- Awakehsh/awesome-agent-toolstheir own version, first seen Nov 8, 2026
- kortix-ai/CompanyOStheir own version, first seen Nov 8, 2026
- legibet/agent-skillstheir own version, first seen Nov 1, 2026
- samirpatil2000/skillstheir own version, first seen Nov 1, 2026
- deedeeharris/claude-skillstheir own version, first seen Oct 18, 2026
Used with
Projects with it also use opencode-cli, antigravity-cli and 6 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
julweberSkillopencode-cli
Expert control of opencode via the command line. Use when running opencode TUI, headless server, web UI, or the `run` non-interactive mode; managing sessions, providers, agents, MCP servers, models, stats, import/export, GitHub integration, debugging, database tools, upgrades, or shell completions.
Also in 5 projects that use this
yu-iskwSkillantigravity-cli
Executes coding, review, research, and automation tasks using Google Antigravity CLI (`agy`). Uses Antigravity's native fine-grained allow/ask/deny permissions instead of Gemini CLI approval modes.
Also in 3 projects that use this
julweberSkillclaude-cli
Expert control of the `claude` CLI (Claude Code). Use when running Claude Code interactively or non-interactively, managing sessions, configuring MCP servers, managing plugins, handling authentication, or piping prompts through claude for scripting.
Also in 3 projects that use this
ihiteshguptaSkillterraform
Expert in Infrastructure as Code with Terraform. Use for creating, managing, and versioning infrastructure across cloud providers.
Also in 3 projects that use this
mrgoonieSkillclaude-code
Also in 4 projects that use this
GoogleSkillponytail
Forces the laziest solution that actually works, simplest, shortest, most minimal. Channels a senior dev who has seen everything: question whether the task needs to exist at all (YAGNI), reach for the standard library before custom code, native platform features before dependencies, one line before fifty. Supports intensity levels: lite, full (default), ultra. Use on ANY coding task: writing, adding, refactoring, fixing, reviewing, or designing code, and choosing libraries or dependencies. Also use whenever the user says "ponytail", "be lazy", "lazy mode", "simplest solution", "minimal solution", "yagni", "do less", or "shortest path", or complains about over-engineering, bloat, boilerplate, or unnecessary dependencies. Do NOT use for non-coding requests (general knowledge, prose, translation, summaries, recipes).
Also in 4 projects that use this
Other versions23 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 23
- kortix-ai/suna★ 21ksame name
- kortix-ai/CompanyOS★ 21ksame name
- wentorai/Research-Claw★ 858same name
- scarletkc/agents★ 227same name
- revfactory/skills★ 160same name
- georgekhananaev/claude-skills-vault★ 28same name
- samirpatil2000/skills★ 17same name
- mr-ske1r/1c-ai-devstart★ 16same name
- Awakehsh/awesome-agent-tools★ 8same name
- deedeeharris/claude-skills★ 7same name
13 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository23 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- add-feishuSkill
- claude-session-managerSkill
- codex-session-managerSkill
- cover-designSkill
- cover-imageSkill
- diagram-to-imageSkill
- fpl-copilotSkill
- interactive-inputSkill
- mining-session-skillsSkill
- Next.js Security ScanSkill
- personal-chinese-writing-styleSkill
- producing-videoSkill
- promote-postSkill
- publish-substack-articleSkill
- publish-x-articleSkill
- publish-zsxq-articleSkill
- Python Security ScanSkill
- share-readingSkill
- slides-videoSkill
- subtitle-correctionSkill
- tweet-insightSkill
- video-plannerSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. 0 are common, 11 are distinctive, and 12 are very specific to this project.
0
Common
Most of the 20 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
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 …
- Distinctive: line 20
Before using Codex CLI, verify it is available:
- Very specific: line 28
If codex is missing, tell the user Codex CLI is not available in this environment and stop.
- Very specific: line 30
If codex exec --help is available, use it as the source of truth for the installed CLI flags.
- Distinctive: line 34
Use this for normal delegation:
- Distinctive: line 58
If the prompt is long, pass it via stdin:
- Very specific: line 64
When using shell commands from another agent, avoid dangerous flags unless the user explicitly asked for them.
- Very specific: line 77
Keep the prompt scoped to one task.
- Very specific: line 89
If the installed CLI supports a different resume syntax, follow codex exec resume --help.
- Very specific: line 110
Put -i flags before the prompt text.
- Distinctive: line 111
Use common raster formats: PNG (best for screenshots/UI, lossless) or JPEG.
- Very specific: line 137
If CODEX_HOME is unset, use ~/.codex/generated_images/<codex-session-id>/.
- Distinctive: line 144
After any Codex image-generation request, find the image path before replying.
- Distinctive: line 158
If the session id is not known, list recent generated images:
- Distinctive: line 164
When possible, sort by modification time:
- Very specific: line 171
If the user requested a project asset, copy or move the selected image into the project after generation if permissions allow.
- Distinctive: line 175
If the user requested a specific aspect ratio, verify dimensions before answering.
- Distinctive: line 219
If Codex exits with network, auth, or model refresh errors, report the error plainly and include the relevant stderr lines.
- Very specific: line 221
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 …
- Very specific: line 223
If the host agent cannot read $CODEX_HOME/generated_images, ask the user to grant access or run:
- Distinctive: line 231
Do not pass secrets to Codex unless the user explicitly asks and understands the risk.
- Very specific: line 233
Use read-only for consultation.
- Distinctive: line 235
Do not claim Codex performed work solely from its final message.
“Common” is measured: kept by at least 6 in 10 of the 20 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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 --helpIf 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.txtWhen 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
-iflags 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-onlyso 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.logImage 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_HOMEis 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-ee592f0d8a17Then 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 -printWhen possible, sort by modification time:
find "${CODEX_HOME:-$HOME/.codex}/generated_images" -type f -maxdepth 3 -print0 \
| xargs -0 ls -ltIf 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.pngPortable fallback:
file /path/to/image.pngReport 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_HOMEor 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 -ltSafety 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.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

