Generate an image asset using Nano Banana 2: $ARGUMENTS
$ARGUMENTS should include:
- A description of the desired image (subject, mood, style)
- Optionally: asset type (hero, cover, thumbnail, social, og, banner)
- Optionally: aspect ratio, resolution, output path
- Optionally: reference image path(s) for style/subject matching
- Empty — ask the user what they want to generate
Before Starting
- Confirm
GOOGLE_GENERATIVE_AI_API_KEY is set in .env.local — if not, tell the user to add it
- Read
src/lib/config/tenant.config.ts to understand the tenant brand context
- Read
src/app/globals.css to understand the color palette and design tokens
- Determine the appropriate asset preset from the table below
Asset Presets
| Asset Type |
Aspect Ratio |
Resolution |
Thinking Mode |
Typical Use |
hero |
16:9 |
2048 |
high |
Page hero backgrounds |
cover-course |
16:9 |
2048 |
high |
Course cover images |
cover-book |
3:4 |
2048 |
high |
Book cover images |
thumbnail |
16:9 |
1024 |
minimal |
Card thumbnails for listings |
social |
1:1 |
1024 |
minimal |
Social media square posts |
og |
16:9 |
1024 |
minimal |
Open Graph / link preview images |
banner |
4:1 |
2048 |
minimal |
Wide banners, email headers |
portrait |
9:16 |
2048 |
high |
Mobile-first vertical images |
podcast |
1:1 |
1024 |
minimal |
Podcast artwork |
avatar |
1:1 |
512 |
minimal |
Profile images, small icons |
If the user doesn't specify a type, infer from context or ask.
Prompt Construction — The Brief Method
Structure every prompt using this 5-part brief. Write in natural, descriptive language — NOT keyword soup. NB2 is a reasoning model that understands intent, physics, and composition.
1. SUBJECT (Who/What)
Describe the primary subject with specificity. Name materials, textures, ages, expressions.
- BAD: "a church leader"
- GOOD: "a middle-aged man with warm brown skin and short grey hair, wearing a linen shirt, gesturing passionately while speaking"
2. ACTION & RELATIONSHIPS (What's Happening)
Describe the scene dynamics — interaction between subjects, movement, energy.
- "leading a small group gathered in a circle on a sun-dappled patio"
- "hands resting on an open, well-worn Bible on a wooden table"
3. SETTING (Where, When, Atmosphere)
Place, time of day, weather, mood, cultural context.
- "in a bright, airy community hall in Melbourne, Australia, mid-morning golden light streaming through floor-to-ceiling windows"
- "an intimate home gathering, warm evening lamplight, bookshelves visible in the background"
4. STYLE & MEDIUM (Visual Language)
Name specific photographic or artistic references:
- Photography: "shot on Sony A7IV, 85mm f/1.4, shallow depth of field, natural light, warm color grading"
- Illustration: "watercolor illustration with visible brushstrokes, muted earth tones, editorial style"
- Conceptual: "minimalist flat illustration, geometric shapes, limited palette of warm terracotta and sage green"
- Abstract: "abstract texture, layered paper collage effect, warm amber and cream tones"
5. COMPOSITION & CAMERA (Framing)
Shot type, angle, lens behavior, negative space:
- "medium close-up, slightly off-center composition with rule of thirds, shallow depth of field blurring the background"
- "wide establishing shot, low angle, dramatic sky in upper third"
- "overhead flat lay, centered symmetrical composition"
Brand Context for Alan Hirsch Platform
Always incorporate these brand qualities unless the user specifies otherwise:
Tone & Mood
- Warm, scholarly, missional — not corporate, not clinical
- Community-oriented — images should feel inviting, relational, human
- Formation-focused — suggest growth, journey, transformation
- Grounded in practice — real settings, not stock-photo sterility
Color Affinity
- Warm earth tones: terracotta, amber, sage, cream, warm grey
- Accent with the platform's primary color (warm amber/gold)
- Avoid: cold blues, neon, high-saturation corporate palettes
- Dark mode assets: rich, warm darks (not pure black), warm highlights
Visual Motifs
- Open books, journals, handwritten notes
- Small group gatherings, circles, shared meals
- Urban neighborhoods, streets, community spaces
- Maps, pathways, journeys
- Natural textures: wood, linen, paper, stone
Execution
Step 1 — Compose the Prompt
Write the full NB2 prompt following the brief method above. Show it to the user for approval before generating.
Step 2 — Generate via Gemini API
Use the following script pattern (adapt as needed):
import { GoogleGenAI } from "@google/genai";
import * as fs from "fs";
import * as path from "path";
const ai = new GoogleGenAI({ apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY });
const result = await ai.models.generateImages({
model: "imagen-4.0-generate-001", // Imagen 4.0
prompt: "<THE_COMPOSED_PROMPT>",
config: {
numberOfImages: 4, // Generate 4 variations
aspectRatio: "16:9", // From preset
// resolution handled by model
},
});
// Save generated images
for (let i = 0; i < result.generatedImages.length; i++) {
const img = result.generatedImages[i];
const buffer = Buffer.from(img.image.imageBytes, "base64");
const outPath = path.join("public/images/generated", `${slug}-${i + 1}.png`);
fs.mkdirSync(path.dirname(outPath), { recursive: true });
fs.writeFileSync(outPath, buffer);
}
IMPORTANT: If the @google/genai package is not installed, install it first:
pnpm add @google/genai
If the Imagen API is not available or the user prefers the Gemini multimodal approach, use:
const response = await ai.models.generateContent({
model: "gemini-2.5-flash-image", // or latest available
contents: "<THE_COMPOSED_PROMPT>. Generate this as an image.",
config: {
responseModalities: ["image", "text"],
},
});
// Extract image parts from response
for (const part of response.candidates[0].content.parts) {
if (part.inlineData) {
const buffer = Buffer.from(part.inlineData.data, "base64");
fs.writeFileSync(outPath, buffer);
}
}
Step 3 — Save & Report
- Save images to
public/images/generated/<asset-type>/<slug>-<n>.png
- Convert to WebP for production use if needed: use sharp or similar
- Report the file paths and let the user review
Output Format
## Asset Generation Report
### Prompt
> [The full prompt used]
### Settings
- Model: nano-banana-2
- Aspect ratio: 16:9
- Resolution: 2048
- Thinking mode: high
- Variations: 4
### Generated Files
1. public/images/generated/hero/forgotten-ways-1.png
2. public/images/generated/hero/forgotten-ways-2.png
3. public/images/generated/hero/forgotten-ways-3.png
4. public/images/generated/hero/forgotten-ways-4.png
### Next Steps
- Review the generated images and select the best one
- Use `/asset-edit` to refine if needed
- Use `/asset-text-overlay` to add text if needed
Iterative Refinement
If the first generation is close but not right, use NB2's conversational editing:
- "Make the lighting warmer and more golden"
- "Move the subject slightly to the left, more negative space on the right"
- "Reduce the saturation, make it feel more muted and scholarly"
Do NOT re-prompt from scratch — refine iteratively.
Error Handling
- Missing
GOOGLE_GENERATIVE_AI_API_KEY → stop with instructions to add it to .env.local
- API rate limit → wait and retry once, then report
- Content policy block → adjust prompt (remove specific person references, etc.) and retry
- Generation failure → report error details and suggest prompt modifications
1---2name: asset-generate3description: Generate image assets using Nano Banana 2 (Gemini Flash Image). Use when creating hero images, course covers, book covers, thumbnails, social cards, or any visual asset for the platform.4---56Generate an image asset using Nano Banana 2: $ARGUMENTS78$ARGUMENTS should include:9- A description of the desired image (subject, mood, style)10- Optionally: asset type (hero, cover, thumbnail, social, og, banner)11- Optionally: aspect ratio, resolution, output path12- Optionally: reference image path(s) for style/subject matching13- Empty — ask the user what they want to generate1415## Before Starting16171. Confirm `GOOGLE_GENERATIVE_AI_API_KEY` is set in `.env.local` — if not, tell the user to add it182. Read `src/lib/config/tenant.config.ts` to understand the tenant brand context193. Read `src/app/globals.css` to understand the color palette and design tokens204. Determine the appropriate asset preset from the table below2122## Asset Presets2324| Asset Type | Aspect Ratio | Resolution | Thinking Mode | Typical Use |25|----------------|-------------|------------|---------------|--------------------------------------|26| `hero` | `16:9` | `2048` | `high` | Page hero backgrounds |27| `cover-course` | `16:9` | `2048` | `high` | Course cover images |28| `cover-book` | `3:4` | `2048` | `high` | Book cover images |29| `thumbnail` | `16:9` | `1024` | `minimal` | Card thumbnails for listings |30| `social` | `1:1` | `1024` | `minimal` | Social media square posts |31| `og` | `16:9` | `1024` | `minimal` | Open Graph / link preview images |32| `banner` | `4:1` | `2048` | `minimal` | Wide banners, email headers |33| `portrait` | `9:16` | `2048` | `high` | Mobile-first vertical images |34| `podcast` | `1:1` | `1024` | `minimal` | Podcast artwork |35| `avatar` | `1:1` | `512` | `minimal` | Profile images, small icons |3637If the user doesn't specify a type, infer from context or ask.3839## Prompt Construction — The Brief Method4041Structure every prompt using this 5-part brief. Write in natural, descriptive language — NOT keyword soup. NB2 is a reasoning model that understands intent, physics, and composition.4243### 1. SUBJECT (Who/What)44Describe the primary subject with specificity. Name materials, textures, ages, expressions.45- BAD: "a church leader"46- GOOD: "a middle-aged man with warm brown skin and short grey hair, wearing a linen shirt, gesturing passionately while speaking"4748### 2. ACTION & RELATIONSHIPS (What's Happening)49Describe the scene dynamics — interaction between subjects, movement, energy.50- "leading a small group gathered in a circle on a sun-dappled patio"51- "hands resting on an open, well-worn Bible on a wooden table"5253### 3. SETTING (Where, When, Atmosphere)54Place, time of day, weather, mood, cultural context.55- "in a bright, airy community hall in Melbourne, Australia, mid-morning golden light streaming through floor-to-ceiling windows"56- "an intimate home gathering, warm evening lamplight, bookshelves visible in the background"5758### 4. STYLE & MEDIUM (Visual Language)59Name specific photographic or artistic references:60- **Photography**: "shot on Sony A7IV, 85mm f/1.4, shallow depth of field, natural light, warm color grading"61- **Illustration**: "watercolor illustration with visible brushstrokes, muted earth tones, editorial style"62- **Conceptual**: "minimalist flat illustration, geometric shapes, limited palette of warm terracotta and sage green"63- **Abstract**: "abstract texture, layered paper collage effect, warm amber and cream tones"6465### 5. COMPOSITION & CAMERA (Framing)66Shot type, angle, lens behavior, negative space:67- "medium close-up, slightly off-center composition with rule of thirds, shallow depth of field blurring the background"68- "wide establishing shot, low angle, dramatic sky in upper third"69- "overhead flat lay, centered symmetrical composition"7071## Brand Context for Alan Hirsch Platform7273Always incorporate these brand qualities unless the user specifies otherwise:7475### Tone & Mood76- **Warm, scholarly, missional** — not corporate, not clinical77- **Community-oriented** — images should feel inviting, relational, human78- **Formation-focused** — suggest growth, journey, transformation79- **Grounded in practice** — real settings, not stock-photo sterility8081### Color Affinity82- Warm earth tones: terracotta, amber, sage, cream, warm grey83- Accent with the platform's primary color (warm amber/gold)84- Avoid: cold blues, neon, high-saturation corporate palettes85- Dark mode assets: rich, warm darks (not pure black), warm highlights8687### Visual Motifs88- Open books, journals, handwritten notes89- Small group gatherings, circles, shared meals90- Urban neighborhoods, streets, community spaces91- Maps, pathways, journeys92- Natural textures: wood, linen, paper, stone9394## Execution9596### Step 1 — Compose the Prompt97Write the full NB2 prompt following the brief method above. Show it to the user for approval before generating.9899### Step 2 — Generate via Gemini API100Use the following script pattern (adapt as needed):101102```typescript103import { GoogleGenAI } from "@google/genai";104import * as fs from "fs";105import * as path from "path";106107const ai = new GoogleGenAI({ apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY });108109const result = await ai.models.generateImages({110 model: "imagen-4.0-generate-001", // Imagen 4.0111 prompt: "<THE_COMPOSED_PROMPT>",112 config: {113 numberOfImages: 4, // Generate 4 variations114 aspectRatio: "16:9", // From preset115 // resolution handled by model116 },117});118119// Save generated images120for (let i = 0; i < result.generatedImages.length; i++) {121 const img = result.generatedImages[i];122 const buffer = Buffer.from(img.image.imageBytes, "base64");123 const outPath = path.join("public/images/generated", `${slug}-${i + 1}.png`);124 fs.mkdirSync(path.dirname(outPath), { recursive: true });125 fs.writeFileSync(outPath, buffer);126}127```128129**IMPORTANT**: If the `@google/genai` package is not installed, install it first:130```bash131pnpm add @google/genai132```133134If the Imagen API is not available or the user prefers the Gemini multimodal approach, use:135```typescript136const response = await ai.models.generateContent({137 model: "gemini-2.5-flash-image", // or latest available138 contents: "<THE_COMPOSED_PROMPT>. Generate this as an image.",139 config: {140 responseModalities: ["image", "text"],141 },142});143144// Extract image parts from response145for (const part of response.candidates[0].content.parts) {146 if (part.inlineData) {147 const buffer = Buffer.from(part.inlineData.data, "base64");148 fs.writeFileSync(outPath, buffer);149 }150}151```152153### Step 3 — Save & Report154- Save images to `public/images/generated/<asset-type>/<slug>-<n>.png`155- Convert to WebP for production use if needed: use sharp or similar156- Report the file paths and let the user review157158## Output Format159160```161## Asset Generation Report162163### Prompt164> [The full prompt used]165166### Settings167- Model: nano-banana-2168- Aspect ratio: 16:9169- Resolution: 2048170- Thinking mode: high171- Variations: 4172173### Generated Files1741. public/images/generated/hero/forgotten-ways-1.png1752. public/images/generated/hero/forgotten-ways-2.png1763. public/images/generated/hero/forgotten-ways-3.png1774. public/images/generated/hero/forgotten-ways-4.png178179### Next Steps180- Review the generated images and select the best one181- Use `/asset-edit` to refine if needed182- Use `/asset-text-overlay` to add text if needed183```184185## Iterative Refinement186187If the first generation is close but not right, use NB2's conversational editing:188- "Make the lighting warmer and more golden"189- "Move the subject slightly to the left, more negative space on the right"190- "Reduce the saturation, make it feel more muted and scholarly"191192Do NOT re-prompt from scratch — refine iteratively.193194## Error Handling195196- Missing `GOOGLE_GENERATIVE_AI_API_KEY` → stop with instructions to add it to `.env.local`197- API rate limit → wait and retry once, then report198- Content policy block → adjust prompt (remove specific person references, etc.) and retry199- Generation failure → report error details and suggest prompt modifications