---
name: nano-banana-ads
description: Activates whenever the user asks to generate static ad images, product images, marketing visuals, or any image asset for Meta Ads, Instagram, or paid social. Uses Google's Nano Banana 2 image model via OpenRouter API. Always references brand-kit.md for colors, fonts, and style. Includes cost estimation, batch generation, and integration with the static-ad-designer skill for layout rules.
---

# Nano Banana Ads Skill

This skill handles image generation for static ad workflows using Google's Nano Banana 2 model (via OpenRouter). It's the production layer of Pillar 1's Static Ads Engine. The static-ad-designer skill handles strategy and layout rules. This skill handles the API calls.

## Activation Rules

Activate when:
- The user asks to generate ads, ad creatives, product images, or marketing visuals
- The user invokes the static-ad-designer skill (which calls this skill internally)
- The user runs any of the slash commands defined below
- The user asks for image generation as part of any Vault workflow

## Prerequisites

Before this skill can run, the user needs:
1. An OpenRouter API key stored as `OPENROUTER_API_KEY` environment variable, or already saved in Claude Code's API key store
2. A `brand-kit.md` file in the project root (use the brand-kit skill to create one)
3. Sufficient OpenRouter credits ($5+ recommended for a first batch)

If any prerequisite is missing, prompt the user to set it up before continuing.

---

## API Configuration

**Endpoint:** `https://openrouter.ai/api/v1/chat/completions`

**Model ID:** `google/gemini-3.1-flash-image-preview`

**Required headers:**
```
Authorization: Bearer ${OPENROUTER_API_KEY}
Content-Type: application/json
HTTP-Referer: https://highlyevolvedplant.com  (or user's site)
X-Title: HEP Vault Workflow
```

**Request body structure:**
```json
{
  "model": "google/gemini-3.1-flash-image-preview",
  "messages": [
    {
      "role": "user",
      "content": "[the prompt]"
    }
  ],
  "modalities": ["image", "text"]
}
```

**Resolution defaults:**
- 1K (1024x1024 or 1024x1280): For drafts and creative testing. ~$0.06-0.07 per image.
- 2K (2048x2048 or 2048x2560): For finals and production. ~$0.08-0.10 per image.

Default to 1K unless the user explicitly requests final/production quality.

---

## Generation Rules

### Always include

Before sending any prompt, prepend brand context from `brand-kit.md`:

```
BRAND CONTEXT (from brand-kit.md):
- Brand name: {brand_name}
- Primary color: {primary_hex}
- Secondary color: {secondary_hex}
- Accent color: {accent_hex}
- Font for headlines: {headline_font}
- Photography style: {photography_style_description}
- Voice/tone for any text in the image: {voice_description}
- Banned words (must not appear): {banned_words_list}

PROMPT:
{user_prompt}
```

### One image per call

Make one API call per image, not batch requests. Nano Banana 2 returns one image per call. Batch requests don't work and will silently produce inconsistent results.

### Filename conventions

Save images using the naming convention from brand-kit.md:
```
[brand]_[objective]_[hook]_[persona]_[style]_[version]_[date].png
```

Default save location: `./output/[concept-name].png`

For aspect ratio variations, append the ratio:
```
[concept-name]_1x1.png  (1:1 square)
[concept-name]_4x5.png  (4:5 vertical, Meta feed)
[concept-name]_9x16.png (9:16 stories/reels)
```

### Cost estimation before batch runs

Before generating more than 5 images, show the user a cost estimate:
```
About to generate [N] images at [resolution] resolution.
Estimated cost: $[N * price_per_image]
Continue? (y/n)
```

After every 8 images in a batch, show running cost total.

---

## Slash Commands

### `/generate-ads-batch [matrix-file]`

Read a creative matrix JSON file and generate all images in sequence.

**Usage:**
```
/generate-ads-batch ./creative-matrix.json
```

**Workflow:**
1. Read the creative matrix file
2. Show cost estimate
3. Wait for confirmation
4. For each concept in the matrix:
   - Build the full prompt (brand context + concept-specific prompt + static-ad-designer rules)
   - Call Nano Banana 2 API
   - Save the returned image to `./output/[concept-name].png`
   - Generate both 1:1 and 4:5 versions
