agentleFS
VallykrieVallykrie/swarmGPT/skills/codex-imagegen/SKILL.md

codex-imagegen

Skill2 starsChanged 3 months agoMITView on GitHub

Use when the user asks to generate, create, draw, edit, or restyle an image, or when a task needs image assets — logos, icons, illustrations, hero images, textures, photos, placeholder art, social/OG cards. Most coding agents cannot produce raster images; a Codex session via the `codex` CLI has a built-in imagegen tool that can. Trigger words include "generate an image", "make a picture/logo/icon", "draw", "image asset", or /codex-imagegen.

  • Reads credentials
  • Installs packages

16 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use orchestrate and 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.
  • varun29ankuSSkill

    orchestrate

    This skill should be used when the user asks to 'orchestrate a task', 'break down work into parallel agents', 'coordinate subtasks', 'run agents in parallel', or mentions 'multi-agent'. Decomposes complex tasks into tracked subtasks, dispatches parallel subagents, and coordinates until completion.

    Also in 3 projects that use this

  • Hugging FaceSkill

    implement

    Make tests pass. Invoke after /write-tests produces failing tests.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 14 edited versions we read keep these.

  • 2

    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
  1. Distinctive:

    Treat a user-specified path and format as immutable.

    line 34
  2. Very specific:

    Write one prompt file per image with the light tier header, then dispatch them together (a single image is a batch of one):

    line 55
  3. Very specific:

    Every prompt must end with: "Save it to <absolute path>, then print a line starting with TOUCHED: listing the file."

    line 69
  4. Very specific:

    Use the light tier; the image model does the heavy lifting, not the reasoning model.

    line 79
  5. Distinctive:

    If it is wrong, add one targeted variant to the manifest with a corrected prompt and its own path, dispatch that one job, and inspect again.

    line 92
  6. Very specific:

    If codex is missing, unauthenticated, or the job returns no file, stop.

    line 99

“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.

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

codex-imagegen

You cannot produce raster images. codex exec sessions can: the Codex CLI exposes a built-in image_gen.imagegen tool that generates and edits images using the user's existing ChatGPT authentication. No API key is required and no OPENAI_API_KEY is used — this runs on the plan the user already signed into with codex login.

Your job: turn the request into a precise image prompt, dispatch it, verify the file that comes back, and deliver it.

Step 0 — Preflight

  1. command -v codex — if missing, stop and tell the user to install the Codex CLI (npm install -g @openai/codex) and run codex login.
  2. Locate dispatch.sh as in codex-swarm Step 0 and use it for every job, including a single image — it resolves the current model for you.

Step 1 — Build the manifest

For each requested image, record as separate fields:

  • purpose — what it is for (icon, hero, texture, OG card…)
  • prompt — the detailed description you will send
  • new or edit — edits need exact input paths
  • destination — an absolute output path
  • format — png, jpg, webp

Treat a user-specified path and format as immutable. Do not rename the file, change its extension, or pick a different directory without asking. If the user gave no path, choose a sensible project location (assets/, public/, docs/images/) and say which one you picked. If the exact path already exists and replacement was not requested, ask before overwriting.

Step 2 — Write the image prompt

Codex generates what you describe, so describe it fully. Cover: subject, composition and framing, style (flat vector, 3D render, photo, watercolor…), palette, lighting, background (state explicitly if it must be transparent), aspect ratio, and any text that must appear verbatim. Name what must not be there too — stray text, watermarks, borders.

For an edit, pass the exact absolute path of every input file and state what must stay unchanged.

Step 3 — Dispatch

One job per image. Images are independent, so a batch goes out in parallel.

Write one prompt file per image with the light tier header, then dispatch them together (a single image is a batch of one):

MODEL: light

Generate an image: <full prompt>. Save it to <ABS PATH>, then print a line
starting with TOUCHED: listing the file.
bash "$DISPATCH" --auto --timeout 20m 01-icon-light.prompt.md 02-icon-dark.prompt.md

Every prompt must end with: "Save it to <absolute path>, then print a line starting with TOUCHED: listing the file."

Rules:

  • The sandbox must be workspace-write (--auto), and the destination must be inside the project — a read-only sandbox cannot save the file.
  • One generation call per asset or variant. A retry is a new variant with its own path, never a second write to the same path.
  • Two parallel jobs must never target the same output path.
  • Use the light tier; the image model does the heavy lifting, not the reasoning model. The dispatcher resolves it to the current Codex model.
  • Image generation takes ~40–90 seconds per asset. Allow at least 5 minutes per job and tell the user it is running.

Step 4 — Verify before you deliver

  1. Confirm the file exists at the exact manifest path and is non-trivial in size (ls -l; a few hundred bytes means it failed).
  2. View it with your image-reading tool. Check it against the requested subject, composition, text, and — for edits — that the invariants held.
  3. Validate the real format from file contents, not the extension (file <path>).
  4. If it is wrong, add one targeted variant to the manifest with a corrected prompt and its own path, dispatch that one job, and inspect again.

Report every final path, the validated format, and what you verified.

Blocking

If codex is missing, unauthenticated, or the job returns no file, stop. State which assets are incomplete and why. Do not describe an image you did not generate, do not claim a file exists without checking, and never ask the user to paste a secret into chat.

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.