agentleFS
the-gigithe-gigi/learn-claude-code/skills/generate-image/SKILL.md

generate-image

Skill1 starsChanged 6 months agoMITView on GitHub

Generate images using OpenAI's gpt-image-2 model, or the codex CLI's built-in image_gen when no OpenAI API key is set

  • Reads credentials

37 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use edit-image, scientific-slides and 6 more.

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.
  • SamurAIGPTSkill

    edit-image

    Edits an existing image using natural language instructions via MuAPI. Use when the user wants to modify, change, transform, or retouch an existing image.

    Also in 3 projects that use this

  • ZanderRussSkill

    scientific-slides

    Build slide decks and presentations for research talks. Use this for making PowerPoint slides, conference presentations, seminar talks, research presentations, thesis defense slides, or any scientific talk. Provides slide structure, design templates, timing guidance, and visual validation. Works with PowerPoint and LaTeX Beamer.

    Also in 3 projects that use this

  • nicepkgSkill

    team

    根据任务快速组建临时 AI Agent 团队协作。自动从 .claude/agents/ 中选择最合适的成员组队。

    Also in 3 projects that use this

  • AnthropicSkill

    pptx

    Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions \"deck,\" \"slides,\" \"presentation,\" or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.

    Also in 5 projects that use this

  • AnthropicSkill

    pdf

    Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.

    Also in 4 projects that use this

  • SentrySkill

    skill-creator

    Create new agent skills following the Agent Skills specification. Use when asked to "create a skill", "add a new skill", "write a skill", "make a skill", "build a skill", or scaffold a new skill with SKILL.md. Guides through requirements, writing, registration, and verification.

    Also in 5 projects that use this

  • +1 more from anthropics

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 31 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Create images from text prompts using the scripts/generate-image.py script.

    line 8
  2. Very specific:

    Use .png for images needing transparency (icons, logos)

    line 22
  3. Very specific:

    Use .jpg for photos

    line 23
  4. Very specific:

    Use .webp for smaller file size

    line 24
  5. Very specific:

    Read-only is enough — image_gen writes into $CODEX_HOME itself, not through the shell.

    line 53
  6. Distinctive:

    If neither is available the script exits 1 and says so.

    line 69

“Common” is measured: kept by at least 6 in 10 of the 31 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Generate Image

Create images from text prompts using the scripts/generate-image.py script.

Usage

./scripts/generate-image.py "prompt" [output_file]
./scripts/generate-image.py --backend codex "prompt" [output_file]
./scripts/generate-image.py -i photo1.png -i photo2.jpg "prompt" [output_file]

Parameters

  • prompt (required): Description of the image to generate
  • output_file (optional): Output path. Defaults to image.png
    • Use .png for images needing transparency (icons, logos)
    • Use .jpg for photos
    • Use .webp for smaller file size
  • -i / --image (optional, repeatable): a reference image to base the result on, e.g. profile photos to turn into illustrated characters. The codex backend passes each one to codex exec -i and sends the prompt on stdin, because -i takes several values and would swallow a positional prompt as one more image path. The API backend switches to the images/edits endpoint and uploads them as multipart image[] fields.
  • --backend (optional): auto (default), api, or codex

When to use

  • User asks for an image, icon, logo, illustration
  • Visual content would help explain something
  • User explicitly requests image generation

Backends

The script picks a backend automatically, preferring codex:

BackendSelected whenNotes
codexDefault, whenever codex is on PATHRuns codex exec and lets codex's built-in image_gen tool do the work. Codex uses its own credentials, so it keeps working when the OpenAI account has no credits. Takes ~30s because it's a full agent turn.
apiFallback, when codex isn't installedDirect call to the OpenAI Images API with gpt-image-2. Honors .png/.jpg/.webp natively. Takes a few seconds, but returns a 429 once the account is out of credits.

Codex is primary because the OpenAI key hit You have no credits remaining mid-task, which turned one image into two runs. Codex bills through its own auth and didn't care.

Force either one with --backend api / --backend codex.

How the codex fallback works

  1. Snapshots $CODEX_HOME/generated_images (default ~/.codex).
  2. Runs codex exec --sandbox read-only with a prompt that pins codex to its built-in image_gen tool and forbids the OPENAI_API_KEY-dependent CLI fallback described in $CODEX_HOME/skills/.system/imagegen/SKILL.md. Read-only is enough — image_gen writes into $CODEX_HOME itself, not through the shell.
  3. Diffs the snapshot and copies the newest new file to output_file. The filesystem diff is the source of truth, not the path codex prints.
  4. image_gen always returns PNG, so a .jpg destination is re-encoded with sips and .webp with cwebp. If cwebp isn't installed the PNG bytes are copied as-is and the script warns.

Requirements

Either:

  • OPENAI_API_KEY (or OPENAI_API_KEY_IG) set — uses the API directly, or
  • the codex CLI on PATH, authenticated, with the image_generation feature enabled (codex features list | grep image_generation → stable true).

If neither is available the script exits 1 and says so. Runs on Python 3.9+ (macOS system Python included).

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.