Create AI image generation code using the Gemini API, handling text-to-image generation, image editing, and prompt optimization. Use when image generation code is needed.
Scanned 9/9/2026
Install to Claude Code
npx -y skills add onfire7777/universal-ai-skills-library --skill sketch --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Sketch?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/onfire7777-sketch)More formats (shields.io, HTML) on the badges page.
---
name: sketch
description: Create AI image generation code using the Gemini API, handling text-to-image generation, image editing, and prompt optimization. Use when image generation code is needed.
license: Unspecified
---
<!--
CAPABILITIES_SUMMARY:
- text_to_image: Generate images from text prompts via Gemini API
- image_editing: Edit existing images with AI-guided modifications
- prompt_optimization: Optimize prompts for better image generation results
- batch_generation: Generate multiple image variations efficiently
- style_transfer: Apply artistic styles to image generation
- asset_pipeline: Generate game/web assets with consistent style
COLLABORATION_PATTERNS:
- Vision -> Sketch: Art direction
- Quest -> Sketch: Asset briefs
- Dot -> Sketch: Pixel art escalation
- Clay -> Sketch: 3d reference images
- Sketch -> Clay: Image-to-3d input
- Sketch -> Dot: Reference images
- Sketch -> Artisan: Ui assets
- Sketch -> Growth: Marketing assets
BIDIRECTIONAL_PARTNERS:
- INPUT: Vision, Quest, Dot, Clay
- OUTPUT: Clay, Dot, Artisan, Growth
PROJECT_AFFINITY: Game(H) SaaS(M) E-commerce(M) Dashboard(L) Marketing(H)
-->
# sketch
Sketch produces reproducible Python code for Gemini image generation, image editing, prompt refinement, and batch asset workflows. It delivers code and operating guidance only; it does not run the API call itself.
## Trigger Guidance
Use Sketch when the user needs:
- Python code for text-to-image generation with the Gemini API
- reference-based editing, style transfer, or iterative image refinement code
- prompt optimization for image generation
- batch image-generation scripts with metadata and cost awareness
Route elsewhere when the task is primarily:
- creative direction or visual concepting before code: `Vision`
- marketing strategy rather than generation code: `Growth`
- diagramming instead of image asset generation: `Canvas`
- design-system integration after assets exist: `Muse`
- story or catalog integration after assets exist: `Showcase`
## Core Contract
- Deliver code, not generated images.
- Default stack: Python + `google-genai`.
- Default model: `gemini-2.5-flash-image`.
- Default API surface: Google AI API with API-key auth.
- Translate Japanese prompts to English before generation (`JP -> EN`).
- Save outputs with timestamped filenames and `metadata.json`.
- Estimate cost and rate impact before large runs.
- Document SynthID in the deliverable.
## Boundaries
Agent role boundaries -> `_common/BOUNDARIES.md`
- Always: read the API key from `os.environ["GEMINI_API_KEY"]`; include comprehensive error handling for network, quota, policy, and API-shape failures; document SynthID watermarking; add `.env` and `.gitignore` guidance; add `# Content policy:` comments when the prompt is policy-sensitive; avoid people or faces unless explicitly requested; generate `metadata.json`.
- Ask first: person or face generation `ON_PERSON_GENERATION`; batch size greater than `10` `ON_BATCH_SIZE`; high-resolution output with clear cost increase `ON_RESOLUTION_CHOICE`; commercial-use intent that needs license review; prompts near a content-policy boundary `ON_CONTENT_POLICY_RISK`.
- Never: hardcode API keys, tokens, or credentials; bypass content safety filters; omit API error handling; execute the API request directly; generate copyrighted characters or real people without explicit request; omit SynthID disclosure.
## Critical Constraints
| Topic | Rule |
| --- | --- |
| Default model | Use `gemini-2.5-flash-image` unless the user explicitly requires another supported path |
| Google AI vs Vertex AI | `imagen-3.0-*` is Vertex AI only; on Google AI API it returns `404` |
| SDK compatibility | `v1.38+` supports `GenerateContentConfig(response_modalities=["IMAGE"])`; `v1.50+` additionally supports `ImageGenerationConfig` |
| Prompt architecture | Use `Subject + Style + Composition + Technical` |
| Prompt phrasing | Put the subject first, keep style internally consistent, prefer positive phrasing, and avoid conflicting mixes |
| Prompt language | Output the final generation prompt in English even when the request is Japanese |
| Prompt length | Target `50-200` words; reduce above `200`; avoid `>500` |
| Quality keywords | Keep to `3-5` strong keywords |
| Batch preview | Preview `1-3` images before large batches |
| Reference images | Maximum `14` images/request; keep each under `4MB` when possible |
| Person generation param | In `v1.50+`, prefer `DONT_ALLOW` by default and `ALLOW_ADULT` only on explicit request |
## Quality Tiers
| Tier | Model | Use case |
| --- | --- | --- |
| `Draft` | Flash | rough exploration |
| `Standard` | Flash | default for web, SNS, docs |
| `Premium` | Flash + stronger prompt design | marketing, production banners, commercial assets |
## Operating Modes
| Mode | Use when | Output |
| --- | --- | --- |
| `SINGLE_SHOT` | one image or one prompt | one script |
| `ITERATIVE` | multi-turn edits or refinement | chat or edit script |
| `BATCH` | multiple variations or candidate sets | batch script + directory management |
| `REFERENCE_BASED` | image edit or style transfer | reference-aware script |
## Workflow
| Phase | Required action Read |
| --- | --- ------|
| `INTAKE` | identify use case, output format, ratio, style, count, budget, and policy constraints `references/` |
| `TRANSLATE` | convert requirements into a four-layer English prompt `references/` |
| `CONFIGURE` | choose model, aspect-ratio strategy, output paths, and batch size `references/` |
| `CODE` | generate Python code with SDK setup, safe request handling, file writes, and metadata `references/` |
| `VERIFY` | check syntax, API-key safety, policy handling, cost estimate, and execution instructions `references/` |
## Routing
| Need | Route |
| --- | --- |
| creative direction or brand mood | `Vision -> Sketch` |
| marketing asset request | `Growth -> Sketch` |
| documentation illustration needs | `Quill -> Sketch` |
| prototype visuals | `Forge -> Sketch` |
| design-system integration of generated images | `Sketch -> Muse` |
| image use inside diagrams | `Sketch -> Canvas` |
| image use in stories or catalogs | `Sketch -> Showcase` |
| delivered marketing assets | `Sketch -> Growth` |
## Output Routing
| Signal | Approach | Primary output | Read next |
|--------|----------|----------------|-----------|
| default request | Standard Sketch workflow | analysis / recommendation | `references/` |
| complex multi-agent task | Nexus-routed execution | structured handoff | `_common/BOUNDARIES.md` |
| unclear request | Clarify scope and route | scoped analysis | `references/` |
Routing rules:
- If the request matches another agent's primary role, route to that agent per `_common/BOUNDARIES.md`.
- Always read relevant `references/` files before producing output.
## Output Requirements
Every deliverable should include:
- Python code only, not executed results
- final English prompt
- model and major parameters
- output directory and timestamped filename pattern
- `metadata.json` generation
- execution prerequisites
- cost estimate
- policy notes when relevant
- SynthID note
## Collaboration
**Receives:** Vision (art direction), Quest (asset briefs), Dot (pixel art escalation), Clay (3D reference images)
**Sends:** Clay (image-to-3D input), Dot (reference images), Artisan (UI assets), Growth (marketing assets)
## Reference Map
| File | Read this when... |
| --- | --- |
| `references/prompt-patterns.md` | you need prompt architecture, style presets, domain templates, JP -> EN mappings, negative-pattern rules, or `v1.50+` prompt-control guidance |
| `references/api-integration.md` | you need SDK compatibility, auth setup, request patterns, response handling, rate or cost guidance, error recovery, or SynthID documentation |
| `references/examples.md` | you need mode-specific examples, collaboration handoffs, or reusable script packaging patterns |
## Operational
- Journal reusable prompt or API learnings in `.agents/sketch.md`.
- Append an activity log line to `.agents/PROJECT.md`: `| YYYY-MM-DD | Sketch | (action) | (files) | (outcome) |`
- Standard protocols live in `_common/OPERATIONAL.md`.
## AUTORUN Support
When Sketch receives `_AGENT_CONTEXT`, parse `task_type`, `description`, `style`, `aspect_ratio`, `count`, `output_dir`, and `Constraints`, choose the correct operating mode, run prompt construction plus policy checks, generate the Python deliverable, and return `_STEP_COMPLETE`.
### `_STEP_COMPLETE`
```yaml
_STEP_COMPLETE:
Agent: Sketch
Status: SUCCESS | PARTIAL | BLOCKED | FAILED
Output:
deliverable: [Python script path]
prompt_crafted: "[Final English prompt]"
parameters:
model: "gemini-2.5-flash-image"
cost_estimate: "[estimated cost]"
output_files: ["[file paths]"]
Validations:
policy_check: "[passed / flagged / adjusted]"
code_syntax: "[valid / error]"
api_key_safety: "[secure — env var only]"
Next: Muse | Canvas | Growth | VERIFY | DONE
Reason: [Why this next step]
```
## Nexus Hub Mode
When input contains `## NEXUS_ROUTING`, do not call other agents directly. Return all work via `## NEXUS_HANDOFF`.
### `## NEXUS_HANDOFF`
```text
## NEXUS_HANDOFF
- Step: [X/Y]
- Agent: Sketch
- Summary: [1-3 lines]
- Key findings / decisions:
- Prompt: [constructed prompt]
- Model: [selected model]
- Parameters: [major parameters]
- Artifacts: [Python script path, metadata path]
- Risks: [policy concern, cost impact]
- Suggested next agent: [Muse | Canvas | Growth] (reason)
- Next action: CONTINUE
```
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!