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.4user-invocable: true5allowed-tools: Read, Write, Edit, Bash, Grep, Glob6metadata:7 source: https://skillmd.com/skills/joshuashepherd/asset-generate8---910Generate an image asset using Nano Banana 2: $ARGUMENTS1112$ARGUMENTS should include:13- A description of the desired image (subject, mood, style)14- Optionally: asset type (hero, cover, thumbnail, social, og, banner)15- Optionally: aspect ratio, resolution, output path16- Optionally: reference image path(s) for style/subject matching17- Empty — ask the user what they want to generate1819## Before Starting20211. Confirm `GOOGLE_GENERATIVE_AI_API_KEY` is set in `.env.local` — if not, tell the user to add it222. Read `src/lib/config/tenant.config.ts` to understand the tenant brand context233. Read `src/app/globals.css` to understand the color palette and design tokens244. Determine the appropriate asset preset from the table below2526## Asset Presets2728| Asset Type | Aspect Ratio | Resolution | Thinking Mode | Typical Use |29|----------------|-------------|------------|---------------|--------------------------------------|30| `hero` | `16:9` | `2048` | `high` | Page hero backgrounds |31| `cover-course` | `16:9` | `2048` | `high` | Course cover images |32| `cover-book` | `3:4` | `2048` | `high` | Book cover images |33| `thumbnail` | `16:9` | `1024` | `minimal` | Card thumbnails for listings |34| `social` | `1:1` | `1024` | `minimal` | Social media square posts |35| `og` | `16:9` | `1024` | `minimal` | Open Graph / link preview images |36| `banner` | `4:1` | `2048` | `minimal` | Wide banners, email headers |37| `portrait` | `9:16` | `2048` | `high` | Mobile-first vertical images |38| `podcast` | `1:1` | `1024` | `minimal` | Podcast artwork |39| `avatar` | `1:1` | `512` | `minimal` | Profile images, small icons |4041If the user doesn't specify a type, infer from context or ask.4243## Prompt Construction — The Brief Method4445Structure 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.4647### 1. SUBJECT (Who/What)48Describe the primary subject with specificity. Name materials, textures, ages, expressions.49- BAD: "a church leader"50- GOOD: "a middle-aged man with warm brown skin and short grey hair, wearing a linen shirt, gesturing passionately while speaking"5152### 2. ACTION & RELATIONSHIPS (What's Happening)53Describe the scene dynamics — interaction between subjects, movement, energy.54- "leading a small group gathered in a circle on a sun-dappled patio"55- "hands resting on an open, well-worn Bible on a wooden table"5657### 3. SETTING (Where, When, Atmosphere)58Place, time of day, weather, mood, cultural context.59- "in a bright, airy community hall in Melbourne, Australia, mid-morning golden light streaming through floor-to-ceiling windows"60- "an intimate home gathering, warm evening lamplight, bookshelves visible in the background"6162### 4. STYLE & MEDIUM (Visual Language)63Name specific photographic or artistic references:64- **Photography**: "shot on Sony A7IV, 85mm f/1.4, shallow depth of field, natural light, warm color grading"65- **Illustration**: "watercolor illustration with visible brushstrokes, muted earth tones, editorial style"66- **Conceptual**: "minimalist flat illustration, geometric shapes, limited palette of warm terracotta and sage green"67- **Abstract**: "abstract texture, layered paper collage effect, warm amber and cream tones"6869### 5. COMPOSITION & CAMERA (Framing)70Shot type, angle, lens behavior, negative space:71- "medium close-up, slightly off-center composition with rule of thirds, shallow depth of field blurring the background"72- "wide establishing shot, low angle, dramatic sky in upper third"73- "overhead flat lay, centered symmetrical composition"7475## Brand Context for Alan Hirsch Platform7677Always incorporate these brand qualities unless the user specifies otherwise:7879### Tone & Mood80- **Warm, scholarly, missional** — not corporate, not clinical81- **Community-oriented** — images should feel inviting, relational, human82- **Formation-focused** — suggest growth, journey, transformation83- **Grounded in practice** — real settings, not stock-photo sterility8485### Color Affinity86- Warm earth tones: terracotta, amber, sage, cream, warm grey87- Accent with the platform's primary color (warm amber/gold)88- Avoid: cold blues, neon, high-saturation corporate palettes89- Dark mode assets: rich, warm darks (not pure black), warm highlights9091### Visual Motifs92- Open books, journals, handwritten notes93- Small group gatherings, circles, shared meals94- Urban neighborhoods, streets, community spaces95- Maps, pathways, journeys96- Natural textures: wood, linen, paper, stone9798## Execution99100### Step 1 — Compose the Prompt101Write the full NB2 prompt following the brief method above. Show it to the user for approval before generating.102103### Step 2 — Generate via Gemini API104Use the following script pattern (adapt as needed):105106```typescript107import { GoogleGenAI } from "@google/genai";108import * as fs from "fs";109import * as path from "path";110111const ai = new GoogleGenAI({ apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY });112113const result = await ai.models.generateImages({114 model: "imagen-4.0-generate-001", // Imagen 4.0115 prompt: "<THE_COMPOSED_PROMPT>",116 config: {117 numberOfImages: 4, // Generate 4 variations118 aspectRatio: "16:9", // From preset119 // resolution handled by model120 },121});122123// Save generated images124for (let i = 0; i < result.generatedImages.length; i++) {125 const img = result.generatedImages[i];126 const buffer = Buffer.from(img.image.imageBytes, "base64");127 const outPath = path.join("public/images/generated", `${slug}-${i + 1}.png`);128 fs.mkdirSync(path.dirname(outPath), { recursive: true });129 fs.writeFileSync(outPath, buffer);130}131```132133**IMPORTANT**: If the `@google/genai` package is not installed, install it first:134```bash135pnpm add @google/genai136```137138If the Imagen API is not available or the user prefers the Gemini multimodal approach, use:139```typescript140const response = await ai.models.generateContent({141 model: "gemini-2.5-flash-image", // or latest available142 contents: "<THE_COMPOSED_PROMPT>. Generate this as an image.",143 config: {144 responseModalities: ["image", "text"],145 },146});147148// Extract image parts from response149for (const part of response.candidates[0].content.parts) {150 if (part.inlineData) {151 const buffer = Buffer.from(part.inlineData.data, "base64");152 fs.writeFileSync(outPath, buffer);153 }154}155```156157### Step 3 — Save & Report158- Save images to `public/images/generated/<asset-type>/<slug>-<n>.png`159- Convert to WebP for production use if needed: use sharp or similar160- Report the file paths and let the user review161162## Output Format163164```165## Asset Generation Report166167### Prompt168> [The full prompt used]169170### Settings171- Model: nano-banana-2172- Aspect ratio: 16:9173- Resolution: 2048174- Thinking mode: high175- Variations: 4176177### Generated Files1781. public/images/generated/hero/forgotten-ways-1.png1792. public/images/generated/hero/forgotten-ways-2.png1803. public/images/generated/hero/forgotten-ways-3.png1814. public/images/generated/hero/forgotten-ways-4.png182183### Next Steps184- Review the generated images and select the best one185- Use `/asset-edit` to refine if needed186- Use `/asset-text-overlay` to add text if needed187```188189## Iterative Refinement190191If the first generation is close but not right, use NB2's conversational editing:192- "Make the lighting warmer and more golden"193- "Move the subject slightly to the left, more negative space on the right"194- "Reduce the saturation, make it feel more muted and scholarly"195196Do NOT re-prompt from scratch — refine iteratively.197198## Error Handling199200- Missing `GOOGLE_GENERATIVE_AI_API_KEY` → stop with instructions to add it to `.env.local`201- API rate limit → wait and retry once, then report202- Content policy block → adjust prompt (remove specific person references, etc.) and retry203- Generation failure → report error details and suggest prompt modifications