Imagine — image-tool doctrine
Apply this whenever an image is about to be generated or edited.
Build accurate visuals with code, not image models
Image models are unreliable at exact text, numbers, and structure. They garble
words, invent numbers, draw chart bars that match no data, and point diagram
arrows nowhere — and the more that must be exact, the worse they do. A detailed
prompt doesn't fix it, and an edit pass usually won't either.
When the result needs specific text, data, or structure to be CORRECT, construct
it with a code-driven tool where the content is exact:
| Need |
Tool |
| Chart/plot from real numbers |
data.chart |
| Org chart, mind map, tree, hierarchy |
media.diagram |
| Flowchart, sequence, state diagram |
media.mermaid |
| Math/equations |
media.equation |
| Code screenshot |
media.code-image |
| Rich layout, tables, real copy, UI mockup |
build HTML/CSS → browser.screenshot (or document.pdf-from-html) |
HTML/CSS gives far better layout, typography, and polish than image models or
Python plotting. Reserve the image models for when only the LOOK matters:
photos, illustrations, characters, scenes, decorative art. Choose by what the
output must get right, not by how the request is worded.
Choosing the generation tool
media.grok-image — FREE on the owner's Grok web lane; prefer it when
available (owner-only, needs SUDO_GROK_WEBSESSION).
media.image-generate — metered API providers (DALL-E 3, Stable Diffusion,
Flux) when the free lane is unavailable or unsuitable.
media.image-edit-advanced — operate on an EXISTING image: remove
background, upscale, inpaint, resize/crop/rotate/watermark/convert.
Verify discrete accuracy (loop)
When the output must get text, numbers, or structure right, never trust the
first result:
- Produce it (generate, or build with code per the table above).
- Read the actual output back with vision and check every word, number, label,
and structural detail; check nothing overlaps, clips, or runs off-canvas.
- If wrong: garbled text or invented numbers from an image model → do NOT
re-prompt (it will garble again) — rebuild with code. Overlap/clipping in a
code-built asset → fix the layout (auto-layout beats nudging coordinates).
Otherwise make one targeted edit.
- Finish only when the discrete content is exactly right. If it can't be made
accurate, say so instead of shipping something wrong.
Core rules
- Own the prompt. If the user supplies a detailed prompt, use it verbatim.
Otherwise craft it: front-load the subject; give strong high-level direction
for mood, composition, lighting, style; natural prose, not keyword tags;
describe positively (no negative prompts). For edits, describe only what
changes. Target 2–5 sentences.
- Reference-first for real people. Never generate a named real person or
group from scratch — including face swaps, posters, cartoons, cinematic or
editorial depictions. Start from a real reference photo and use
media.image-edit-advanced (inpaint) on it. Never produce non-consensual,
sexualized, or minor-involving likenesses.
- Ground facts with search first. If the request depends on a real-world
fact, identity, brand, place, event, or "latest/current" anything, run a web
search first and put the VERIFIED details into the prompt. No placeholders
like "the current president" — write the verified name.
- Reuse a base image for consistency. When the same character, object, or
setting must appear across multiple images, generate one base image, then
derive every variation from it with
media.image-edit-advanced. Don't
regenerate a recurring subject from scratch.
- Handle blocks gracefully. On a moderation/safety block: stop. Don't
retry, don't paraphrase to evade the filter. Tell the user and offer a
different direction.
- Plan multi-step workflows. Sequence dependent steps; parallelize only
generations within the same step. Review at the end that every intended
image actually got produced and matches the ask.
1---2name: imagine3version: 1.0.04description: Image-generation doctrine for the media.* tools — when to build a visual with code instead of an image model, prompt-craft, reference-first handling of real people, factual grounding, verify-by-reading-back, and cross-image consistency. Ported and adapted from grok's imagine skill.5author: matrixx00706tags: [images, media, image-generation, image-editing, visual-qa]7triggers:8 - generate an image9 - generate images10 - create an image11 - make an image12 - make me an image13 - generate a picture14 - create a picture15 - image of16 - picture of17 - edit this image18 - edit the image19 - image edit20 - draw me21 - illustration of22 - poster for23 - album cover24 - logo for25 - generate art26---2728# Imagine — image-tool doctrine2930Apply this whenever an image is about to be generated or edited.3132## Build accurate visuals with code, not image models3334Image models are unreliable at exact text, numbers, and structure. They garble35words, invent numbers, draw chart bars that match no data, and point diagram36arrows nowhere — and the more that must be exact, the worse they do. A detailed37prompt doesn't fix it, and an edit pass usually won't either.3839When the result needs specific text, data, or structure to be CORRECT, construct40it with a code-driven tool where the content is exact:4142| Need | Tool |43|------|------|44| Chart/plot from real numbers | `data.chart` |45| Org chart, mind map, tree, hierarchy | `media.diagram` |46| Flowchart, sequence, state diagram | `media.mermaid` |47| Math/equations | `media.equation` |48| Code screenshot | `media.code-image` |49| Rich layout, tables, real copy, UI mockup | build HTML/CSS → `browser.screenshot` (or `document.pdf-from-html`) |5051HTML/CSS gives far better layout, typography, and polish than image models or52Python plotting. Reserve the image models for when only the LOOK matters:53photos, illustrations, characters, scenes, decorative art. Choose by what the54output must get right, not by how the request is worded.5556## Choosing the generation tool5758- `media.grok-image` — FREE on the owner's Grok web lane; prefer it when59 available (owner-only, needs SUDO_GROK_WEBSESSION).60- `media.image-generate` — metered API providers (DALL-E 3, Stable Diffusion,61 Flux) when the free lane is unavailable or unsuitable.62- `media.image-edit-advanced` — operate on an EXISTING image: remove63 background, upscale, inpaint, resize/crop/rotate/watermark/convert.6465## Verify discrete accuracy (loop)6667When the output must get text, numbers, or structure right, never trust the68first result:69701. Produce it (generate, or build with code per the table above).712. Read the actual output back with vision and check every word, number, label,72 and structural detail; check nothing overlaps, clips, or runs off-canvas.733. If wrong: garbled text or invented numbers from an image model → do NOT74 re-prompt (it will garble again) — rebuild with code. Overlap/clipping in a75 code-built asset → fix the layout (auto-layout beats nudging coordinates).76 Otherwise make one targeted edit.774. Finish only when the discrete content is exactly right. If it can't be made78 accurate, say so instead of shipping something wrong.7980## Core rules81821. **Own the prompt.** If the user supplies a detailed prompt, use it verbatim.83 Otherwise craft it: front-load the subject; give strong high-level direction84 for mood, composition, lighting, style; natural prose, not keyword tags;85 describe positively (no negative prompts). For edits, describe only what86 changes. Target 2–5 sentences.872. **Reference-first for real people.** Never generate a named real person or88 group from scratch — including face swaps, posters, cartoons, cinematic or89 editorial depictions. Start from a real reference photo and use90 `media.image-edit-advanced` (inpaint) on it. Never produce non-consensual,91 sexualized, or minor-involving likenesses.923. **Ground facts with search first.** If the request depends on a real-world93 fact, identity, brand, place, event, or "latest/current" anything, run a web94 search first and put the VERIFIED details into the prompt. No placeholders95 like "the current president" — write the verified name.964. **Reuse a base image for consistency.** When the same character, object, or97 setting must appear across multiple images, generate one base image, then98 derive every variation from it with `media.image-edit-advanced`. Don't99 regenerate a recurring subject from scratch.1005. **Handle blocks gracefully.** On a moderation/safety block: stop. Don't101 retry, don't paraphrase to evade the filter. Tell the user and offer a102 different direction.1036. **Plan multi-step workflows.** Sequence dependent steps; parallelize only104 generations within the same step. Review at the end that every intended105 image actually got produced and matches the ask.