# Image 2.0 Prompt Recipes — the core craft of this skill

The deliverable is ONE raster image generated by Image 2.0 (GPT Image 2), containing
background, panels, characters, decorations AND every Japanese string. Quality is
decided almost entirely by how the prompt is built. Follow this file literally.

## The prompt skeleton (always these 6 blocks, in this order)

Write the scaffolding in English (layout instructions are followed more reliably);
quote all visible Japanese verbatim.

```text
[STYLE]
Warm, friendly Japanese educational infographic poster. Cream washi-paper background
(#FAF1DC) with subtle paper grain. Rounded pastel panels with soft colored borders
(mint green, sky blue, lavender, peach pink, apricot orange, butter yellow), soft
drop shadows, large corner radii. Bold rounded Japanese gothic lettering (like
M PLUS Rounded 1c), dark warm brown ink (#4A3B28), key words accented in red/blue/
orange. Cute flat mascots drawn with warm brown outlines: {CAST_A} and
{CAST_B}, plus a small chick, potted plants, tulips, sprouts, 4-point sparkles,
hearts, hand-drawn squiggle lines. Flat 2D illustration, kawaii but business-usable,
like a polished 図解 poster. High visual density: every region holds content.

[CANVAS]
Landscape 3:2. Title band on top, content below, one strong conclusion element.
Comfortable outer margin; nothing touches the edges; no text is ever cut off.

[COMPOSITION]
<one grammar paragraph from §Grammar paragraphs below, with your section list>

[TEXT — render EXACTLY these strings, nothing else]
<the text manifest, grouped per panel — see §Text manifest>

[RULES]
- Render every listed string exactly, character for character. Do not paraphrase,
  translate, romanize, or invent any additional text.
- All text large and readable: body text roughly 1.2–1.4% of image width tall.
- Text always inside its panel with padding; characters never overlap text.
- Fill the canvas: no large empty areas; if a panel looks bare, enlarge its text
  and icons rather than leaving blank space.

[NEGATIVE]
No photorealism, no 3D render, no neon or cyber style, no gradients-only poster,
no English filler text, no lorem ipsum, no watermarks, no signature, no extra
captions beyond the listed strings, no tiny unreadable print.
```

## Text manifest — the exact-copy contract

Number every string and group by panel. Example shape:

```text
TITLE: 「朝の集中力を上げる方法」 (biggest, brown with red accent on 集中力)
SUBTITLE: 「気合いに頼らず、入り方を整える」
P1 heading: 「1. 最初に整える3点」
P1 items: 「場所」「体」「通知」 with one short line each:
  「机の上を空にする」「光を浴びて水を飲む」「スマホを視界の外へ」
P2 heading: ...
FOOTER message: 「集中は気合いではなく、入り方で決まる。」 (largest after title)
```

Copy budget (garble risk grows with string count — stay inside):

| density | sections | distinct strings | per-string length |
|---|---|---|---|
| high | 10–12 | ≤ 70 | headings ≤12字 / items ≤14字 |
| medium | 6–9 | ≤ 50 | items ≤16字 / 説明1行 ≤22字 |
| low (expanded) | 5–7 | ≤ 35 | 大きめ文字・短文中心 |

Rules of thumb:
- Prefer FEWER, LARGER strings over many small ones (small text garbles first).
- Numbers/percentages are reliable; long katakana runs and rare kanji garble first —
  simplify wording before generating (e.g. 「憂鬱」→「気が重い」).
- If the content needs more strings than the budget, cut copy, don't shrink text.

## Grammar paragraphs (pick ONE per piece — rotate between pieces)

Copy the matching paragraph into [COMPOSITION] and fill in your sections.

**numbered-card mosaic (high density, reference-like)**
"Grid of 12 rounded pastel cards in 3 rows x 4 columns under the title band. Each
card has a small colored circle with a white number, a bold heading, and 2–4 short
items or a mini table/flow/donut chart; each card ends with a small dashed callout
strip. The last card is a big-message card with the shiba mascot cheering. Cards
use different pastel border colors; adjacent cards never share a color."

**medium mosaic + wide banner (6–9 sections)**
"Two rows of rounded pastel cards with varied widths (some wide, some narrow),
then a full-width conclusion banner at the bottom containing the key message in
very large lettering, a colored ribbon with a sub-message, and the {CAST_A} + {CAST_B}
mascots at both ends."

