codex-imagegen
Skill22 starsChanged 5 months agoMITView on GitHub
Generate images (featured images, illustrations, diagrams, test images, blog visuals) using Codex CLI's built-in $imagegen skill, triggered through the codex plugin or codex CLI. Use this skill whenever the user asks to generate, create, or make an image, picture, illustration, featured image, thumbnail, or visual asset — including "generate an image of...", "create a featured image for this post", "make me an illustration", "$imagegen", "use codex to generate an image", or "image for this blog post". Also use when the user wants image variants or wants AI-generated artwork saved into the project. Do NOT use for screenshots, charts rendered from data, ASCII diagrams, or editing existing images.
- Installs packages
15 other projects use a version of this.
Adopted by
Most recently taken up by
- lothlorienblade/agent-skillstheir own version, first seen Nov 8, 2026
- github774/roblox-claude-skillstheir own version, first seen Nov 8, 2026
- JunSeo99/claude-skill-codex-imagegentheir own version, first seen Nov 2, 2026
- hyperb1iss/hyperskillstheir own version, first seen Nov 1, 2026
- BlingtronDev/codex-imagegentheir own version, first seen Oct 25, 2026
- evelan-de/claude-code-pluginstheir own version, first seen Oct 17, 2026
Used with
Projects with it also use implement.
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.
Hugging FaceSkillimplement
Make tests pass. Invoke after /write-tests produces failing tests.
Also in 3 projects that use this
Other versions15 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 15
- gongnyang/codex-fleet★ 46same name
- hyperb1iss/hyperskills★ 36same name
- JunSeo99/claude-skill-codex-imagegen★ 22same name
- mgiovani/cc-arsenal★ 8same name
- evelan-de/claude-code-plugins★ 3same name
- luminary19/atelier★ 2same name
- Vallykrie/swarmGPT★ 2same name
- BlingtronDev/codex-imagegen★ 1same name
- github774/roblox-claude-skills★ 1same name
- mizumotok/agent-skills★ 1same name
5 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 repository13 other files it gives its agents.
- ask-firstSkill
- cli-spec-to-goalSkill
- design-system-to-skillSkill
- extract-design-mdSkill
- extract-design-systemSkill
- handoff-docSkill
- orchestrateSkill
- prototype-wpSkill
- validate-block-markupSkill
- webg-spec-to-goalSkill
- wp-requirements-to-goalsSkill
- wp-rest-apiSkill
- wp-spec-to-goalSkill
The file
We split this skill into the rules it gives an agent
8 rules. 0 are common, 5 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 14 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 29
If the user named a destination folder, use it.
- Distinctive: line 31
If a file the user wants to create already exists at the destination (same intended name), ask the user before overwriting — never silently …
- Very specific: line 36
Write plain prompt text — do NOT include the $imagegen token.
- Distinctive: line 62
Leave model/effort alone; Codex defaults handle imagegen fine.
- Distinctive: line 67
If neither exists it exits with install instructions — relay them to the user.
- Very specific: line 88
If LEFTOVER_THREAD_FOLDERS is more than a handful (or the size is large), tell the user the count and size the script reported (e.g.
- Distinctive: line 96
Never sweep unprompted: old folders may hold originals from TUI sessions the user hasn't copied out yet.
- Very specific: line 106
Exit code 3: no runtime found on this machine.
“Common” is measured: kept by at least 6 in 10 of the 14 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 Imagegen
Generate images with Codex's built-in $imagegen skill and land them in the
project, keeping ~/.codex/generated_images/ from silently growing (it
accumulates ~10MB per generation and is never cleaned by Codex itself).
Everything is driven by one bundled script that survives plugin version bumps
and works on machines without the codex plugin (it falls back to codex exec).
Prerequisites
Either of these (the script auto-detects which is present):
- Codex plugin in Claude Code —
/plugin marketplace add openai/codex-plugin-cc, then/plugin install codex@openai-codex(Full guide: https://github.com/openai/codex-plugin-cc#install). - Codex CLI (any agent) —
npm i -g @openai/codex, thencodex login.
Auth is OpenAI/ChatGPT-account backed. Without one of these the script exits with code 3 and prints these install steps.
Workflow
1. Determine the destination
- If the user named a destination folder, use it.
- Otherwise default to
.codex-image/at the project root (the script creates it). - If a file the user wants to create already exists at the destination (same intended name), ask the user before overwriting — never silently replace.
2. Compose the image prompt
Write plain prompt text — do NOT include the $imagegen token; the script
prepends it safely (a $imagegen typed into a double-quoted shell string gets
expanded to an empty string and the skill silently never triggers — the script
exists partly to make that mistake impossible).
Include in the prompt text:
- A clear description of the image (subject, style, mood, colors).
- Desired dimensions or aspect ratio. The raw model output is ~1254px square; Codex resizes/crops to what you ask, so always state it (e.g. "1200x630 landscape" for a featured image).
- The exact output filename(s), e.g. "save it as featured-image.png".
- Number of variants if the user wants more than one.
The script appends the destination directory instruction automatically.
3. Run the script
bash <skill-dir>/scripts/codex-imagegen.sh --dest "<destination-dir>" "<prompt text>"- The script needs network access (Codex calls OpenAI). In Claude Code, run
it with
dangerouslyDisableSandbox: trueso the Bash sandbox doesn't block the call. In other agents/shells, run the bash command normally. - Set a generous timeout (600000 ms / 10 min). A generation takes 2–5 minutes.
- Leave model/effort alone; Codex defaults handle imagegen fine.
The script resolves the runtime itself: it globs for the codex plugin's
codex-companion.mjs across all marketplaces and versions (newest wins), and
falls back to codex exec --sandbox workspace-write when the plugin is absent.
If neither exists it exits with install instructions — relay them to the user.
4. Read the output
The script prints:
RUNTIME=— which path it used (plugin companion or codex CLI).GENERATED_FILES:followed by the new file path(s) at the destination. If Codex generated but forgot to copy to the destination, the script moves the files there itself.CLEANUP=— whether this run's~/.codex/generated_images/<thread-id>/folder was removed. It is only deleted after a file is confirmed at the destination; otherwise the originals are kept so nothing is ever lost.LEFTOVER_THREAD_FOLDERS=/LEFTOVER_TOTAL_SIZE=— pre-existing thread folders from past sessions (TUI runs, etc.) that the script never touches.
Show the user what was made — in Claude Code, view the file(s) with the Read
tool; other agents can open the path(s) printed under GENERATED_FILES:.
5. Offer a sweep when leftovers are piling up
If LEFTOVER_THREAD_FOLDERS is more than a handful (or the size is large),
tell the user the count and size the script reported (e.g. "there are N old
generation folders using X MB") and offer to clear them. Only after they confirm:
bash <skill-dir>/scripts/codex-imagegen.sh --sweepNever sweep unprompted: old folders may hold originals from TUI sessions the user hasn't copied out yet.
Failure modes
- Auth error ("refresh token was revoked" / "log out and sign in again"):
Codex needs an interactive re-login. Ask the user to run
! codex logout && codex login. - No image at destination and no new thread folder: the turn likely failed before generation — re-read the script output for the Codex error and report it. The prompt may also have been refused (content policy); rephrase and retry once.
- Exit code 3: no runtime found on this machine. Relay the script's install
steps — either the codex plugin (
/plugin marketplace add openai/codex-plugin-ccthen/plugin install codex@openai-codex; Full guide: https://github.com/openai/codex-plugin-cc#install) or the Codex CLI (npm i -g @openai/codexthencodex login).
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.

