codex-image
Skill0 starsChanged 2 months agoMITView on GitHub
Generate images via Codex CLI's built-in image_gen tool (gpt-image-2). OAuth auth — no API key needed. Codex CLI의 내장 image_gen 도구로 이미지 생성. OAuth 인증으로 API 키 불필요. Usage: /codex-image cherry blossom hanok, /codex-image --size 1024x1536 space cat, /codex-image --quality high seoul night
- Reads credentials
- Installs packages
15 other projects use a version of this, 2 of them edited.
Adopted by
Most recently taken up by
- qwwiwi/codex-gpt-image-2-subscriptiontheir own version, first seen Nov 5, 2026
- vediteur/claude-skillstheir own version, first seen Nov 1, 2026
- sevenevesai/skillstheir own version, first seen Nov 1, 2026
- qwwiwi/agentos-skills-publictheir own version, first seen Nov 1, 2026
- Axieon/codex-imagetheir own version, first seen Oct 20, 2026
- wjb127/codex-imageedited, first seen Oct 15, 2026
Other versions15 projects use a version of this.
Word for word · 0
None found.
Edited · 2
- wjb127/codex-image★ 6466% same
- basejb/skills★ 538% same
Wrote their own version · 13
- OpenMinis/MinisSkills★ 602same name
- revfactory/skills★ 160same name
- qwwiwi/codex-gpt-image-2-subscription★ 9same name
- xntj-ai/codex-image★ 9same name
- mishagavura/claude-code-image-generation★ 5same name
- qwwiwi/agentos-skills-public★ 4same name
- Axieon/codex-image★ 3same name
- vediteur/claude-skills★ 1same name
- almeidasrenato/codex-image-skills★ 0same name
- lsongdev/skills★ 0same name
3 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 repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- diagram-designSkill
- native-enhance-pptxSkill
- ppt-masterSkill
- ppt-template-fillSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 5 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 50
If not "Logged in":
- Distinctive: line 68
If prompt is empty, ask via AskUserQuestion:
- Very specific: line 92
If the user genuinely needs a cut-out asset, tell them gpt-image-2 (via the codex image_gen tool) cannot emit reliable alpha.
- Very specific: line 106
If --out specified, use that path
- Very specific: line 107
If --filename specified, that stem is used as-is
- Very specific: line 111
Never overwrite existing files (named outputs included — reusing a --filename requires deleting the existing file first or changing --out)
- Distinctive: line 182
Always use the Read tool to display generated images
- Distinctive: line 183
Never overwrite existing files — always use timestamped filenames
- Distinctive: line 185
Verify prompt intent before generating
“Common” is measured: kept by at least 6 in 10 of the 9 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-image — AI Image Generation via Codex OAuth
Generate images using OpenAI's gpt-image-2 model through Codex CLI.
No API key required — uses Codex OAuth (ChatGPT login) authentication.
User-facing quoted messages below are bilingual (EN / KO) — print the variant matching the user's chat language.
How it works
User prompt → Claude Code (/codex-image)
→ codex exec (OAuth token auto-managed)
→ built-in image_gen tool (gpt-image-2)
→ ~/.codex/generated_images/<session>/
→ copy to project rootImportant: OAuth tokens cannot call OpenAI REST API directly (returns 401). Must go through
codex execwhich handles auth internally.
Step 1 — Verify Codex CLI & Auth
which codex 2>/dev/null && codex --version 2>/dev/null || echo "NOT_FOUND"If NOT_FOUND, stop:
"Codex CLI not installed. Run
npm install -g @openai/codexthencodex login." "Codex CLI 없음.npm install -g @openai/codex후codex login실행해."
codex login status 2>&1If not "Logged in":
"Codex login required. Run
codex loginin terminal. OAuth login enables image generation without API key." "Codex 로그인 필요. 터미널에서codex login실행. OAuth 로그인하면 API 키 없이 이미지 생성 가능."
Step 2 — Parse Arguments
Extract from $ARGUMENTS:
| Flag | Values | Default | Description |
--size | 1024x1024, 1024x1536, 1536x1024, auto | 1024x1024 | Image dimensions |
--quality | low, medium, high, auto | auto | Generation quality |
--out | directory path | project root | Save location |
--filename | name without extension | codex-image-<timestamp> | Output filename stem |
-n | 1–10 | 1 | Number of images |
Remaining text → image prompt.
If prompt is empty, ask via AskUserQuestion:
"What image should I generate? Enter a prompt." "어떤 이미지를 생성할까? 프롬프트를 입력해줘."
Step 2.5 — Background normalization (avoid the transparency checkerboard)
Known
gpt-image-2failure mode. When a prompt asks for atransparent background,gpt-image-2does NOT return true alpha — it paints a literal gray-and-white checkerboard (the pattern editors use to display transparency) into the RGB pixels. The result looks broken on any real backdrop. This skill therefore never passes a transparency request straight through.
Strip transparency phrasing from the prompt before generating (the Step 4 task carries a hard background rule as a second guard, so this is belt-and-suspenders):
# Neutralize "transparent background" / "transparent bg" / "no background" so the model
# does not bake a checkerboard. Caller-named backdrop colors (e.g. "#FAFAF9 background",
# "white background") are kept and become the clean solid fill.
_PROMPT=$(printf '%s' "${_PROMPT}" \
| sed -E 's/(fully |truly )?transparent[ -]+(background|bg)/clean solid background/Ig' \
| sed -E 's/\bno background\b/clean solid background/Ig')If the user genuinely needs a cut-out asset, tell them gpt-image-2 (via the codex
image_gen tool) cannot emit reliable alpha; generate on a flat solid color and remove
the background afterward with an image editor. Do NOT request "transparent" to get it.
Step 3 — Determine Save Path
_PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
_OUT_DIR="${_PROJECT_ROOT}"
_TIMESTAMP=$(date +%Y%m%d-%H%M%S)
# --filename takes precedence; fall back to timestamp stem
_FILENAME="${_FILENAME_ARG:-codex-image-${_TIMESTAMP}}"- If
--outspecified, use that path - If
--filenamespecified, that stem is used as-is - Single image (default stem):
codex-image-<timestamp>.png - Single image (
--filename foo):foo.png - Multiple (
-n > 1):<stem>-1.png,<stem>-2.png, ... - Never overwrite existing files (named outputs included — reusing a
--filenamerequires deleting the existing file first or changing--out)
Step 4 — Generate Image
codex exec "Perform the following tasks:
1. Use the built-in image_gen tool to generate an image.
2. Prompt: '${_PROMPT}'
3. Background rule (MUST follow): the image must have a clean, single solid flat background. NEVER paint a transparency/alpha checkerboard — i.e. no alternating gray-and-white squares anywhere. If the prompt implies a 'transparent' or 'no' background, render a clean solid background of the nearest plain color instead (use the backdrop color named in the prompt if any, otherwise plain white).
4. Size: ${_SIZE}
5. Quality: ${_QUALITY}
6. Count: ${_N}
7. Copy the generated image to '${_OUT_DIR}/${_FILENAME}.png'. For multiple images use -1.png, -2.png suffix.
8. Print the saved file path and size." \
-C "${_PROJECT_ROOT}" \
-s workspace-write \
-c 'model_reasoning_effort="medium"' \
--skip-git-repo-check \
2>&1timeout: 120000ms (2 min)
Required flags
-s workspace-write— file write permission--skip-git-repo-check— works outside git repos
Internal flow (Codex side)
- Codex calls built-in
image_gentool (gpt-image-2) - Image saved to
~/.codex/generated_images/<session-id>/ig_*.png - Codex copies file to specified project path
- Reports file path and size
Step 5 — Display Result
═══════════════════════════════════════════════
IMAGE GENERATED / 이미지 생성 완료
═══════════════════════════════════════════════
Prompt: <prompt used>
Size: <size>
Quality: <quality>
Count: <n>
Auth: OAuth (ChatGPT)
───────────────────────────────────────────────
<saved file path(s)>
═══════════════════════════════════════════════Always display the generated image using the Read tool.
Step 6 — Follow-up
- "Run
/codex-imageagain to generate another image." - For Next.js projects: suggest moving to
public/images/if needed. - ppt-master integration: this project's PPT pipeline generates images through
image_gen.py --manifestwhose default backendcodex(scripts/image_backends/backend_codex.py) uses the samecodex exec+image_genmechanism as this skill — no API key or.envneeded, onlycodex login. Use/codex-imagedirectly for one-off images outside the pipeline (e.g. re-rolling a single asset with--out <project>/images --filename <slot>).
Error Handling
| Error | Message |
| Auth expired | "Codex OAuth expired. Run codex login again." / "OAuth 인증 만료. codex login 다시 실행." |
| Model access denied | "No access to gpt-image-2. Check your OpenAI plan." / "gpt-image-2 접근 권한 없음. OpenAI 플랜 확인." |
| Timeout (>2min) | "Generation timed out. Try --quality low." / "생성 시간 초과. --quality low로 재시도." |
| Rate limit | "API rate limited. Wait and retry." / "API 호출 제한. 잠시 후 재시도." |
| Trust error | Check --skip-git-repo-check flag or add project to ~/.codex/config.toml |
Rules
- Always use the Read tool to display generated images
- Never overwrite existing files — always use timestamped filenames
- OAuth only — do not attempt direct REST API calls with OAuth token (returns 401)
- Verify prompt intent before generating
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.

