skills/gemini-image-gen/SKILL.md
--- name: gemini-image-gen description: Image generation with Google Gemini API. Models: gemini-2.5-flash-image (fast) or gemini-3-pro-image-preview (quality). For social media graphics, marketing, infographics. --- # Gemini Image Generation Generate images directly from Claude Code CLI using Google's Gemini API. ## Setup **API Key:** https://aistudio.google.com/apikey **Environment Variable:** `GOOGLE_AI_API_KEY` **Install:** `pip install google-genai pillow python-dotenv` ## Basic Usage
npx skillsauth add svenja-dev/claude-code-skills skills/gemini-image-genInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate images directly from Claude Code CLI using Google's Gemini API.
API Key: https://aistudio.google.com/apikey
Environment Variable: GOOGLE_AI_API_KEY
Install: pip install google-genai pillow python-dotenv
import os
from google import genai
client = genai.Client(api_key=os.environ.get("GOOGLE_AI_API_KEY"))
response = client.models.generate_content(
model="gemini-2.5-flash-image", # Fast
# model="gemini-3-pro-image-preview", # Quality
contents=["Your image prompt here"]
)
# Extract and save image from response
for part in response.candidates[0].content.parts:
if hasattr(part, 'inline_data') and part.inline_data:
with open("output.png", "wb") as f:
f.write(part.inline_data.data)
| Model | Speed | Quality | Use Case |
|-------|-------|---------|----------|
| gemini-2.5-flash-image | Fast (~5s) | Good | Drafts, iterations |
| gemini-3-pro-image-preview | Slower (~15s) | Excellent | Final assets |
prompt = """
Create a professional manufacturing OEE dashboard showing:
- Large OEE gauge at 85% (green zone)
- Three smaller KPI cards below:
- Availability: 92%
- Performance: 88%
- Quality: 99.2%
- Dark theme with blue/cyan accents
- Modern, executive-style design
"""
response = client.models.generate_content(
model="gemini-3-pro-image-preview",
contents=[prompt]
)
When embedding in PowerPoint, compress images to avoid silent failures:
from PIL import Image
import io
def compress_image(data: bytes, max_size_kb: int = 200) -> bytes:
img = Image.open(io.BytesIO(data))
img = img.convert('RGB')
img.thumbnail((1280, 720))
buffer = io.BytesIO()
img.save(buffer, format='JPEG', quality=75, optimize=True)
return buffer.getvalue()
At fabrikIQ.com, Gemini Image Generation powers:
development
Protects design and theme files from unintended changes. Locks tailwind.config, global CSS, and theme variables. Requires explicit confirmation before modifying UI components. Activate on changes to CSS, theme config, or layout components.
tools
Proactive token budget assessment and task chunking strategy. Use this skill when queries involve multiple large file uploads, requests for comprehensive multi-document analysis, complex multi-step workflows with heavy research (10+ tool calls), phrases like "complete analysis", "full audit", "thorough review", "deep dive", or tasks combining extensive research with large output artifacts. This skill helps assess token consumption risk early and recommend chunking strategies before beginning work.
development
Erzwingt striktes Test-Driven Development mit Red-Green-Refactor Zyklus. Blockiert Code-Generierung ohne vorherige Tests. Dokumentiert 13 ungueltige Rationalisierungen. Aktivieren bei neuen Features, Bug Fixes, Refactoring.
development
Enforces TypeScript best practices when writing code. Automatically enables strict typing for TypeScript projects, prevents `any` usage, and recommends generic constraints. Activate on TS/TSX files, new features, code reviews.