agentleFS
boltguoboltguo/skills/gemini-image-gen/SKILL.md

gemini-image-gen

Skill1 starsChanged 8 months agoMITView on GitHub

Generate images using the Gemini API (AI Studio key). Use when user asks to generate/create images with Gemini, Google AI, or mentions '图片生成', 'Gemini 生图', 'AI 生图', 'generate image', 'create image'.

  • Reads credentials

4 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions4 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 4

    1. emanueleielo/ciana-parrot★ 77same name
    2. Svenja-dev/claude-code-skills★ 38same name
    3. maystudios/claude-skills★ 24same name
    4. kaiye/skills★ 19same name

    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.

  • In this repositoryOne other file it gives its agents.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    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. Very specific:

    Must use uppercase K. Unsupported values are caught by the script and fall back (Pro 512→1K, others→2K).

    line 35
  2. Very specific:

    No prompt or too vague → call AskUserQuestion:

    line 67
  3. Very specific:

    Call AskUserQuestion with 4 questions in a single call.

    line 74
  4. Distinctive:

    Read and show the generated image

    line 89
  5. Very specific:

    If success: false → inform user (likely safety filter)

    line 90

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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

Gemini Image Generation

python <skill-path>/scripts/generate_image.py "your prompt here"

Output: gemini-images/{timestamp}-{slug}/ containing prompt.md, image.png, and optionally response.json.

Requirements

GEMINI_API_KEY or GOOGLE_API_KEY env var (get key).

First-time permission setup:

claude config add permissions.allow "Bash(python */gemini-image-gen/scripts/generate_image.py*)"

Models

ModelNotes
gemini-3.1-flash-image-previewDefault. Fast, supports thinkingConfig + googleSearch/imageSearch
gemini-3-pro-image-previewHigher quality, better text rendering and complex layouts

Parameters

--image-size

Must use uppercase K. Unsupported values are caught by the script and fall back (Pro 512→1K, others→2K).

ValueFlashPro
512YesNo
1KYesYes
2KdefaultYes
4KYesYes

--aspect-ratio

Flash (14): 1:1 · 1:4 · 1:8 · 2:3 · 3:2 · 3:4 · 4:1 · 4:3 · 4:5 · 5:4 · 8:1 · 9:16 · 16:9 · 21:9

Pro (10): 1:1 · 2:3 · 3:2 · 3:4 · 4:3 · 4:5 · 5:4 · 9:16 · 16:9 · 21:9

Unsupported ratio auto-falls back to 16:9.

Other flags

  • --save-request: Save response.json (Gemini API response) to output folder
  • --output-dir: Override auto-generated output path

Workflow

IMPORTANT:

  • You MUST use AskUserQuestion tool (not plain text) to collect user input. Plain text does NOT pause execution.
  • Match the user's language for all UI text (questions, labels, descriptions).

Step 1: Collect Prompt

  • User already provided a clear prompt → use it directly, craft an English version (Gemini works best with English), go to Step 2.
  • No prompt or too vague → call AskUserQuestion:
    • question: "Describe the image you want to generate:"
    • header: "Prompt"
    • options: provide 2-3 example prompts as inspiration (e.g. "Cyberpunk city at night", "Watercolor cat portrait")

Step 2: Settings

Call AskUserQuestion with 4 questions in a single call. The first option in each is the default (Recommended). Users can accept defaults or switch as needed:

  1. Model — header: "Model", options: "Flash (Recommended)" / "Pro"
  2. Size — header: "Size", options: "2K (Recommended)" / "1K" / "4K"
  3. Ratio — header: "Ratio", options: "16:9 (Recommended)" / "1:1" / "9:16" / "21:9"
  4. Save JSON — header: "Debug", options: "No (Recommended)" / "Save response.json"

Step 3: Generate

python <skill-path>/scripts/generate_image.py "prompt" [--model ...] [--aspect-ratio ...] [--image-size ...] [--save-request]

Step 4: Results

  1. Read and show the generated image
  2. If success: false → inform user (likely safety filter)
  3. Report output folder path

Prompt Tips

  • Style: "oil painting", "3D render", "watercolor", "photorealistic"
  • Lighting: "golden hour", "dramatic rim lighting", "soft diffused"
  • Composition: "bird's eye view", "close-up", "wide establishing shot"
  • Mood: "mysterious", "cheerful", "melancholic", "epic"
  • Text in images: 25 characters or fewer

Error Handling

ErrorCauseFix
400Invalid parameterCheck supported values for the chosen model
401/403Bad API keyCheck env var
429Rate limitWait and retry
success: falseNo image generated (safety filter or text-only response)Adjust prompt

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.