Skip to content
nano-banana-skill logo

Nano Banana Skill

nano-banana-skill

Generates, edits, and restores images using Google Gemini image models (Nano Banana). Use when the user wants to create images from text prompts, edit existing images with natural language, restore or enhance photos, or generate icons, patterns, diagrams, or visual content. Requires a GEMINI_API_...

SKILL.md

Full skill instructions

Nano Banana Skill

Image generation, editing, and restoration powered by Google Gemini.

Setup (One-Time)

Run the setup script to install dependencies automatically:

bash <skill-dir>/​scripts/​setup.sh

Then set an API key (get one at https://aistudio.google.com/apikey):

export GEMINI_API_KEY="your-api-key"

The API key can be set as any of these environment variables (checked in order): NANOBANANA_GEMINI_API_KEY, NANOBANANA_GOOGLE_API_KEY, GEMINI_API_KEY, GOOGLE_API_KEY

Quick Reference

ModePurposeRequired Flags
generateCreate image from text--prompt
editModify an existing image--input, --prompt
restoreEnhance/​fix an image--input
FlagDescriptionDefault
--promptText description of desired image—
--inputInput image path (edit/​restore)—
--referenceStyle reference image(s), repeatable—
--outputOutput file pathAuto-named
--size1K, 2K, or 4K1K
--formatpng or jpegpng
--previewOpen image after generationoff
--jsonOutput structured JSONoff

Generate Images

Create images from text prompts:

# Basic generation
python3 <skill-dir>/​scripts/​nanobanana.py --mode generate --prompt "A banana floating in space"

# With specific size and format
python3 <skill-dir>/​scripts/​nanobanana.py --mode generate --prompt "Cyberpunk cityscape at night" --size 2K --format jpeg

# With explicit output path
python3 <skill-dir>/​scripts/​nanobanana.py --mode generate --prompt "Minimalist logo" --output ./​my-logo.png

When --output is omitted, files are saved to ./​nanobanana-output/ with auto-generated names based on the prompt.

Edit Images

Modify existing images using natural language instructions:

# Change style
python3 <skill-dir>/​scripts/​nanobanana.py --mode edit --input photo.jpg --prompt "Convert to watercolor painting style"

# Modify content
python3 <skill-dir>/​scripts/​nanobanana.py --mode edit --input scene.png --prompt "Add a rainbow in the sky"

# Change colors
python3 <skill-dir>/​scripts/​nanobanana.py --mode edit --input logo.png --prompt "Change the color scheme to blue and gold"

Restore Images

Enhance, repair, or upscale images:

# Auto-restore (uses default restoration prompt)
python3 <skill-dir>/​scripts/​nanobanana.py --mode restore --input old_photo.jpg

# Targeted restoration
python3 <skill-dir>/​scripts/​nanobanana.py --mode restore --input damaged.png --prompt "Remove scratches and improve sharpness"

# Enhance quality
python3 <skill-dir>/​scripts/​nanobanana.py --mode restore --input blurry.jpg --prompt "Enhance clarity and increase detail" --size 4K

Reference Images

Use reference images to guide the style of generated images:

# Single reference
python3 <skill-dir>/​scripts/​nanobanana.py --mode generate --prompt "A mountain landscape" --reference style_guide.png

# Multiple references
python3 <skill-dir>/​scripts/​nanobanana.py --mode generate --prompt "Product photo" --reference brand_style.png --reference color_palette.png

The script searches for input and reference files in these locations:

  • Current directory
  • ./​images/
  • ./​input/
  • ./​nanobanana-output/
  • ~/​Downloads/
  • ~/​Desktop/

Output

Smart Naming

When --output is omitted, files are automatically named based on the prompt text:

  • Prompt is converted to lowercase with special characters removed
  • Spaces become underscores, limited to 32 characters
  • Duplicate names get a numeric suffix (_1, _2, etc.)
  • All auto-named files go into ./​nanobanana-output/

Sizes

SizeDescription
1KStandard resolution (default, fastest)
2KHigh resolution
4KMaximum resolution (slowest)

Model Selection

Set the NANOBANANA_MODEL environment variable to choose a model:

# Default model (fast, good quality)
export NANOBANANA_MODEL="gemini-2.5-flash-image"

# Pro model (highest quality)
export NANOBANANA_MODEL="gemini-3-pro-image-preview"

If unset, defaults to gemini-2.5-flash-image.

Specialized Patterns

No special flags are needed for these -- just use descriptive prompts:

Icons

python3 <skill-dir>/​scripts/​nanobanana.py --mode generate \
  --prompt "Flat design app icon for a weather app, rounded corners, minimal style, solid background" \
  --size 1K

Patterns

python3 <skill-dir>/​scripts/​nanobanana.py --mode generate \
  --prompt "Seamless tileable geometric pattern, blue and white, high density, suitable for fabric print"

Diagrams

python3 <skill-dir>/​scripts/​nanobanana.py --mode generate \
  --prompt "Architecture diagram showing microservices: API gateway, auth service, user service, database. Clean lines, labeled boxes"

Sequential / Story Images

Generate each frame as a separate call, referencing previous outputs to maintain visual consistency:

# Frame 1
python3 <skill-dir>/​scripts/​nanobanana.py --mode generate \
  --prompt "Scene 1 of 3: A hero stands at the edge of a forest, sunrise, cinematic style" \
  --output ./​nanobanana-output/​story_1.png

# Frame 2 (reference previous for consistency)
python3 <skill-dir>/​scripts/​nanobanana.py --mode generate \
  --prompt "Scene 2 of 3: The same hero enters the forest, dappled light, cinematic style" \
  --reference ./​nanobanana-output/​story_1.png \
  --output ./​nanobanana-output/​story_2.png

Preview

Add --preview to automatically open the generated image:

python3 <skill-dir>/​scripts/​nanobanana.py --mode generate --prompt "Sunset over ocean" --preview

Uses the system default image viewer (macOS: open, Linux: xdg-open, Windows: start).

JSON Output

Add --json for structured output suitable for agent parsing:

python3 <skill-dir>/​scripts/​nanobanana.py --mode generate --prompt "A banana" --json

Output format:

{
  "success": true,
  "files": ["nanobanana-output/​a_banana.png"],
  "message": "Image generated successfully."
}

On failure:

{
  "success": false,
  "files": [],
  "message": "Error description here"
}

Error Handling

ErrorCauseFix
No API key foundMissing environment variableSet GEMINI_API_KEY
403 / Permission deniedInvalid API keyCheck key at https://aistudio.google.com/apikey
429 / Rate limitToo many requestsWait and retry
Safety filterPrompt flaggedRephrase the prompt
No image generatedModel returned text onlyTry a more specific prompt
File not foundInput/​reference image missingCheck path or place in a searched directory

See references/​ADVANCED.md for advanced prompt engineering patterns, model comparison, and troubleshooting.

More Other skills

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

179.7K 100.1K
View

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

179.7K 89.5K
View

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

179.7K 76.1K
View

Fundamental design principles for writing maintainable, testable Python code.

40.2K 21.9K
View

Modern responsive layouts using container queries, fluid typography, CSS Grid, and mobile-first strategies.

40.2K 20K
View

Generate Playwright tests from scenarios using interactive browser exploration and validation.

39.7K 18.2K
View

Modern React state management with Redux Toolkit, Zustand, Jotai, and React Query for every state category.

40.2K 14.7K
View

GDPR-compliant data handling with consent management, data subject rights, and privacy controls.

40.2K 14.3K
View

Python error handling patterns including input validation, exception hierarchies, and partial failure handling. Use when implementing validation logic, designing exception strategies, handling batch processing failures, or building robust APIs.

40.2K 13.5K
View

Detailed multi-file refactor planning with safety checks and rollback guidance.

39.7K 13K
View