5. After every 8 images, show progress + running cost
6. At end, show contact sheet (grid of all generated images)

### `/regenerate [concept-name]`

Regenerate a single image with new instructions.

**Usage:**
```
/regenerate vitapure_sales_problem_sarah_minimal_v1
> "Make the background warmer, less stark white. Add subtle paper texture."
```

### `/upscale-finals`

Take user-selected concepts and regenerate them at 2K resolution for production use.

**Usage:**
```
/upscale-finals vitapure_sales_problem_sarah_minimal_v1, vitapure_sales_benefit_marcus_lifestyle_v1
```

Saves to `./output/final/` directory.

### `/generate-variations [concept-name]`

Generate 3 variations of a single concept with the same hook and persona but different visual treatment.

**Usage:**
```
/generate-variations vitapure_sales_problem_sarah_minimal_v1
```

---

## Common Issues and Fixes

### "Text in the image is illegible"

Add to the prompt:
```
TEXT REQUIREMENTS:
- All text must be at least 48px equivalent
- Add a solid or semi-transparent panel behind any headline text
- Use brand headline font: {headline_font}
- Maintain WCAG AA contrast (4.5:1 minimum) between text and its background
```

### "Colors don't match brand"

Strengthen the color enforcement:
```
COLOR REQUIREMENTS (strict):
- Background: must be exactly {background_hex}
- Headline color: must be exactly {primary_hex}
- CTA button: must be exactly {accent_hex}
- Do not use any colors not in the brand palette
```

### "Image looks like generic AI slop"

Update the static-ad-designer skill (not this one) — slop is usually a strategy/composition problem, not a generation problem. But for one-off fixes, add:
```
ANTI-SLOP REQUIREMENTS:
- No stock-photo aesthetic (no overly polished, generic smiling people)
- No cluttered layouts (max 3 visual elements per frame)
- No tiny text that's unreadable in a feed scroll
- Asymmetric composition preferred over centered
- Real-world textures over flat gradients
```

### "Character or product looks different across batch"

For multi-image batches that need consistency:
```
CONSISTENCY REQUIREMENTS:
- Character description (use exact text in every prompt): {character_description}
- Product reference: attach the same reference image to every call
- Lighting direction: {direction} (must be identical across all images)
- Color palette: pulled from brand-kit.md (no deviations)
```

---

## Cross-Skill Integration

When the static-ad-designer skill calls this skill:
1. Static ad designer provides the strategic prompt (hook, persona, visual concept)
2. This skill prepends brand context from brand-kit.md
3. This skill makes the API call
4. This skill saves the image with the correct naming convention
5. This skill returns the file path back to static-ad-designer

When the animation-ads skill calls this skill:
- Same flow, but generates frames as part of a 3x3 grid for storyboard consistency
- See animation-ads-skill.md for grid prompt structure

When the creative-strategist skill (Pillar 3) recommends new concepts:
- It outputs a new creative matrix
- User runs `/generate-ads-batch [new-matrix.json]` and the loop continues

---

## Output Format

After generation, return:

```
Generated [N] images.
Saved to: ./output/

Cost: $[total]
Time: [seconds]

Concepts generated:
- [concept-name-1] (1:1, 4:5)
- [concept-name-2] (1:1, 4:5)
...

Next steps:
1. Review images in ./output/
2. Pick top 10-15 winners
3. Run /generate-variations on winners for additional testing
4. Run /upscale-finals on final selections for production use
5. Upload to Meta Ads Creative Library
6. Use Pillar 2 (Bulk Uploader) to push to Ads Manager
```

---

## Notes

- This skill assumes Nano Banana 2 (model ID `google/gemini-3.1-flash-image-preview`). Update the model ID when Nano Banana 3 launches. The API structure is unlikely to change.
- OpenRouter pricing fluctuates monthly. Verify current pricing at openrouter.ai/google/gemini-3.1-flash-image-preview before quoting costs to clients.
- For agency use with multiple client accounts, use a separate OpenRouter project per client to track costs separately.
