This skill should be used for Python scripting and Gemini image generation. Use when users ask to generate images, create AI art, edit images with AI, or run Python scripts with uv. Trigger phrases include "generate an image", "create a picture", "draw", "make an image of", "nano banana", or any image generation request.
View on GitHubNikiforovAll/claude-code-rules
handbook-nano-banana
January 20, 2026
Select agents to install to:
npx add-skill https://github.com/NikiforovAll/claude-code-rules/blob/main/plugins/handbook-nano-banana/skills/nano-banana/SKILL.md -a claude-code --skill nano-bananaInstallation paths:
.claude/skills/nano-banana/# Nano Banana Skill
Python scripting with Gemini image generation using uv. Write small, focused scripts using heredocs for quick tasks—no files needed for one-off operations.
## Choosing Your Approach
**Quick image generation**: Use heredoc with inline Python for one-off image requests.
**Complex workflows**: When multiple steps are needed (generate -> refine -> save), break into separate scripts and iterate.
**Scripting tasks**: For non-image Python tasks, use the same heredoc pattern with `uv run`.
## Writing Scripts
Execute Python inline using heredocs with inline script metadata for dependencies:
```bash
uv run - << 'EOF'
# /// script
# dependencies = ["google-genai", "pillow"]
# ///
from google import genai
from google.genai import types
client = genai.Client()
response = client.models.generate_content(
model="gemini-2.5-flash-image",
contents=["A cute banana character with sunglasses"],
config=types.GenerateContentConfig(
response_modalities=['IMAGE']
)
)
for part in response.parts:
if part.inline_data is not None:
image = part.as_image()
image.save("tmp/generated.png")
print("Image saved to tmp/generated.png")
EOF
```
The `# /// script` block declares dependencies inline using TOML syntax. This makes scripts self-contained and reproducible.
**Why these dependencies:**
- `google-genai` - Gemini API client
- `pillow` - Required for `.as_image()` method (converts base64 to PIL Image) and saving images
**Only write to files when:**
- The script needs to be reused multiple times
- The script is complex and requires iteration
- The user explicitly asks for a saved script
### Basic Template
```bash
uv run - << 'EOF'
# /// script
# dependencies = ["google-genai", "pillow"]
# ///
from google import genai
from google.genai import types
client = genai.Client()
# Generate image
response = client.models.generate_content(
model="gemini-2.5-flash-image",
contents=["YOUR PROMPT HERE"],
config=