agentleFS
howardpen9howardpen9/grok-imagine-skill/skills/imagine/SKILL.md

imagine

Skill2 starsChanged 4 months agoMITView on GitHub

How to use the image_gen and image_edit tool calls in Grok Build: when to build a visual with code instead of generating it, prompt-craft, reference-first handling of real people, factual grounding, and asset-consistency. Load this whenever generating or editing an image is on the table, i.e. when an image_gen or image_edit call is being considered or about to be made. Tool-usage-driven, not triggered by a user merely mentioning images.

1 other project uses a version of this, 1 of them edited.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 1

    1. NighmareGit/skunkworks-toolbox★ 193% same

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 12 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When the output must get specific text, numbers, data, or structure right, don't trust the first result - verify it in a loop:

    line 30
  2. Distinctive:

    If anything is wrong, fix and re-verify:

    line 34
  3. Distinctive:

    Only finish when the discrete content is exactly correct.

    line 38
  4. Very specific:

    Anchor recurring subjects to a reference: When a character, object, setting, or look recurs across images or shots, generate one canonical …

    line 45
  5. Distinctive:

    Don't assume tool behavior: Don't invent tool parameters, return values, or environment capabilities that aren't actually provided.

    line 49
  6. Distinctive:

    Use for generic or invented subjects, or to create a base image you'll edit later.

    line 72
  7. Distinctive:

    Use to restyle, recolor, add or remove elements, preserve likeness, transfer style, remix, or iterate on a generated result.

    line 86
  8. Distinctive:

    Use one coherent scene per prompt.

    line 96
  9. Distinctive:

    Search the web first to confirm identity, role, relationship, or event, even when it seems obvious.

    line 101
  10. Very specific:

    Use a single strong reference with image_edit.

    line 102
  11. Distinctive:

    If no suitable reference exists, ask the user to upload one rather than generating from a weak base.

    line 103
  12. Distinctive:

    Favor frequent, short shots: - prefer more 6s shots over fewer long ones.

    line 121
  13. Very specific:

    Use reference_to_video only if the user asks for it or a shot genuinely needs multiple references - and even then, prefer composing those …

    line 125
  14. Distinctive:

    Minimal but interesting: keep each shot to one clear subject and a single, simple motion or camera move.

    line 130
  15. Distinctive:

    Don't loop the same clip unless asked.

    line 137

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “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

Imagine

Guidance for the two image tool calls in Grok Build:

  • image_gen - generate a new image from a text prompt.
  • image_edit - modify an existing image using a text prompt and source image.

Apply this whenever you're considering or about to call either tool.

Build accurate visuals with code, not the image tools

  1. Image models are unreliable at exact text, numbers, and structure. They can handle short text or a simple layout, but they often garble words, invent numbers, draw chart bars that match no data, or point diagram arrows nowhere, and the more that has to be exact, the worse they do. A detailed prompt doesn't make it dependable, and an image_edit pass usually won't fix it. So when a result needs specific text, data, or structure to be correct (charts from real numbers, labeled or technical diagrams, math explainers, tables, screens with real copy, and multi-panel layouts like contact sheets, storyboards, or comic grids where the frame, panel borders, and labels must be exact), construct the asset with code, where you control the exact content. Prefer HTML and CSS, which give much better layout, typography, and polish than Python plotting. When only the look matters (photos, illustrations, characters, scenes, decorative art), the image tools are the right choice. Which one fits depends on what the output needs to get right, not on how the request is worded.

Verifying discrete accuracy (loop)

When the output must get specific text, numbers, data, or structure right, don't trust the first result - verify it in a loop:

  1. Produce the result (generate, or per Build accurate visuals with code, construct it in code).
  2. Inspect the actual output - use image understanding to read a generated image back (or check the rendered code) - and confirm every word, number, label, and structural detail matches the requirement, and that nothing overlaps, clips, or runs off-canvas.
  3. If anything is wrong, fix and re-verify:
    • Garbled text, invented numbers, or broken layout from an image model? Don't just re-prompt - it will likely garble it again. Rebuild it with code.
    • Overlapping or clipped elements in code-built output? Re-lay-out with auto-layout (HTML/CSS) rather than nudging coordinates by hand.
    • Otherwise make one targeted edit.
  4. Only finish when the discrete content is exactly correct. If it can't be made accurate, tell the user instead of shipping something wrong.

Core Principles

  1. You own the prompt. If the user gives a detailed prompt or asks you to use theirs, use it verbatim. Otherwise craft the final prompt: front-load the subject, give strong high-level direction for mood, composition, lighting, and style without over-specifying every detail, write natural prose rather than keyword tags, and describe positively instead of using negative prompts. For edits, describe only what changes. Target 2-5 sentences.
  2. Reference-first for real people. Never use pure image_gen for a named real person or group, including face swaps, posters, cartoons, and cinematic or editorial depictions. Use image_edit with a real reference instead, and never produce non-consensual, sexualized, or minor-involving likenesses. See Real People and References for the procedure.
  3. Ground facts with search first. If any part of the request depends on a real-world fact, identity, brand or product, place, event, or top/latest/current result, search the web before generating and put the actual verified details into the prompt. Don't rely on memory, and don't write vague placeholders like "the current president"; write the verified name.
  4. Anchor recurring subjects to a reference. When a character, object, setting, or look recurs across images or shots, generate one canonical reference first and derive every reappearance from it with image_edit/reference_to_video - never a fresh image_gen. See Consistency across shots and panels.
  5. Handle failures gracefully. On a moderation or safety block, stop; don't retry and don't paraphrase the prompt to evade the filter. Tell the user it was blocked and offer a different direction. If a reference is weak or a result looks off-target, say so and ask for an upload or redirect rather than silently iterating.
  6. Plan multi-step workflows. Sequence the steps; only parallelize generations that belong to the same step.
  7. Review at the end. Confirm the generations you intended actually executed and match what was asked.
  8. Don't assume tool behavior. Don't invent tool parameters, return values, or environment capabilities that aren't actually provided; verify rather than guess.

