generate-image
Generate images using Google Gemini API. Use when user asks to generate, create, or make images, pictures, photos, or visual content. Also for editing images, image-to-image generation, or any AI image creation requests.
What this skill does
# Gemini Image Generation
Generate high-quality AI images using Google's Gemini API.
## Before First Use
Run the setup check to validate environment:
```bash
"${CLAUDE_PLUGIN_ROOT}/skills/generate-image/scripts/check-setup.sh"
```
This validates Python, venv, dependencies, API key, and shows existing images.
## Generation
```bash
SCRIPT_DIR="${CLAUDE_PLUGIN_ROOT}/skills/generate-image/scripts"
"$SCRIPT_DIR/generate.sh" "your detailed prompt" \
--aspect-ratio 16:9 \
--resolution 4K \
--output images/slug-v1/image.png \
--user-request "user's original request verbatim" \
--composition "your reasoning: why you chose this style, composition, colors, etc."
```
**Options:**
- `--aspect-ratio`: 1:1, 3:4, 4:3, 2:3, 3:2, 16:9, 9:16, 21:9, 9:21, 32:9, 2:1 (default: 1:1)
- `--resolution`: 1K, 2K, 4K (default: 2K)
- `--output`: Output filename (default: output.png)
- `--fast`: Use faster model (lower quality)
- `--images`: Reference image(s) for editing/fusion
- `--user-request`: Original user request (ALWAYS pass this)
- `--composition`: Your reasoning/composition notes explaining prompt choices (ALWAYS pass this)
- `--no-metadata`: Skip saving metadata YAML file
**Output:** The script saves `{image_name}_metadata.yaml` alongside the image containing: user request, composition reasoning, final prompt, all parameters, token usage, timestamps, and model response.
## Invocation Modes
**Interactive** (no prompt or vague prompt): Use AskUserQuestion to gather subject, style, aspect ratio, quality.
**Direct** (detailed prompt provided): Execute immediately with sensible defaults.
**Programmatic** (called from workflow): Never block, use defaults, execute immediately.
## Workflow
1. **Check setup**: Run `check-setup.sh` script (especially on first use or errors)
2. **Determine mode**: Interactive vs direct based on prompt clarity
3. **Capture user request**: Save the user's original request verbatim for `--user-request`
4. **Compose prompt**: Enhance the request into a detailed prompt, document your reasoning for `--composition`
5. **Generate slug**: 2-4 word description, lowercase, hyphenated (e.g., `sunset-mountains`)
6. **Check existing**: Look for `images/{slug}-v*` folders for iterations
7. **Generate**: Run script with ALL context flags (`--user-request`, `--composition`)
8. **Report**: Show user the result location and version (metadata auto-saved as `image_metadata.yaml`)
## Interactive Questions (when prompt is vague)
When the user's request lacks detail, use AskUserQuestion to gather:
- **Subject**: Person/Portrait, Product, Landscape/Scene, or Abstract/Artistic
- **Purpose**: Final/Production (4K), Testing/Draft (fast mode), or Web/Social (2K)
- **Style details**: Lighting, colors, mood if relevant
## Iteration Detection
User wants iteration when they say: "another version", "adjust", "modify", "change", "try with", "regenerate".
Find latest version, increment, archive previous in `archive/v{N}/`.
## Transparent Background Requests
**Gemini cannot generate transparent images.** All generated images have a solid background.
When the user wants transparency, use a two-step process: generate with a **chroma key background**, then remove it with the `image-tools:manipulate-image` skill afterwards.
### Step 1 — Analyze subject colors BEFORE choosing chroma key
**MANDATORY**: Before picking a chroma key color, list every color the subject will contain. Think through:
- Skin/body color (e.g., grey hippo, brown dog, pink flamingo)
- Clothing colors (shirt, pants, shoes, accessories)
- Hair/bow/hat colors
- Object colors (bike, tools, props)
- Style colors (cartoon outlines are typically black)
Then pick the chroma key that has **zero overlap** with any of those colors.
### Step 2 — Pick from the chroma key palette
| Chroma Key | Exact RGB | Hex | Gemini keyword | Use when subject does NOT contain |
|------------|-----------|-----|----------------|-----------------------------------|
| **Green** | `RGB(0, 255, 0)` | `#00FF00` | "chroma key green" | Green, lime, emerald, forest tones |
| **Magenta** | `RGB(255, 0, 255)` | `#FF00FF` | "chroma key magenta" | Pink, purple, magenta, violet, fuchsia tones |
| **Blue** | `RGB(0, 0, 255)` | `#0000FF` | "chroma key blue" | Blue, sky blue, navy, cyan, teal tones |
| **Yellow** | `RGB(255, 255, 0)` | `#FFFF00` | "chroma key yellow" | Yellow, gold, blonde, sunshine, amber tones |
**Selection rules:**
1. List ALL expected subject colors first
2. Eliminate any chroma key that overlaps with subject colors
3. From remaining options, pick the one with maximum hue distance from the subject's dominant color
4. **Green is the safest default** — most cartoon/illustration subjects don't contain bright lime green
5. **Never use magenta** for subjects with pink, purple, or magenta clothing/accessories
6. **Never use blue** for sky scenes, water, or subjects wearing blue
7. **Never use yellow** for warm-lit scenes, blonde hair, or gold elements
8. Document your color analysis in the `--composition` flag
### Step 3 — Generate with chroma key prompt
Append this **exact block** to the end of your prompt (replace `[COLOR]`, `[R,G,B]`, `[HEX]`):
```
The subject is placed on a chroma key [COLOR] studio backdrop (RGB [R,G,B], hex [HEX]). Plain studio setting with soft, diffused lighting on the subject only. The background is a perfectly flat, uniform solid [COLOR] with no gradients, no shadows, no texture, no patterns, no depth of field, no bokeh. Every pixel of the background must be the same [COLOR] color (RGB [R,G,B], #[HEX]) from edge to edge with zero variation.
```
**Example for green chroma key:**
```
The subject is placed on a chroma key green studio backdrop (RGB 0,255,0, hex #00FF00). Plain studio setting with soft, diffused lighting on the subject only. The background is a perfectly flat, uniform solid green with no gradients, no shadows, no texture, no patterns, no depth of field, no bokeh. Every pixel of the background must be the same green color (RGB 0,255,0, #00FF00) from edge to edge with zero variation.
```
### Step 4 — Remove background (post-processing)
Gemini won't produce exact RGB values, so always sample the actual corner pixel, then use the manipulate-image scripts directly to remove the background and trim.
```bash
VENV="${CLAUDE_PLUGIN_ROOT}/scripts/venv"
MANIPULATE="${CLAUDE_PLUGIN_ROOT}/skills/manipulate-image/scripts"
# 1. Sample actual background color from corner
"$VENV/bin/python" -c "from PIL import Image; print(Image.open('<image>').getpixel((0,0)))"
# 2. Remove chroma key with HSV detection + spill suppression
"$MANIPULATE/run.sh" alpha <image> --transparent "<actual R,G,B>" --tolerance 15 --feather 40 -o <output>
# 3. Trim empty space
"$MANIPULATE/run.sh" trim <output> -o <final>
```
### When to use this
User mentions "transparent", "no background", "PNG with alpha", "cutout", or "sticker". **Always tell the user** you're using a chroma key approach since the result won't be transparent until the second step.
## Reference
For detailed setup, troubleshooting, prompt engineering, and file templates, see [SETUP.md](SETUP.md).
Related in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.