From codex-imagegen
Generate or edit images by invoking OpenAI's gpt-image-2 ("image 2") through headless `codex exec`. Trigger when the user asks to create, generate, draw, design, or edit an image, logo, icon, illustration, banner, sprite sheet, placeholder art, or any visual asset — and they have not specified a different generator (Stable Diffusion, Midjourney, DALL·E API directly, etc.). Also use when the user wants to transform or extend a reference image they have provided locally.
How this skill is triggered — by the user, by Claude, or both
Slash command
/codex-imagegen:codex-imagegenThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generates images via the **`gpt-image-2`** model (the "image 2" model) by invoking the Codex CLI in non-interactive mode. The Codex CLI's built-in `image_gen` skill handles the actual model call; this skill is the bridge that lets Claude Code drive it headlessly and place the result inside the user's workspace.
Generates images via the gpt-image-2 model (the "image 2" model) by invoking the Codex CLI in non-interactive mode. The Codex CLI's built-in image_gen skill handles the actual model call; this skill is the bridge that lets Claude Code drive it headlessly and place the result inside the user's workspace.
codex is on PATH (which codex).~/.codex/auth.json exists) or OPENAI_API_KEY is set in the environment.Run the bundled helper script. It owns all the flags, the $imagegen prefix, the stdout-parse, and the bwrap-sandbox workaround.
~/.claude/skills/codex-imagegen/imagegen.sh <output.png> "<prompt>" [reference_image ...]
<output.png> — absolute or workspace-relative path where the final PNG should land.<prompt> — the image description. Be specific about subject, style, composition, palette, and background. The script auto-prepends $imagegen so Codex routes to the built-in image skill.[reference_image ...] — zero or more local image files to attach as references (passed through codex exec -i). Use these when the user wants to transform, restyle, or extend an existing asset.The script writes the final file to <output.png> and prints wrote <output.png> (source: <codex-cache-path>) on success.
logo.png, hero.png). Don't put it in /tmp unless the user asks.Read tool on the output PNG so the image renders inline for the user. This is the verification step — never claim success without doing it.file <out> if useful), and the prompt actually used. Skip filler.When the user provides a source image and wants it modified:
~/.claude/skills/codex-imagegen/imagegen.sh out.png \
"Redraw this scene in watercolor, soft pastel palette, preserve composition" \
./input.jpg
Codex will receive the reference via -i and the prompt should describe the transformation, not redescribe the source.
bwrap: Failed RTM_NEWADDR: Operation not permitted — Linux sandbox blocks codex's own copy step. The helper already works around this by parsing the source path from stdout and copying it itself, so this should not surface to the user. If it does, the image was still generated; rerun the script or grep ~/.codex/generated_images/ for the most recent file.could not locate generated image in codex output — codex exec failed before producing a file. Re-read the captured stderr (the script prints the full log on failure) to diagnose: auth issues, rate limits, content-policy refusals.curl / the SDK. If the user explicitly wants the raw API (e.g. for batch generation, custom params not exposed by Codex), say so and write a small Python/Node script instead.codex exec from the user's shell.auth.json is missing and OPENAI_API_KEY is unset, tell the user to run codex login themselves; do not attempt it for them (it's interactive).Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub rancheng/my_claude_skills --plugin codex-imagegen