Agent Skills: Nano Banana — Image Generation with Gemini

|

UncategorizedID: testacode/llm-toolkit/nano-banana

Install this agent skill to your local

pnpm dlx add-skill https://github.com/testacode/llm-toolkit/tree/HEAD/skills/nano-banana

Skill Files

Browse the full folder contents for nano-banana.

Download Skill

Loading file tree…

skills/nano-banana/SKILL.md

Skill Metadata

Name
nano-banana
Description
|

Nano Banana — Image Generation with Gemini

Genera imagenes fotorrealistas, renders de producto, concept art y mas usando los modelos Nano Banana de Google (sobre Gemini). Soporta text-to-image, image editing y multiples resoluciones hasta 4K.

Setup

  1. Obtener API key en aistudio.google.com/apikey
  2. Vincular billing al proyecto en Google Cloud (no cobra, activa quotas del free tier)
  3. Guardar en .env:
GOOGLE_AI_KEY=tu-key

Verificar que funciona:

API_KEY=$(grep GOOGLE_AI_KEY .env | cut -d= -f2) && \
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
  -H "Content-Type: application/json" \
  -H "X-goog-api-key: ${API_KEY}" \
  -d '{"contents":[{"parts":[{"text":"Generate an image: a red cube on a white background"}]}],"generationConfig":{"responseModalities":["TEXT","IMAGE"]}}' \
  | python3 -c "import json,sys; d=json.load(sys.stdin); print('OK' if any('inlineData' in p for p in d['candidates'][0]['content']['parts']) else 'ERROR: no image')"

Modelos

| Modelo | Model ID | Default | Uso | |--------|----------|---------|-----| | Nano Banana | gemini-2.5-flash-image | No | Legacy, prototipado rapido | | Nano Banana Pro | gemini-3-pro-image-preview | No | Max calidad, Thinking mode | | Nano Banana 2 | gemini-3.1-flash-image-preview | Si | Calidad Pro a velocidad Flash |

Regla: usar siempre gemini-3.1-flash-image-preview salvo que el usuario pida explicitamente otro modelo.

Para comparativa detallada, pricing y arbol de decision: references/model-guide.md

Quick Start

API_KEY=$(grep GOOGLE_AI_KEY .env | cut -d= -f2) && \
curl -s "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.1-flash-image-preview:generateContent" \
  -H "Content-Type: application/json" \
  -H "X-goog-api-key: ${API_KEY}" \
  -d '{
    "contents": [{"parts": [{"text": "Generate an image: A photorealistic product shot of a ceramic coffee mug on a marble countertop, soft studio lighting, 3/4 view"}]}],
    "generationConfig": {
      "responseModalities": ["TEXT", "IMAGE"],
      "imageConfig": {"aspectRatio": "4:3"}
    }
  }' | python3 -c "
import json, base64, sys
data = json.load(sys.stdin)
for part in data['candidates'][0]['content']['parts']:
    if 'inlineData' in part:
        with open('output.png', 'wb') as f:
            f.write(base64.b64decode(part['inlineData']['data']))
        print('Imagen guardada en output.png')
        break
"

Para scripts completos en bash, Node.js y Python: references/api-usage.md

Prompting

Formula base:

A [composition] [subject] in [style] with [lighting], featuring [details]

Siempre en ingles. Prefijo: "Generate an image:".

Reglas clave:

  • Prompt largo y descriptivo > prompt corto. Minimo 2 oraciones
  • Especificar estilo: "photorealistic", "3D render", "watercolor", "flat illustration"
  • Especificar iluminacion: "soft studio lighting", "golden hour", "dramatic side lighting"
  • Especificar angulo de camara: "eye-level", "3/4 view", "bird's eye view", "close-up"
  • Agregar "no people, no text" si no se necesitan
  • Texto en imagenes: funciona pero con errores frecuentes. Limitar a 1-3 palabras

Para guia completa de prompting con keywords por categoria: references/prompting-guide.md

Image Editing

Nano Banana soporta edicion de imagenes existentes: enviar imagen + instruccion de texto.

Casos de uso:

  • Background replacement: "Replace the background with a tropical beach sunset"
  • Style transfer: "Make this look like an oil painting"
  • Object removal: "Remove the person on the left"
  • Color/lighting changes: "Make the lighting warmer and more dramatic"

Para workflow detallado, payloads API y patterns: references/image-editing.md

Configuracion

responseModalities

Siempre incluir "responseModalities": ["TEXT", "IMAGE"] en generationConfig. Sin esto, no genera imagenes.

aspectRatio

| Ratio | Resolucion | Uso tipico | |-------|-----------|-----------| | 1:1 | 1024x1024 | Avatar, thumbnail, social media cuadrado | | 3:4 | 896x1152 | Portrait, producto vertical, poster | | 4:3 | 1152x896 | Landscape, hero image, producto horizontal | | 16:9 | 1344x768 | Banner, hero wide, presentacion | | 9:16 | 768x1344 | Story, reel, mobile wallpaper |

Ratios adicionales soportados: 2:3, 3:2, 4:5, 5:4, 9:21, 21:9, 2:1, 1:2, 5:3, 3:5

imageSize

Solo disponible en gemini-3-pro-image-preview:

  • 512 — Rapido, draft
  • 1024 — Default, buena calidad
  • 2048 — Alta resolucion
  • 4096 — Maxima resolucion (mas lento, mas caro)

numberOfImages

1 a 4. Default: 1. Costo se multiplica por cantidad.

Templates

Templates listos para copiar y adaptar por tipo de contenido:

  • Product photography (studio, white bg, catalog)
  • Architectural renders (interior, exterior, room)
  • Marketing/Social (hero, banners, ads)
  • Concept art (characters, environments, props)

Ver todos en references/prompt-templates.md

Troubleshooting

| Problema | Causa | Solucion | |----------|-------|---------| | HTTP 429 | Rate limit excedido | Esperar 60s, reducir frecuencia. Free tier: ~10 img/min | | Respuesta sin imagen | Billing no vinculado | Vincular billing en Google Cloud Console | | Calidad baja | Prompt demasiado corto | Minimo 2 oraciones descriptivas. Agregar estilo + iluminacion | | Safety filter | Contenido bloqueado | Reformular sin contenido sensible. Evitar personas reales | | Texto ilegible | Limitacion del modelo | Reducir a 1-3 palabras. Usar fuentes simples en el prompt | | Imagen cortada | Aspect ratio incorrecto | Elegir ratio segun orientacion del contenido |