Gpt image
Use this skill whenever a user asks to generate, create, draw, render, or edit images with GPT Image 2 / gpt-image-2, text-to-image, reference-image editing, inpainting, posters, typography, Chinese text, UI mockups, diagrams, or gallery prompts. Analyze the user's prompt, search the bundled Reference Gallery/craft files for matching design patterns, confer on direction when useful, then call the packaged `gpt-image` CLI or bundled `scripts/generate.py`. Do not write new image-generation code unless explicitly asked to modify this repo.From its SKILL.md
npx -y skills add wuyoscar/GPT-Image2-Skill --skill gpt-imageAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
4 things to look at
- skips confirmationTells the agent to proceed without asking first, 1 time: "Skip long discussion for precise "generate now" requests".
- reads credentialsReads from 3 credential sources: `OPENAI_API_KEY` and 2 more.
- runs commandsInstructs the agent to run 4 commands, including `command -v gpt-image` and 3 more.
- fetches URLsInstructs the agent to fetch 1 URL, including git+https://github.com/wuyoscar/gpt_image_2_skill.
SKILL.md
6.5 KB, ~1.5k tokens by cl100k_base, as published. Nobody here has run it
gpt-image
Agent runbook for GPT Image 2 generation/editing. Use the prompt library + packaged CLI. Do not reimplement image API code.
Operating loop
- Classify request:
generate,edit,inpaint, ormulti-reference; identify asset type, exact text, aspect ratio, references, safety constraints, and budget/quality. - Search references first: open
references/gallery.md; load/search the closestreferences/gallery-<category>.mdfile(s). Read actual**Prompt**text before choosing a pattern. - Refine with craft: load
references/craft.mdfor dense text, diagrams, UI, data visualization, multi-panel layouts, weak prompts, or no close gallery match. - Confer when useful: before costly/ambiguous/high-polish calls, present 1–3 matched directions plus planned size/quality; ask at most one concise question. Skip long discussion for precise “generate now” requests.
- Preflight, no side effects: use existing CLI/skill if present. Check command availability (
command -v gpt-image), installed tool lists when the tool manager exists, or the runtime’s own skill registry when available. Do not assume a local home path in cloud/hosted runtimes. - No blind setup: do not reinstall, overwrite skill folders, create/modify
.env, or write API keys unless the user explicitly requested setup. Global/shared installs are opt-in only. - Execute via CLI only: call
gpt-imageorscripts/generate.py. Do not create a newgenerate.py, SDK wrapper, or ad-hoc script for normal image requests. - Report: output file path(s), key flags, and one concise refinement suggestion if useful.
Fast path: precise prompt + explicit “generate now” → quick reference/craft check, then CLI.
CLI resolution
Preferred call order:
# Existing CLI on PATH
gpt-image -p "PROMPT" [-f OUT] [-i REF...] [-m MASK] [options]
# Installed skill folder; use runtime-provided skill path when available
uv run "$SKILL_DIR/scripts/generate.py" -p "PROMPT" [-f OUT] [-i REF...] [-m MASK] [options]
# Direct transient CLI when the user requested setup/one-off CLI execution
uvx --from git+https://github.com/wuyoscar/gpt_image_2_skill gpt-image -p "PROMPT" [options]
scripts/generate.py is a launcher: repo-local src/gpt_image_cli → installed gpt-image → PATH gpt-image → transient uvx/uv fallback.
Key and cost rules
- CLI reads
OPENAI_API_KEYfrom process env, then.env, then~/.envwithout overriding existing env; successful API calls may bill the user’s OpenAI account. - If host/runtime has native platform-managed image generation and the user wants that path, use the host tool instead of this CLI.
- If
OPENAI_API_KEYis unset, report missing key or use host-native generation when requested; do not write secrets. - If user wants to avoid local-key use, respect
unset OPENAI_API_KEY; if a key exists in.env/~/.env, tell them to remove/rename it for the session rather than working around it. - Never print secret values.
Flags
| Flag | Values | Use |
|---|---|---|
-p, --prompt | string | Required prompt/edit instruction |
-f, --file | path | Output path; auto-named if omitted |
-i, --image | repeatable path | Use edits endpoint; supports multiple references |
-m, --mask | PNG path | Inpaint with alpha mask; requires -i |
--model | default gpt-image-2 | Image model |
--size | 1k, 2k, 4k, portrait, landscape, square, wide, tall, or literal | Canvas size |
--quality | low, medium, high, auto | Cost/quality dial |
-n, --n | integer | Number of images |
--background | auto, opaque | Generation background |
--moderation | auto, low | Generation moderation setting |
--format | png, jpeg, webp | Output encoding |
--compression | 0-100 | JPEG/WebP compression |
--user | string | Optional end-user identifier |
Quality policy:
low: cheap drafts, broad exploration, many variants.medium: normal exploration, style probing, balanced cost.high: final assets, Chinese text, posters, diagrams, UI, paper figures, dense labels.
Size policy:
- default/social square:
1k/1024x1024 - poster/mobile/beauty:
portrait - landscape/gameplay/photo:
landscape - print/paper figure:
2k - widescreen hero:
4k - vertical story/banner:
tall
Endpoint routing
| Mode | Trigger | Endpoint |
|---|---|---|
| Text-to-image | no -i | /v1/images/generations |
| Reference edit | one or more -i | /v1/images/edits |
| Inpaint | -i + -m | /v1/images/edits with mask |
Surface API errors verbatim enough for debugging; exit codes: 0 success, 1 API/refusal, 2 bad args/missing key.
Reference loading
references/gallery.md: routing index for the 162-prompt Reference Gallery Atlas. Load first.references/gallery-*.md: concrete prompts, previews, paths, metadata, attribution. Load 1 category for normal requests; 2–3 for hybrids.references/craft.md: prompt-craft checklist. Load for prompt repair, exact text, UI/data/diagram grammar, edit invariants, and multi-panel consistency.references/openai-cookbook.md: official parameter/model semantics. Load for API behavior or model capability questions.
Reference loading policy: load the smallest useful slice; never load all category files by default.
Verification
- Before API call: confirm endpoint mode, size, quality, output path, and required reference/mask files.
- After CLI call: report path(s) printed by the CLI and surface stderr on failure.
- For edits/inpaints: verify
-ipaths exist; verify-mexists when used.
Preserve Curated vs Author + Source metadata when adapting examples. Add new collected prompts to the Reference Gallery before README promotion.
What ships with it: 36 files
267.0 KB alongside SKILL.md, 1 of them executable
agents/
- openai.yaml382 B
references/
- craft.md19.4 KB
- gallery-anime-and-manga.md15.2 KB
- gallery-architecture-and-interior.md6.5 KB
- gallery-beauty-and-lifestyle.md2.4 KB
- gallery-brand-systems-and-identity.md3.3 KB
- gallery-character-design.md1.9 KB
- gallery-cinematic-and-animation.md5.9 KB
- gallery-cinematic-film-references.md7.4 KB
- gallery-data-visualization.md6.4 KB
- gallery-edit-endpoint-showcase.md2.2 KB
- gallery-events-and-experience.md2.5 KB
- gallery-fashion-editorial.md8.7 KB
- gallery-fine-art-painting.md5.9 KB
- gallery-gaming.md8.5 KB
- gallery-illustration.md2.3 KB
- gallery-infographics-and-field-guides.md10.9 KB
- gallery-ink-and-chinese.md2.5 KB
- gallery-isometric.md2.4 KB
- gallery.md4.6 KB
- gallery-more-illustration-styles.md6.6 KB
- gallery-official-openai-cookbook-examples.md3.8 KB
- gallery-photography.md3.6 KB
- gallery-pixel-art.md1.8 KB
- gallery-product-and-food.md5.2 KB
- gallery-research-paper-figures.md28.2 KB
- gallery-retro-and-cyberpunk.md4.8 KB
- gallery-scientific-and-educational.md8.6 KB
- gallery-screen-photography.md3.2 KB
- gallery-tattoo-design.md4.3 KB
- gallery-technical-illustration.md6.4 KB
- gallery-typography-and-posters.md14.4 KB
- gallery-ui-ux-mockups.md6.3 KB
- gallery-watercolor.md2.3 KB
- openai-cookbook.md45.7 KB
scripts/
- generate.pyruns2.5 KB
Gives 0 of the 12 instructions most context ai engineering skills give in ~1.5k tokens
Counted across 1,328 of the 2,349 authors here whose files we hold, read 2026-09-06
- Dispatch a fresh subagent for each taskin 76 of 1328, across 59 files
- Perform spec compliance review before code quality reviewin 44 of 1328, across 34 files
- Dispatch a final code reviewer after all tasksin 38 of 1328, across 26 files
- Answer subagent questions before allowing implementationin 36 of 1328, across 26 files
- Use the least powerful model capable of the taskin 33 of 1328, across 26 files
- Create a TodoWrite list for all tasksin 32 of 1328, across 22 files
- Perform a task review after each implementationin 31 of 1328, across 24 files
- Extract all tasks and context from the planin 29 of 1328, across 20 files
- Provide full task text to subagentsin 28 of 1328, across 20 files
- Use git worktrees for isolated workspacesin 25 of 1328, across 20 files
- Specify the model explicitly when dispatching a subagentin 23 of 1328, across 18 files
- Execute all tasks from the plan without stoppingin 21 of 1328, across 16 files
Said here and by no other author read
- Classify the request as generate, edit, inpaint, or multi-reference
- Search the reference gallery before choosing a prompt pattern
- Load craft references for complex tasks like UI or diagrams
- Confer with the user before costly or ambiguous calls
- Execute image generation using the provided CLI tools
- Verify existence of reference and mask files before calling
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.