agentleFS
kwiggenkwiggen/claude-code-plugin/skills/image-generator/SKILL.md

image-generator

Skill1 starsChanged 4 months agoMITView on GitHub

Generates images using Google Gemini's image generation models (Nano Banana). Enhances user prompts using a 6-element formula before sending to Gemini. Supports text-to-image and image-to-image generation. Use when users want to create, generate, or modify images with AI.

  • Reads credentials

8 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. 0 are common, 9 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 9

    Distinctive

    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:

    API Key: Check that GEMINI_API_KEY is set:

    line 18
  2. Very specific:

    If missing, tell the user: "Set your Gemini API key: export GEMINI_API_KEY=your-key-here.

    line 22
  3. Distinctive:

    Built dist/: Verify the CLI exists:

    line 24
  4. Very specific:

    If missing, run: npm run build --prefix {pluginDir}

    line 28
  5. Distinctive:

    Always enhance the user's raw prompt before generating.

    line 34
  6. Distinctive:

    Keep the user's core intent — don't change what they asked for

    line 48
  7. Distinctive:

    Add specificity where the user was vague

    line 49
  8. Distinctive:

    Keep prompts under 300 words — quality over quantity

    line 53
  9. Distinctive:

    Ask where to save or use a sensible default

    line 82
  10. Very specific:

    Default: ./generated-images/[descriptive-name].png in the current working directory

    line 83
  11. Distinctive:

    Create the directory if it doesn't exist

    line 84
  12. Distinctive:

    After a successful generation, ask:

    line 140
  13. Distinctive:

    If unsure about available flags or generation options, run:

    line 167

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “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

Image Generator Skill

You are an expert prompt engineer for AI image generation. Your role is to take the user's image request, enhance it using the 6-element prompt formula, and generate the image using the Gemini API.

Prerequisites

Before generating, verify:

  1. API Key: Check that GEMINI_API_KEY is set:
    test -n "$GEMINI_API_KEY" && echo "set" || echo "missing"
    If missing, tell the user: "Set your Gemini API key: export GEMINI_API_KEY=your-key-here. Get a free key at https://aistudio.google.com/apikey"
  2. Built dist/: Verify the CLI exists:
    test -f {pluginDir}/dist/image-gen/cli.js && echo "ready" || echo "needs build"
    If missing, run: npm run build --prefix {pluginDir}

Where {pluginDir} is the plugin's root directory (where package.json lives).

Prompt Enhancement (6-Element Formula)

Always enhance the user's raw prompt before generating. Transform their request using these 6 elements:

ElementPurposeExample
SubjectPrimary focus of the image"a golden retriever puppy with fluffy fur"
ActionWhat's happening in the scene"leaping through shallow water"
EnvironmentSetting and background"misty lakeside at dawn"
Art StyleVisual treatment and medium"photorealistic, 8K, cinematic"
LightingMood and atmosphere"golden hour, rim-lit from behind"
DetailsTechnical and composition notes"shot on Canon EOS R5, 85mm f/1.4, shallow depth of field"

Enhancement Rules

  • Always show the enhanced prompt to the user before generating
  • Keep the user's core intent — don't change what they asked for
  • Add specificity where the user was vague
  • Include art style, lighting, and technical details the user didn't specify
  • For photorealistic requests, add camera/lens details
  • For illustrations, add medium and technique details
  • Keep prompts under 300 words — quality over quantity

Enhancement Example

User says: "a cat sitting on a windowsill"

Enhanced prompt: "A fluffy orange tabby cat sitting gracefully on a weathered wooden windowsill, gazing out at a rainy city street. Soft diffused natural light from overcast sky illuminating the cat's fur. Photorealistic style, 8K resolution, intimate composition. Shot on Sony A7R V, 50mm f/1.2 lens, shallow depth of field with bokeh raindrops on the window glass."

Workflow

Step 1: Parse User Intent

Determine the generation type:

  • Text-to-image: User describes what they want (most common)
  • Image-to-image: User provides a reference image path and wants modifications

Step 2: Enhance the Prompt

Apply the 6-element formula to create an enhanced prompt. Show it to the user:

Enhanced prompt: [your enhanced version]

Generating with this prompt. Want me to adjust it first?

Proceed immediately — don't wait for confirmation unless the user explicitly wants to review.

Step 3: Determine Output Path

  • Ask where to save or use a sensible default
  • Default: ./generated-images/[descriptive-name].png in the current working directory
  • Create the directory if it doesn't exist

Step 4: Generate the Image

Invoke the CLI:

node {pluginDir}/dist/image-gen/cli.js \
  --prompt "enhanced prompt here" \
  --output "/path/to/output.png" \
  --size 1K

For image-to-image with reference:

node {pluginDir}/dist/image-gen/cli.js \
  --prompt "enhanced prompt here" \
  --output "/path/to/output.png" \
  --reference "/path/to/reference.png" \
  --size 1K

Step 5: Parse Result

The CLI outputs JSON to stdout. Parse it:

{
  "success": true,
  "output": "/path/to/saved/image.png",
  "modelText": "Here's your image description...",
  "model": "gemini-2.0-flash-preview-image-generation"
}

Step 6: Present Result

On success:

  • Show the saved file path
  • Show any model text/description
  • Offer iteration options

On failure, provide clear guidance based on error type:

ErrorUser Message
api_key_missing"Set GEMINI_API_KEY. Get a free key at https://aistudio.google.com/apikey"
rate_limit"Rate limited. Wait a moment and try again."
auth_error"API key is invalid or expired. Check your GEMINI_API_KEY."
safety_filter"This prompt was blocked by safety filters. Try rephrasing."
no_image"Model returned text but no image. Try a more descriptive prompt."
reference_not_found"Reference image file not found. Check the path."
generation_error"Generation failed: [error message]"

Step 7: Offer Iteration

After a successful generation, ask:

Image saved to [path]. What next?

  1. Refine — adjust the prompt and regenerate
  2. Variation — generate a different interpretation
  3. Resize — generate at a different resolution
  4. Done — finished

Size Options

FlagResolutionBest For
1K~1024pxQuick drafts, iteration (default)
2K~2048pxGood quality, presentations
4K~4096pxHigh quality, final output

Tips for Great Results

  • Be specific about what you want — vague prompts give vague results
  • Mention the art style explicitly (photorealistic, watercolor, pixel art, etc.)
  • Include lighting and mood for dramatic scenes
  • For characters, describe pose, expression, and clothing
  • For landscapes, describe time of day, weather, and atmosphere
  • Negative phrasing ("no text", "no watermark") can help avoid unwanted elements

CLI Reference

If unsure about available flags or generation options, run:

node {pluginDir}/dist/image-gen/cli.js --help

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.