**hero steps poster (low info)**
"A large hero panel on the left 60% with 3 big horizontal step bands — each band:
a large pastel circle icon, a big bold step title, one short line, and a small tip
chip. Right column: 2 stacked support panels (reasons / don'ts). Bottom: a boxless
strip with one huge hand-lettered message and large mascots."

**boxless zones + journey (medium, no card boxes)**
"No card boxes. Left 55%: a pale yellow wash zone with a dashed journey path
connecting 3 large numbered circle stations top to bottom, each station with a big
title, one line, and small example chips; a mascot with a speech bubble beside each
station. Right 45%: two color-wash zones (pale pink, pale teal) with tab-ribbon
headings. Bottom: boxless conclusion strip with a huge message."

> **{CAST_A} / {CAST_B} は毎回ロールで差し替えること。** ここに動物名を直書きすると
> ロスターがあってもキャストが固定され、「毎回いろんなキャラを出す」という指示が
> 死ぬ（2026-08-26発見）。ロールは style-guide.md の Casting rule を参照。

**dialog (FAQ/beginner topics)**
"A vertical conversation: {CAST_A} asks short questions in left-pointing speech
bubbles, {CAST_B} answers in right-pointing bubbles with slightly longer text;
4–6 exchanges, each pair separated by a thin dotted divider; a summary ribbon at
the bottom with the key takeaway."

**hub / center-radial (concept breakdown)**
"One large rounded badge in the center with the core concept, connected by short
dashed spokes to 5–6 satellite mini-panels arranged around it, each satellite with
an icon circle, a bold label and one short line; corners hold mascots and plants."

**magazine / big-number (few strong claims)**
"Editorial layout with a left-aligned title block and a thick vertical color bar;
2–3 oversized keywords or numbers (very large lettering) each with a small
supporting note; generous but structured composition, mascots interacting with the
numbers; one bottom ribbon conclusion."

## Generation

- Size: landscape (3:2). Use the largest available landscape option.
- Save the completed prompt as UTF-8 first. The saved file, not a shell variable,
  is the source of truth.
- Run the mandatory preflight and emit an ASCII-safe JSON payload.
  Windows PowerShell:

```powershell
py -3 "$env:USERPROFILE\.codex\skills\friendly-infographic-style\scripts\build.py" `
  prompt <name>.prompt.txt --json --meta <name>.prompt.meta.json
```

  macOS / Linux:

```bash
python3 "$HOME/.codex/skills/friendly-infographic-style/scripts/build.py" \
  prompt <name>.prompt.txt --json --meta <name>.prompt.meta.json
```

- Codex / ChatGPT: parse that JSON and call built-in `image_gen` with the exact
  `prompt` value. When orchestration runs through a shell tool, use this pattern
  rather than `Get-Content` or a Unicode PowerShell pipeline:

```javascript
// Choose exactly one command for the current OS.
const command = 'py -3 "$env:USERPROFILE/.codex/skills/friendly-infographic-style/scripts/build.py" ' +
                "prompt '<name>.prompt.txt' --json --meta '<name>.prompt.meta.json'"; // Windows
// macOS/Linux equivalent:
// const command = 'python3 "$HOME/.codex/skills/friendly-infographic-style/scripts/build.py" ' +
//                 "prompt '<name>.prompt.txt' --json --meta '<name>.prompt.meta.json'";
const checked = await tools.shell_command({
  command
});
const marker = "Output:\n";
const body = String(checked).slice(String(checked).indexOf(marker) + marker.length).trim();
const payload = JSON.parse(body); // JSON output is ASCII-only; Unicode is restored here.
if (payload.verdict !== "PASS") throw new Error(payload.problems.join("; "));
const result = await tools.image_gen__imagegen({prompt: payload.prompt});
generatedImage(result);
```

- On Windows PowerShell 5.1, `Get-Content` without `-Encoding UTF8`, ordinary
  Unicode pipelines, and `$OutputEncoding` can corrupt Japanese before it reaches
  the model. Do not use those paths for prompt transport. A human-readable check
  may use `Get-Content -Raw -Encoding UTF8`, but generation still uses the JSON
  payload above.
- From Claude Code (no Image 2.0 available), use the raw-byte delegate.
  Windows PowerShell:

```powershell
py -3 "$env:USERPROFILE\.codex\skills\friendly-infographic-style\scripts\delegate_imagegen.py" `
  <name>.prompt.txt <name>.png --workdir <workdir>
```

  macOS / Linux:

```bash
python3 "$HOME/.codex/skills/friendly-infographic-style/scripts/delegate_imagegen.py" \
  <name>.prompt.txt <name>.png --workdir <workdir>
```

## Verify → regenerate loop (max 3 targeted retries, then report honestly)

1. Run `build.py tiles out.png <tiles-dir>` with the OS-specific Python command
   shown above → read every tile and compare each visible string against the
   manifest character by character.
2. Run `build.py audit out.png` with the same interpreter → density tripwire
   (same thresholds as the reference calibration).
3. Full-image look: taste, characters, variety, no clipped panels.

| symptom | prompt fix on retry |
|---|---|
| garbled/wrong kanji in small items | cut string count, shorten wording, "make item text larger" |
| whole image is mojibake (`縺`/`繧`/`???`) | transport failure: do not change copy; rerun prompt preflight and use its JSON payload |
| text clipped at panel edge | "all text fully inside panels with generous padding"; shorten that string |
| sparse / empty regions | strengthen density line; add items to that panel's manifest; name the empty region explicitly |
| characters covering text | "mascots sit in corners and margins only, never on top of text" |
| style drift (3D, neon, photoreal) | move [STYLE] block to the very top, restate negatives |
| wrong layout | restate the grammar paragraph with explicit row/column counts |

A change of ONE variable per retry. If text still fails after 3 retries: deliver the
best attempt + list the failed strings + offer (a) simplified copy or (b) the
legacy-html fallback — the user must explicitly approve (b).

## Worked example (copy, adapt, run)

Topic: 朝の集中力を上げる方法 (medium, mosaic+banner grammar) — full prompt:

```text
[STYLE] Warm, friendly Japanese educational infographic poster. Cream washi-paper
background with subtle grain. Rounded pastel panels with soft colored borders (mint,
sky blue, lavender, peach, apricot, butter yellow), soft shadows. Bold rounded
Japanese gothic lettering in dark warm brown, accents in red/blue/orange. Cute flat
mascots with warm brown outlines: {CAST_A}, {CAST_B}, small chick, potted
plant, tulip, sparkles, hearts, hand-drawn squiggles. Flat 2D, kawaii but
business-usable, high visual density.
[CANVAS] Landscape 3:2, title band on top, comfortable margins, no cut-off text.
[COMPOSITION] Two rows of rounded pastel cards with varied widths: row 1 has three
cards (最初に整える3点 / 集中モードの入り方 / 時間帯の使い分け), row 2 has three cards
(やりがちなNG / 土台になる習慣 / 集中時間の配分), then a full-width bottom banner with
the key message and the {CAST_A} + {CAST_B} mascots at both ends.
[TEXT — render EXACTLY these strings, nothing else]
TITLE:「朝の集中力を上げる方法」(集中力 in blue)
SUBTITLE:「気合いに頼らず、入り方を整える」
C1:「1. 最初に整える3点」items:「場所 机を空にする」「体 光と水」「通知 スマホは別室」
C2:「2. 集中モードの入り方」items:「朝いち 大事な1つから」「2分だけ始める」「25分→5分で区切る」
C3:「3. 時間帯の使い分け」items:「午前 考える仕事」「昼すぎ 単純作業」「夕方 見直し」
C4:「4. やりがちなNG」items:「✕ 通知を全部見る」「✕ メールから始める」「✕ ながら作業」
C5:「5. 土台になる習慣」items:「睡眠7時間」「朝の光」「軽い運動」
C6:「6. 集中時間の配分」donut labels:「深い集中50%」「軽い作業25%」「休憩15%」「余白10%」
BANNER:「集中は気合いではなく、入り方で決まる。」 ribbon:「片づけて、遮断して、2分だけ始める」
[RULES] Render every listed string exactly... (standard block)
[NEGATIVE] (standard block)
```
