Skip to content

cskwork/claude-codex-skill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

claude-codex-skill

Generate images with the OpenAI Codex CLI without an OPENAI_API_KEY — plus second-opinion code review and implementation, all from inside Claude Code.

Red panda holding a heart-mug coffee, generated by codex CLI on ChatGPT login alone — no OPENAI_API_KEY

↑ Generated by codex exec in 12 seconds. No OPENAI_API_KEY. Just codex login with ChatGPT.

Stars MIT codex-cli ≥ 0.128 Claude Code skill


The hook

codex CLI ships with a built-in image generation tool (image_gen.imagegen) that nobody talks about.

It's gated behind a feature flag that is already on by default (codex features list | grep image_generation). It uses your ChatGPT subscription auth — no separate OpenAI API key, no separate billing.

The catch: in codex exec mode, the model only picks this tool if you don't tell it to "use the OpenAI API" or "use curl/python". Most users never discover it.

This skill teaches Claude Code the right prompt shape to unlock it — plus wires up two more modes for the things codex is actually built for: review and impl.

Three modes

The skill exposes one slash command, /codex-cli, with a subcommand as the first argument:

Invocation What it does Example
/codex-cli review Hands the diff to Codex for a second-opinion review /codex-cli review --base main
/codex-cli impl <prompt> Hands a coding task to Codex non-interactively /codex-cli impl "add JWT refresh to api/auth.ts"
/codex-cli image <prompt> Generates an image via Codex's built-in tool — no API key /codex-cli image "isometric CPU diagram, neon"

You can also just describe what you want in natural language ("ask codex to review my diff", "have codex generate an isometric CPU diagram"). The skill's when_to_use field tells Claude to load it on those phrasings.

Install

One-liner (Windows / PowerShell)

iwr -useb https://raw.githubusercontent.com/cskwork/claude-codex-skill/main/install.ps1 | iex

One-liner (macOS / Linux)

curl -fsSL https://raw.githubusercontent.com/cskwork/claude-codex-skill/main/install.sh | bash

Manual

Drop SKILL.md into your Claude Code skills directory:

OS Path
Windows %USERPROFILE%\.claude\skills\codex-cli\SKILL.md
macOS / Linux ~/.claude/skills/codex-cli/SKILL.md

Restart Claude Code. The skill auto-registers — type /codex-cli to confirm.

Prerequisites

  • Claude Code installed
  • Codex CLI ≥ 0.128.0 (codex --version)
  • codex login status shows "Logged in" (ChatGPT login is enough; API key login also works)

Usage examples

1. Code review on uncommitted changes

/codex-cli review

Claude takes Codex's findings, regroups them by CRITICAL / HIGH / MEDIUM / LOW, and writes them back as a structured review with file:line citations — instead of dumping raw output. If Codex contradicts something Claude already verified, it flags the conflict instead of silently siding with Codex.

2. Hand off a coding task

/codex-cli impl "add a /healthz endpoint to api/server.ts that returns 200 if redis is reachable"

Runs codex exec -s workspace-write -C <repo>, sandboxed to your workspace. Network access on, writes outside the repo blocked.

3. Generate an image

/codex-cli image "isometric data center, glowing fiber, dark background, 1024x1024"

→ Claude tells Codex to generate it (without naming an API). → Codex picks image_gen.imagegen automatically. → PNG lands at ~/.codex/generated_images/<session>/ig_*.png. → Claude copies it to your workspace and prints the absolute path.

Why this skill exists

Three pain points it removes:

  1. The image-generation discovery problem. Codex CLI's image tool works through ChatGPT login alone, but the docs barely mention it. Most people end up trying to set OPENAI_API_KEY and giving up. This skill encodes the right invocation.
  2. The Windows sandbox copy bug. On Windows, codex-cli 0.128.0 generates the image fine but fails to copy it into your workspace (CreateProcessAsUserW failed: 5). Most users see the failure message and assume nothing was generated. The skill knows to look in ~/.codex/generated_images/ and copy the file itself.
  3. Sandbox safety. The skill never escalates to -s danger-full-access or --dangerously-bypass-approvals-and-sandbox without explicit per-run approval. You get Codex's power without bypassing its guardrails.

How it actually works

┌─────────────────┐  /codex-cli image "..."   ┌──────────────────┐
│  Claude Code    │ ────────────────────────▶ │  Skill (this)    │
└─────────────────┘                           └────────┬─────────┘
                                                       │
                                                       ▼
                              codex exec -s workspace-write -C <out>
                                          "Generate an image of ..."
                                                       │
                                                       ▼
                             ┌──────────────────────────────────────┐
                             │  Codex CLI agent (gpt-5.5)           │
                             │  picks built-in image_gen.imagegen   │
                             │  → uses ChatGPT auth from auth.json  │
                             └──────────────────────────────────────┘
                                                       │
                                                       ▼
                              ~/.codex/generated_images/<session>/
                                          ig_<hash>.png
                                                       │
                                                       ▼
                              Claude copies → workspace/output.png

Verified — trust record

This skill ships with a reproducible test suite. The last verified run is committed at tests/RESULTS.md, so you can see exactly what was checked, when, and on which platform without running anything.

# Run the full suite (requires `codex login` with ChatGPT)
python tests/run.py

# Skip the E2E image-gen step (still validates metadata, URLs, codex install)
python tests/run.py --skip-image

The suite covers metadata correctness (frontmatter spec compliance, no fictitious slash aliases), URL availability (install one-liners actually resolve), codex prerequisites (installed + logged in), and an end-to-end image generation that proves the no-API-key path works through the documented Windows copy-workaround. See tests/README.md for the full list of checks and how to add new ones.

Compatibility matrix

Codex CLI Image gen Code review Code impl Notes
0.128.x (Windows) ✅ via skill workaround Sandbox copy bug — skill handles it
0.128.x (macOS / Linux) Should work without the copy workaround
< 0.128 ❓ untested image_generation feature flag may differ

Contributing

PRs welcome. The skill is one Markdown file (SKILL.md) + frontmatter — no build step, no JS, no dependencies. Test by editing locally and restarting Claude Code.

License

MIT — see LICENSE.

Credits

Built and verified using Claude Code itself. The first generated image (the red panda above) was the moment we confirmed the image_gen.imagegen tool works through ChatGPT auth alone — no API key required.

About

Image gen via Codex CLI without an OPENAI_API_KEY — plus code review & implementation. A Claude Code skill.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors