| name | gemini-image |
| description | Use when the user requests image generation, illustration, icon, logo, photo, visual content creation, or image editing - any task requiring AI-generated or AI-edited images |
| argument-hint | [quality: quick (default) | hq] |
| allowed-tools | ["Write","Read","Bash(gemini:*)","Bash(gemini:*)","Bash(ls:*)","Bash(file:*)","Bash(mv:*)","Bash(cp:*)","Bash(date:*)"] |
| metadata | {"author":"koschei"} |
Gemini Image Generation Skill
You generate images by calling Gemini CLI with the nanobanana extension. Follow these rules precisely.
Model Selection
| Condition | Model | How |
|---|
Default / /gemini-image / /gemini-image quick | gemini-2.5-flash-image | No extra env var needed (nanobanana default) |
/gemini-image hq or user says "high quality", "4K", "professional", "detailed", "best quality" | gemini-3-pro-image-preview | Prepend NANOBANANA_MODEL=gemini-3-pro-image-preview to the command |
Nanobanana Commands
Nanobanana provides these slash commands inside the Gemini CLI prompt:
| Command | Use Case |
|---|
/generate "prompt" | Text-to-image generation |
/edit file.png "instructions" | Modify existing image |
/restore file.png "instructions" | Repair/enhance old photos |
/icon "prompt" --sizes="64,128,256" | App icons, favicons |
/pattern "prompt" --type=seamless | Seamless patterns/textures |
/story "prompt" --steps=4 | Sequential narrative images |
/diagram "prompt" --type=flowchart | Technical diagrams |
File Output
Nanobanana saves images to nanobanana-output/ in the current working directory with auto-generated filenames. After generation, rename the file to match our naming convention:
Format: {subject}-{style}-{timestamp}.png
- subject: 1-5 word kebab-case description (e.g.
orange-cat, tech-logo)
- style: abbreviated style tag:
photo — realistic photograph
illus — illustration / digital art
logo — logo / icon design
pixel — pixel art
water — watercolor
flat — flat design / vector style
3d — 3D render
sketch — pencil / line sketch
anime — anime / manga style
abstract — abstract art
- timestamp:
YYYYMMDDHHMMSS format
Example: orange-cat-water-20260219150030.png
When retrying or iterating on the same image, reuse the same filename to overwrite.
Generating an Image
-
Read references/prompt-guide.md from the skill directory for prompt engineering guidance.
-
Craft an effective English prompt based on the user's request and the prompt guide. Even if the user writes in another language, the prompt sent to Gemini must be in English.
-
Get the current timestamp for the output filename:
date +%Y%m%d%H%M%S
-
Run the generation command (timeout 180s):
gemini -e nanobanana -p '/generate "<english_prompt>"' --yolo --sandbox false
NANOBANANA_MODEL=gemini-3-pro-image-preview gemini -e nanobanana -p '/generate "<english_prompt>"' --yolo --sandbox false
-
Find and verify the output:
ls -lt nanobanana-output/*.png | head -1
file nanobanana-output/<filename>.png
-
Rename to our naming convention:
mv nanobanana-output/<generated_name>.png nanobanana-output/<subject>-<style>-<timestamp>.png
-
Report the result to the user: show the image using Read tool, confirm the file path, and briefly describe what was generated.
Editing an Existing Image
When the user wants to modify an existing image:
-
Confirm the source image path exists. If the image is not in nanobanana-output/, copy it there first.
-
Run the edit command (timeout 180s):
gemini -e nanobanana -p '/edit <filename_in_nanobanana_output> "<edit_instructions>"' --yolo --sandbox false
-
Verify, rename, and report as above.
Specialized Commands
Icons
gemini -e nanobanana -p '/icon "<description>" --sizes="64,128,256" --type=app-icon --style=modern' --yolo --sandbox false
Patterns
gemini -e nanobanana -p '/pattern "<description>" --type=seamless --style=geometric' --yolo --sandbox false
Diagrams
gemini -e nanobanana -p '/diagram "<description>" --type=flowchart --complexity=detailed' --yolo --sandbox false
Error Handling
- If Gemini returns a safety filter error, inform the user and suggest rephrasing.
- If the model is unavailable, fall back to the other model and retry once.
- If the first
generate_image call fails, nanobanana typically retries automatically. If it still fails, retry the entire command once.
- If the command times out, inform the user and suggest simplifying the prompt.
- If no output file appears in
nanobanana-output/, check for error messages in stderr.
Important Notes
- Always use
-e nanobanana to load the extension.
- Always use
--yolo flag — required for headless auto-approval of tool calls.
- Always use
--sandbox false — ensures Gemini can write to the working directory.
- Nanobanana calls the Gemini image API directly via its MCP server — it does NOT use Gemini CLI's built-in
write_file.
- The
NANOBANANA_GEMINI_API_KEY env var must be set for the extension to work.