agentleFS
willink-osswillink-oss/willink-claude-kit/skills/codex-imagegen/SKILL.md

codex-imagegen

Skill0 starsChanged 4 months agoMITView on GitHub

Generate images by delegating to the Codex CLI's built-in image_gen tool, then verify the saved file deterministically (magic bytes + real dimensions) before it is used. Runs on a ChatGPT subscription — no image API key required. Triggers: 画像生成, 画像を作る, image generation, generate image, アイコン生成, バナー生成, OGP 画像, サムネイル, illustration, codex image, imagegen, ビジュアル作成

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

Files
SKILL.md

codex-imagegen — Codex CLI 経由の画像生成 + 決定論検品

実装: ${CLAUDE_PLUGIN_ROOT:-.}/scripts/codex-imagegen.sh 生成(非決定的・LLM)と 検品(決定論・スクリプト)を分離するという ADR-019「自己申告禁止」の画像版。 エージェントの「画像を作りました」を成果の根拠にしない。保存された実ファイルだけが根拠。

いつ使うか

  • アイコン / バナー / OGP 画像 / サムネイル / 記事挿絵など、ラスタ画像を新規生成したいとき
  • 参照画像を渡して同じ世界観の別カットを作りたいとき(--ref)

いつ使わないか

  • 図表・チャート・グラフ → 画像生成ではなくデータ可視化(dataviz 等)を使う。数値を LLM に描かせない
  • ロゴの確定版・ブランド資産の刷新 → 生成は可だが採用は Level 3(ブランド)。本 skill は候補出しまで
  • 既存画像のリサイズ・変換だけ → sips / ImageMagick で足りる。LLM を経由しない

前提

  • codex CLI がインストール済みで ログイン済み(codex login status)
  • 認証は ChatGPT サブスクリプションで足りる。画像 API キーは不要(= 追加課金なし)
  • 内部ツール名は image_gen__imagegen(Codex 側の組み込み。MCP や plugin の追加登録は不要)

使い方

bash "${CLAUDE_PLUGIN_ROOT:-.}/scripts/codex-imagegen.sh" \
  --prompt "濃紺の背景に、白い細線で描かれた幾何学パターン。文字は入れない。" \
  --aspect "16:9" \
  --out assets/img/banner.png

--out は呼び出し元リポジトリからの相対パス(スクリプトは CWD を変えない)。 plugin として導入した repo では CLAUDE_PLUGIN_ROOT が自動で入るので、上の行をそのまま使う。 kit を clone して直接試すときだけ CLAUDE_PLUGIN_ROOT=/path/to/willink-claude-kit を渡す。

オプション既定説明
--prompt <text>(必須)生成指示
--out <path>(必須)出力パス(.png / .jpg)
--aspect <spec>—1:1 / 16:9 / 4:5 等。実測で概ね反映されるが厳密保証はしない
--ref <file>—参照画像(繰り返し可)
--attempts <n>2検品失敗時の再試行回数
--min-bytes <n>10000空 / 切断ファイルの検知しきい値
--model <name>gpt-5.6-solCodex のモデル
--effort <level>lowreasoning effort
--timeout <sec>3001 回あたり上限(gtimeout/timeout がある時のみ強制)

Exit code: 0 = 生成 + 検品 pass / 1 = 検品 fail(試行使い切り)/ 2 = 引数誤り・codex 不在

検品が保証すること・しないこと

スクリプトが決定論的に検査するのは実ファイルのみ:

  • ファイルが存在する(codex の自己申告ではなく --out のパスを見る)
  • マジックバイトが PNG / JPEG として妥当(PNG は IHDR の存在まで)
  • 実寸が取得でき、極端に小さくない
  • バイト数が --min-bytes 以上

保証しないのは「絵の内容が意図通りか」。exit 0 は「妥当な画像ファイルである」までしか言っていない。 → 対外公開の前に必ず人間(または別エージェントの Verifier)が実ファイルを目視する。

Gotchas(実測で踏んだもの)

  • プレビューと実ファイルは別物 — 2026-07-31 に別の生成系で、プレビューは正しいのに DL したフルサイズが違うという事例があった。検品は必ず保存済みの実ファイルに対して行う(本スクリプトはそう作ってある)
  • exit 0 ≠ 正しい絵 — 「ステータスが通った」で完了報告しない。API 検証で「200 ≠ 正しい」と同じ罠
  • ブランド色を記憶で決めない — 「あの製品は青」のような記憶は外れる(実例: PULSE の色だと思っていたものが実際は fit-ai のブランド色だった)。デザインシステムの実値を引いてからプロンプトに書く
  • reasoning effort を上げても絵は良くならない — --effort low が既定。上げるとコストと時間だけ増える
  • 空配列の展開に注意(スクリプト保守者向け)— "${arr[@]:-}" は空文字を 1 個渡してしまい codex exec が usage エラーになる。[ ${#arr[@]} -gt 0 ] && CMD+=("${arr[@]}") で回避済み
  • macOS に timeout(1) は無い — gtimeout(coreutils)が無ければ上限秒は強制されず、警告だけ出る
  • 生成物は ~/.codex/generated_images/<session>/ にも残る — 秘匿性のある素材を生成した場合はそちらの残骸も意識する

承認レベル

  • 生成そのもの = Level 1(内部・可逆・非金銭)。サブスク内で完結し追加課金は発生しない
  • 対外公開 = Level 2 以上。SNS / サイト / 配布物に載せる判断は本 skill の外
  • ブランド資産の確定 = Level 3(ブランド)

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.