skills/codex-imagegen/SKILL.md
Generate AI images (photos, illustrations, concept art, product shots, game assets, UI mockups, posters, textures, sprites, stickers) by delegating to Codex CLI's built-in image_gen tool. Use this skill whenever the user asks to generate, create, or make any AI-generated bitmap image in Claude Code — including requests like 'generate an image', 'create a photo of', 'make an illustration', 'design a poster', 'draw a picture', 'generate a product shot', 'create concept art', 'make a logo', 'create a thumbnail', 'generate a hero image', or any visual asset request that needs AI image generation rather than code-based SVG/HTML. Also trigger when the user says '生成图片', '画一张图', '做个海报', '生成一张照片', '帮我画', '生成插画'. Do NOT trigger for editing existing SVG/vector files, creating HTML/CSS layouts, or generating diagrams/flowcharts (those are better handled by code or other tools).
npx skillsauth add nangongwentian-fe/agent-skills codex-imagegenInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate AI images from Claude Code by delegating to Codex CLI's built-in image_gen.imagegen tool (powered by OpenAI gpt-image-2). This avoids the need for a separate OPENAI_API_KEY — Codex uses its own authentication.
Claude Code has no built-in image generation tool, but Codex CLI does. This skill bridges the gap:
Claude Code → codex exec (Bash) → Codex's image_gen.imagegen → image file → Claude Code reads it
Before generating, verify Codex is ready:
codex --version 2>/dev/null
If Codex is not installed, tell the user to install it:
npm install -g @openai/codex
Then check authentication:
codex features list 2>/dev/null | grep image_generation
If not authenticated, the user needs to run codex login interactively.
codex exec \
--json \
--skip-git-repo-check \
--ephemeral \
-o /tmp/codex-imagegen-lastmsg.txt \
"<prompt instructions>"
Flags explained:
--json — output JSONL event stream (structured, parseable)--skip-git-repo-check — allow running outside a git repo--ephemeral — don't persist the session (stateless, clean)-o <file> — write Codex's final text message to a fileThe prompt sent to codex exec should explicitly instruct Codex to use its image_gen.imagegen tool. Codex is smart but may default to writing code if the prompt is ambiguous.
Template:
Use the image_gen.imagegen tool to generate <description of image>.
After generation, copy the result image to <output_path>.
Key rules for the prompt:
image_gen.imagegen by name — this prevents Codex from writing Python to create the image manually/tmp/codex-output.png)codex exec --json --skip-git-repo-check --ephemeral \
-o /tmp/codex-imagegen-lastmsg.txt \
"Use the image_gen.imagegen tool to generate a photorealistic image of <description>. After generation, copy the result to /tmp/my-image.png"
Timeout: image generation typically takes 15–60 seconds. Set Bash timeout to 180000ms (3 minutes) to be safe.
After codex exec completes:
Check if the output file exists:
ls -lh /tmp/my-image.png
If the file doesn't exist at the specified path, check Codex's default output directory:
ls -lt ~/.codex/generated_images/ | head -5
Then find and copy the most recent image:
find ~/.codex/generated_images/ -name "ig_*.png" -mmin -5 -type f | sort | tail -1
Read the image to show the user:
Read: /tmp/my-image.png
If the user's environment uses a proxy (common in China), prepend proxy environment variables:
HTTP_PROXY=http://127.0.0.1:7897 \
HTTPS_PROXY=http://127.0.0.1:7897 \
ALL_PROXY=http://127.0.0.1:7897 \
codex exec --json --skip-git-repo-check --ephemeral \
"..."
Check for proxy by looking at shell environment:
echo $HTTP_PROXY $HTTPS_PROXY $ALL_PROXY
If any proxy variable is set, inherit it. If the user has a proxy wrapper function for codex (check which codex or type codex), the proxy may already be handled.
Structure the image prompt for best results:
Use the image_gen.imagegen tool to generate an image with these specifications:
Use case: <product-mockup | photorealistic-natural | illustration-story | ui-mockup | ads-marketing | logo-brand | stylized-concept | etc.>
Primary request: <what the user wants>
Style/medium: <photography | illustration | 3D render | watercolor | etc.>
Composition/framing: <wide shot | close-up | top-down | centered | etc.>
Lighting/mood: <natural light | studio | dramatic | warm golden hour | etc.>
Color palette: <any color preferences>
Constraints: <no text | no watermark | specific aspect ratio | etc.>
Avoid: <things to exclude>
After generation, copy the result to <output_path>.
Only include fields that are relevant. A simple request like "generate a cat photo" doesn't need all fields — just add enough detail to get a good result.
For images that need transparency (logos, stickers, sprites, cutouts):
First try the chroma-key approach — ask Codex to generate on a solid color background:
Use image_gen.imagegen to generate <subject> on a perfectly flat solid #00ff00
chroma-key background. The background must be one uniform color with no shadows,
gradients, texture, or lighting variation. Keep the subject fully separated
from the background with crisp edges. After generation, copy to /tmp/subject-green.png
Then remove the background locally using Codex's bundled helper:
python "${CODEX_HOME:-$HOME/.codex}/skills/.system/imagegen/scripts/remove_chroma_key.py" \
--input /tmp/subject-green.png \
--out /tmp/subject-transparent.png \
--auto-key border \
--soft-matte \
--despill
This requires Pillow. On macOS with system Python (PEP 668), use a temp venv:
python3 -m venv /tmp/pillow-env && /tmp/pillow-env/bin/pip install pillow
/tmp/pillow-env/bin/python "${CODEX_HOME:-$HOME/.codex}/skills/.system/imagegen/scripts/remove_chroma_key.py" \
--input /tmp/subject-green.png --out /tmp/subject-transparent.png \
--auto-key border --soft-matte --despill
If chroma-key removal produces poor results (hair, fur, glass, smoke), inform the user that true native transparency requires Codex's CLI fallback with gpt-image-1.5, which needs OPENAI_API_KEY set separately.
To edit an existing image, first copy it to a path Codex can access, then instruct Codex:
Use image_gen.imagegen to edit the image. The image to edit is at /tmp/source-image.png.
Edit instructions: <what to change>.
Keep everything else unchanged.
After editing, copy the result to /tmp/edited-image.png.
For Codex to "see" a local image, you may need to instruct it to use view_image first:
First use view_image to look at /tmp/source-image.png, then use image_gen.imagegen
to edit it: <edit instructions>. Copy the result to /tmp/edited-image.png.
For multiple images or variants, include all requests in a single prompt:
Generate the following images using image_gen.imagegen (one call per image):
1. A sunset landscape — save to /tmp/batch/sunset.png
2. A mountain lake — save to /tmp/batch/lake.png
3. A forest path — save to /tmp/batch/forest.png
Create the /tmp/batch/ directory first.
The codex exec --json output is a JSONL stream. Useful event types:
thread.started — session beganitem.completed with type: "command_execution" — a shell command ran (look for cp commands to find the output path)item.completed with type: "agent_message" — Codex's text responseturn.completed — includes token usageThe image_gen tool call itself is invisible in JSONL — it happens server-side. But the image file is written to ~/.codex/generated_images/<session-id>/ig_*.png and Codex will cp it if instructed.
| Symptom | Cause | Fix |
|---------|-------|-----|
| codex: command not found | Codex not installed | npm install -g @openai/codex |
| Empty agent message, no image file | Auth expired or network issue | User runs codex login |
| Codex writes Python instead of using image_gen | Prompt didn't mention the tool | Explicitly say "use image_gen.imagegen tool" |
| Image in ~/.codex/generated_images/ but not at target path | Codex didn't cp | Manually find and copy the latest image |
| Timeout | Slow network or large image | Increase Bash timeout to 300000ms |
| Proxy errors | Network blocked | Set HTTP_PROXY/HTTPS_PROXY env vars |
~/.codex/generated_images/<session-id>/ig_<hash>.png/tmp/codex-imagegen/~/.codex/ — always copy to the projectimage_gen tool call is opaque — you can't see the exact API parameters in JSONLcodex exec call is ephemeral — no conversation history between callsdevelopment
网页内容获取技巧集合。当用户需要抓取网页内容、提取文章正文、获取社交媒体帖子内容、读取任意 URL 的文本或 Markdown 格式内容时使用。 无论用户是想"获取某个网页的内容"、"抓取这个链接"、"读取这篇文章"、"把这个页面转成 Markdown",还是想访问 X/Twitter、微信、知乎、Medium 等平台的内容,都应触发此 skill。 包含多种方法,覆盖不同场景:Markdown 提取、绕过付费墙、结构化数据抓取等。持续迭代更新中。
tools
更新 Claude Code CLI 到最新版本。当用户说"更新 Claude Code"、"升级 Claude Code"、"update claude code"、"claude code 太旧了"、"执行 install.sh 更新",或者想让 Claude 自我更新时,立即使用此 skill。不要等用户明确说"用 npm"——只要涉及更新 Claude Code 本身,就使用这个 skill。
tools
Post-action workflow that triggers automatically after creating a new skill or updating an existing skill. Ask the user whether to sync the skill to the jay-skills repository and publish to remote. Use whenever a SKILL.md has just been created or modified.
tools
信息可视化呈现行为准则。当模型回复中包含对比、步骤、配置、架构等结构化信息时自动激活,确保优先使用表格、代码块、列表、树形结构等可视化格式,而不是纯文字堆砌。触发词:「用表格」「画个图」「列个表」「结构化一下」「别光用文字」「可视化」「对比一下」。即使没有触发词,只要回复中包含适合可视化的结构化信息,本 skill 的规则就应生效。也适用于:「太多字了看不下去」「能不能更直观一点」「整理成表格」等场景。