nano-banana-2 · intellectronica — Claude Code skill: generate and edit images
A skill that drives the Nano Banana 2 API to generate and edit images, with control over resolution and aspect ratio.
npx skills add intellectronica/agent-skills --skill nano-banana-2 -a claude-codeWhat nano-banana-2 does
The skill wraps the gemini-3.1-flash-image-preview model in a single script, scripts/generate_image.py. You pass a prompt and a filename; the script writes a PNG into the current project directory and returns the full path. To edit, add --input-image — up to 14 references when you need to keep a character's face or a logo intact.
Resolution comes from --resolution: 512px, 1K, 2K or 4K, with 1K as the default. Aspect ratio is set with --aspect-ratio, from 1:1 and 9:16 up to 21:9 and 8:1. Leave it out and the model's default behaviour applies.
Run the script from your project's working directory rather than the skill folder, or the output lands in the wrong place. It needs a key: either the --api-key flag or a GEMINI_API_KEY environment variable. Without one the script stops with an error. Invocation goes through uv run, so uv has to be installed.
The skill does not use gemini-3-pro-image-preview — if that model is what you need, look elsewhere.
What it helps with
- generate an image from a text description and save it into the project
- edit an existing image while keeping a logo and a character's face
- combine several visual references into one output
- draft fast at 512px, then re-render the same shot at 4K
- pin an exact aspect ratio for a banner, slide or vertical reel
Example prompts for the agent
- generate a neon city at night, 4K, 16:9
- edit this logo into a campaign banner, 2K, 4:5
- make a quick 512px draft thumbnail, square
How to install nano-banana-2
1Skills CLI (Vercel)
npx skills add intellectronica/agent-skills --skill nano-banana-2 -a claude-code2Manually: put the files in place
~/.claude/skills/nano-banana-2/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/nano-banana-2/
1Skills CLI (Vercel)
npx skills add intellectronica/agent-skills --skill nano-banana-2 -a codex2Manually: put the files in place
.agents/skills/nano-banana-2/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add intellectronica/agent-skills --skill nano-banana-2 -a cursor2Manually: put the files in place
.cursor/skills/nano-banana-2/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install intellectronica/agent-skills nano-banana-22Manually: put the files in place
.github/skills/nano-banana-2/SKILL.md1Skills CLI (Vercel)
npx skills add intellectronica/agent-skills --skill nano-banana-2 -a gemini-cli2Platform CLI
gemini skills install https://github.com/intellectronica/agent-skills --path skills/nano-banana-2Manually: put the files in place
.devin/skills/nano-banana-2/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add intellectronica/agent-skills --skill nano-banana-2 -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about nano-banana-2
How do I install nano-banana-2 in Claude?
Run npx skills add intellectronica/agent-skills --skill nano-banana-2 -a claude-code. The skill lands at ~/.claude/skills/nano-banana-2/SKILL.md.
What does nano-banana-2 do?
It generates new images and edits existing ones through the Nano Banana 2 API, with resolution from 512px to 4K and explicit aspect-ratio control.
What do I need before using it?
An API key, passed as --api-key or set in the GEMINI_API_KEY environment variable. The script runs through uv run.
Source text
SKILL.md · CC0-1.0
--- name: nano-banana-2 description: Generate and edit images using Google's Nano Banana 2 (Gemini 3.1 Flash Image Preview) API. This skill should be used when the user asks to create or modify images, especially when they need fast iteration, explicit aspect-ratio control, or resolution control from 512px to 4K. --- # Nano Banana 2 Image Generation & Editing Generate new images or edit existing images with Nano Banana 2 (`gemini-3.1-flash-image-preview`). ## Usage Run the script using absolute or workspace-relative path (do NOT cd into the skill directory first): **Generate new image:** ```bash uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "your image description" --filename "output-name.png" [--resolution 512px|1K|2K|4K] [--aspect-ratio RATIO] [--api-key KEY] ``` **Edit image(s) with references:** ```bash uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "editing instructions" --filename "output-name.png" --input-image "path/to/input1.png" [--input-image "path/to/input2.png" ...] [--resolution 512px|1K|2K|4K] [--aspect-ratio RATIO] [--api-key KEY] ``` Always run from the user's current working directory so outputs are saved in the active project context. ## Model Use model code: - `gemini-3.1-flash-image-preview` (Nano Banana 2) Do not use `gemini-3-pro-image-preview` in this skill. ## Resolution Options Nano Banana 2 supports: - `512px` (fastest, low-latency iteration) - `1K` (default) - `2K` - `4K` Map common user language: - "quick draft", "thumbnail", "tiny", "512", "0.5K" → `512px` - no resolution mention → `1K` - "2K", "medium", "normal" → `2K` - "4K", "high-res", "ultra", "print quality" → `4K` Use uppercase `K` for `1K`, `2K`, `4K`. ## Aspect Ratios Supported aspect ratios: - `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` Map common requests: - square post / icon → `1:1` - phone wallpaper / vertical reel → `9:16` - widescreen / slide / hero image → `16:9` - cinematic wide → `21:9` - portrait print → `2:3` or `3:4` - panorama banner → `4:1` or `8:1` If unspecified, let the model default behavior apply. ## Reference Images (New in Gemini 3 Image workflows) Provide up to 14 reference images when needed by repeating `--input-image`: - preserve character consistency - preserve object fidelity - combine multiple visual references into one output Use one image for simple edits; use multiple images for composition or consistency-sensitive tasks. ## API Key Resolve API key in this order: 1. `--api-key` argument 2. `GEMINI_API_KEY` environment variable If no key is available, stop and report a clear error. ## Filename Generation Generate filenames as: `yyyy-mm-dd-hh-mm-ss-name.png` Examples: - `2026-02-26-17-31-04-japanese-garden.png` - `2026-02-26-17-31-59-social-banner.png` ## Prompt Handling For generation, pass the user's request as-is unless critically underspecified. For editing, include explicit transformation instructions in the prompt and preserve the original intent. ## Output - Save PNG to the current directory (or to a provided path in `--filename`) - Return the full saved path(s) - Do not read the output image back unless explicitly requested ## Examples **Create a 4K widescreen image:** ```bash uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "Futuristic city skyline at blue hour with neon reflections" --filename "2026-02-26-17-45-00-futuristic-skyline.png" --resolution 4K --aspect-ratio 16:9 ``` **Edit with multiple references:** ```bash uv run ./.agents/skills/nano-banana-2/scripts/generate_image.py --prompt "Create a polished campaign image that keeps the exact logo details and character identity" --filename "2026-02-26-17-50-10-campaign-image.png" --input-image "logo.png" --input-image "character.png" --resolution 2K --aspect-ratio 4:5 ```
© intellectronica · CC0-1.0 · intellectronica/agent-skills
Similar skills
Everything for AI and ML →nano-banana-2 by other authors comes first.