Choosing the Tool

SituationTool
New image, no source imageimage_gen
Edit, restyle, recolor, add, remove, or extend an existing imageimage_edit
Iterate on a previous result while keeping compositionimage_edit
Named real person or groupimage_edit with a real reference after a web search
Generic, invented, or non-factual subject from scratchimage_gen

Rule of thumb: no source image -> image_gen; source image -> image_edit.

image_gen

Generates a new image from a text prompt.

Inputs:

  • prompt (required) - full description of the desired image.
  • aspect_ratio - e.g. 1:1, 16:9, 9:16, 4:3, 3:4, or auto.

Use for generic or invented subjects, or to create a base image you'll edit later. Not for named real people; see Reference-first for real people.

To produce multiple variations, make multiple image_gen calls with distinct prompts. The tool does not expose n or count parameters.

image_edit

Transforms an existing image according to a prompt.

Inputs:

  • prompt (required) - describe the desired transformation, and note what should stay the same.
  • image (required) - one or more source/reference images as filesystem paths or data:image/...;base64,... URLs. Prefer a single clean reference for reliable results.
  • aspect_ratio - optional; used for multi-image edits. Single-image edits preserve the input image aspect ratio.

Use to restyle, recolor, add or remove elements, preserve likeness, transfer style, remix, or iterate on a generated result.

To produce multiple variations, make multiple image_edit calls. The tool does not expose n or count parameters.

Writing Strong Prompts

Describe, roughly in this order: subject -> action/pose -> setting -> style -> composition -> lighting/mood -> key details.

  • Be specific and concrete; lead with the most important elements.
  • State what to include rather than what to exclude.
  • Use one coherent scene per prompt.
  • Match aspect_ratio to the use case when using image_gen: 9:16 for phone/story, 16:9 for banner/video frame, 1:1 for avatar/icon.

Real People and References

  1. Search the web first to confirm identity, role, relationship, or event, even when it seems obvious.
  2. Use a single strong reference with image_edit. A user-uploaded photo is best; otherwise use a high-quality found reference and cite the source. image_edit can take more than one reference, but one clean reference is more reliable.
  3. If no suitable reference exists, ask the user to upload one rather than generating from a weak base.

Consistency across shots and panels

Grok Build has no persistent character or style memory, so consistency is manufactured on every call - independent generations of "the same" subject always drift.

  • Anchor to a reference. For any recurring character, asset, wardrobe, location, or effect/color-grade ("look"), generate one canonical reference first, then produce every reappearance with image_edit (or reference_to_video) seeded from it. Restate the subject's fixed traits and any hard rule in each prompt, and verify each result against the reference. For coverage - one scene from several angles - derive each angle from a single scene master, not from fresh generations.
  • Multi-panel sets are a pipeline, not one image. A storyboard, contact sheet, comic page, or scene series can't be a single generation; it collapses into a few generic frames with drifting faces and dropped panels. Instead: (1) build the references above; (2) generate each panel separately, seeded from the references it needs, verifying each; (3) assemble the grid, borders, and labels in code (per Build accurate visuals with code).

Video

The video tools below may not exist - verify they're available before calling them; if they're not, the user cannot do video gen with Imagine.

Video starts from an image - there is no text-to-video tool. Default to image_to_video.

Think in shots. Build video as a planned sequence of short shots, not one long take:

  1. Plan the story as shots - break the idea into distinct shots, one beat each.
  2. Favor frequent, short shots - prefer more 6s shots over fewer long ones; more cuts keep it dynamic and interesting.
  3. Create each shot's source image, seeding recurring characters and settings from their references (Consistency across shots and panels) via multi-image image_edit rather than a fresh image_gen.
  4. Animate each shot with image_to_video - the source becomes frame 1.

Use reference_to_video only if the user asks for it or a shot genuinely needs multiple references - and even then, prefer composing those references with a multi-image image_edit and animating the result with image_to_video.

Key behaviors:

  • Prompt-craft: one short, vivid moment in present tense with a clear camera movement, in 1-2 sentences.
  • Minimal but interesting: keep each shot to one clear subject and a single, simple motion or camera move. Avoid complex or multi-action animation (models handle it poorly); make the shot interesting through composition, lighting, and a strong moment, not busy motion.
  • Complex source image? An intricate frame (busy geometry, fine detail, heavy reflections) warps when animated. If you must use it, keep the subject fixed and move only the camera (slow push-in, orbit, or parallax), or break it into tighter, simpler shots. For new shots, generate a simpler, animation-friendly base image up front instead of animating a busy one.
  • image_to_video animates from frame 1, so stage the intended first frame with image_gen/image_edit first.
  • Continuity between shots: seed a connected shot from the previous shot's last frame (extract it with ffmpeg) so light, motion, and identity carry over.
  • Aspect ratio: set it on the source image (image_gen aspect_ratio); don't re-crop an existing video.
  • Duration: 6s or 10s only (prefer 6s shots); round to the nearest.
  • Real people: reference-first - drive the video from a verified reference image; never animate a named person without one.
  • Don't loop the same clip unless asked.

Assemble shots with FFmpeg using stream copy so there's no quality loss: ffmpeg -f concat ... -c copy - never re-encode. Keep every shot at the same resolution and frame rate so the copy works.

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.