image-generation
zc277584121/marketing-skills
Generate illustration images for articles and documentation with multi-provider fallback support.
What is image-generation?
Generates illustration images for blog posts, documentation, and technical articles using a provider-aware workflow. Tries Codex built-in image generation first, then falls back to OpenAI API, then Gemini API. Use this when you need visual explanations, diagrams, or concept illustrations for technical content.
- Generates illustrations, diagrams, and concept images optimized for technical articles
- Automatically selects the best available provider: Codex built-in, OpenAI API, or Gemini API
- Applies a clean, minimalist flat illustration style by default with customizable style options
- Supports multiple aspect ratios (1:1, 16:9, 9:16, etc.) and image sizes (512px to 4K)
- Intelligently determines output path based on project structure and existing image directories
- Includes prompt engineering guidance for architecture diagrams, flow charts, and concept illustrations
How to install image-generation
npx skills add https://github.com/zc277584121/marketing-skills --skill image-generation- For Codex path: Codex agent with built-in image_gen tool available
- For OpenAI API fallback: OPENAI_API_KEY environment variable set
- For Gemini fallback: GEMINI_API_KEY environment variable set
- Python 3.7+ (for script-based generation)
How to use image-generation
- 1.Clarify what needs to be illustrated (concept, architecture, flow, or scene) and any style preferences
- 2.If using Codex built-in: read references/codex-built-in.md and use the built-in tool directly
- 3.If using script fallback: run python scripts/generate_image.py with --prompt and --output parameters
- 4.Craft a specific prompt describing visual elements, relationships, and layout (style prefix auto-applied)
- 5.Specify any non-default parameters like aspect ratio (default 16:9), image size (default 1K), or custom style
- 6.Verify the generated image matches requirements; refine and regenerate if needed with targeted prompt changes
- 7.Insert the image into markdown using  syntax
Use cases
- Generate architecture diagrams showing system components and data flow for technical documentation
- Create concept comparison illustrations (e.g., keyword search vs semantic search) for blog articles
- Produce workflow diagrams with labeled steps and directional arrows for tutorials
- Generate visual explanations of abstract technical concepts for educational content
- Create icon-based component diagrams for system design documentation
- Technical writers creating documentation with visual explanations
- Blog authors writing technical articles that need supporting illustrations
- Software architects documenting system designs and data flows
- Developers building educational content or tutorials
- Content creators needing quick, consistent visual assets for technical topics
image-generation FAQ
The skill uses a fallback chain: Codex built-in tool first (if available), then OpenAI API (if OPENAI_API_KEY is set), then Gemini (if GEMINI_API_KEY is set). The script auto-selects the first available provider.
No. The Codex built-in path uses the built-in image_gen tool and does not require OPENAI_API_KEY or GEMINI_API_KEY.
Aspect ratios include 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 9:16, 16:9, 21:9, and others. Image sizes are 512px, 1K, 2K, and 4K. Default is 16:9 landscape at 1K.
Yes. Use --style-prefix "your style description" to replace the default style, or --no-style to skip style prepending entirely.
The skill prioritizes: (1) same directory as existing images in the current article, (2) existing project image directories (images/, assets/, static/), or (3) current working directory with a descriptive filename.
Full instructions (SKILL.md)
Source of truth, from zc277584121/marketing-skills.
name: image-generation description: Generate illustration images for articles and documentation with a Codex-first workflow, OpenAI API fallback, and Gemini fallback.
Image Generation Skill
Generate illustration images for blog posts, documentation, and technical articles. The workflow is provider-aware:
- Codex built-in path first — when the current agent is Codex and the built-in
image_gentool is available, use it directly. This path does not requireOPENAI_API_KEY. - OpenAI API fallback — outside Codex, or when the built-in tool is unavailable, use the local script with
OPENAI_API_KEYif present. - Gemini fallback — if OpenAI API generation is unavailable or fails, use the same script with
GEMINI_API_KEYand the existing Gemini image model.
Load provider-specific references only when needed:
- Codex built-in path:
references/codex-built-in.md - OpenAI API fallback:
references/openai-api.md - Gemini fallback:
references/gemini-api.md
When to Use
- User asks to generate an illustration, diagram, concept image, article visual, or documentation visual
- User is writing an article and needs visual explanations for concepts or workflows
- User explicitly asks for a generated raster image
Step 1: Determine the Image Requirements
Before generating, clarify only what is necessary:
- What to illustrate — the concept, architecture, flow, or scene
- Language — default to English for both prompt and text in image. Only use another language if the user explicitly requests it
- Save location — see "Output Path" below
- Style/color preferences — if user has specific needs, use them; otherwise use the default style
Step 2: Select the Provider Path
Path A: Codex Built-In
Use this path when:
- The current agent is Codex
- The built-in
image_gentool is available - The user did not explicitly request API/CLI execution
Read references/codex-built-in.md, generate with the built-in tool, then move/copy the final image into the workspace if it is project-bound.
Path B: Script Auto Fallback
Use this path when:
- The current agent is not Codex
- The built-in tool is unavailable
- The user explicitly asks for API/CLI execution
Run:
python <skill-root>/scripts/generate_image.py \
--prompt "your prompt here" \
--output "/path/to/save/image.png"
The script uses --provider auto by default:
- Try OpenAI API when
OPENAI_API_KEYis set - If OpenAI API fails or is not configured, try Gemini when
GEMINI_API_KEYis set - If neither credential is available, report the missing environment variables
Step 3: Craft the Prompt
Default Style Prefix
The script automatically prepends this style prefix unless --style-prefix or --no-style is used:
Use a clean, modern color palette with soft tones. Minimalist flat illustration style with clear visual hierarchy. Professional and polished look suitable for technical blog articles. No photorealistic rendering. No excessive gradients or shadows.
For the Codex built-in path, include the same style guidance directly in the prompt unless the user requested a different style.
Prompt Writing Guidelines
- Be specific about visual elements, relationships, and layout
- For technical concepts: describe the components and how they connect
- For architecture diagrams: list the layers/components and data flow direction
- For flow diagrams: describe the steps and direction of flow
- If text labels are needed in the image, spell them out explicitly and keep text short
- Default language is English; use another language only when requested
Example Prompts
Architecture diagram:
A system architecture diagram showing: User sends query to an API Gateway,
which routes to a Vector Database labeled "Milvus" and a generation service.
The Vector Database returns relevant documents, which are combined with the
original query and sent to the generation service for final response generation.
Arrows show data flow direction. Each component is a rounded rectangle with
an icon and label.
Concept illustration:
A visual comparison of keyword search vs semantic search. Left side shows
keyword search with exact word matching and highlighted matching words.
Right side shows semantic search with a brain icon understanding meaning
and connecting related concepts with dotted lines. A dividing line separates
the two approaches.
Step 4: Parameters
Default Parameters
| Parameter | Default | Notes |
|---|---|---|
| Provider | auto in script; Codex built-in when available | Codex built-in first, then OpenAI API, then Gemini |
| OpenAI model | gpt-image-2 | Used by script fallback |
| Gemini model | gemini-3.1-flash-image | Used by script fallback |
| Aspect ratio | 16:9 | Landscape, ideal for article illustrations |
| Image size | 1K | Good balance of quality and cost |
| Style | Minimal, clean, soft tones | Auto-prepended by script |
| Language | English | Prompt and in-image text |
Script Options
--provider auto, openai, gemini
--model Provider model ID for the selected provider
--openai-model OpenAI model ID, default gpt-image-2
--gemini-model Gemini model ID, default gemini-3.1-flash-image
--aspect-ratio 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 9:16, 16:9, 21:9, etc.
--image-size 512, 1K, 2K, 4K
--openai-quality low, medium, high, auto
--style-prefix Custom style prefix
--no-style Skip default style prefix
When to Change Defaults
| Scenario | Change |
|---|---|
| Higher quality final asset | --image-size 2K or --openai-quality high |
| Portrait/vertical image | --aspect-ratio 3:4 or --aspect-ratio 9:16 |
| Square image | --aspect-ratio 1:1 |
| User has their own style | --style-prefix "your style" or --no-style |
| Non-English content | Write prompt in target language |
Step 5: Determine Output Path
Follow this priority order:
Priority 1: Context from Current Conversation
If the user is working on a specific markdown file or article:
- Check where existing images in that article are stored by looking for image references in the
.mdfile - Save the new image in the same directory as the existing images
- Use a descriptive filename that matches the existing naming convention
Example: if the article has , save to the same images/ directory.
Priority 2: Project Image Directory
If no specific article context but working within a project:
- Look for existing image directories:
images/,assets/,static/,img/,figures/ - Save in the most appropriate existing directory
- If none exists, create an
images/directory at the project root or under the relevant content directory
Priority 3: Fallback
If no clear project context:
- Save to the current working directory
- Use a descriptive filename:
concept-name-illustration.png
Step 6: Verify the Result
After generating:
- Read the image file to visually verify it matches the user's request
- If the result is not satisfactory, refine the prompt and regenerate once with targeted changes
- If the image will be inserted into a markdown file, suggest the markdown syntax:
 - Report which provider path was used and where the final file was saved
Related skills
More from zc277584121/marketing-skills and the wider catalog.

jupyter-notebook-writing
Write Milvus Jupyter notebooks using Markdown-first workflow with jupyter-switch conversion.

md-to-feishu
Convert Markdown files to Feishu documents with automatic image uploading and Mermaid diagram rendering.

mermaid-to-gif
Convert Mermaid diagrams to animated GIFs with context-aware animation styles (progressive, highlight-walk, pulse-flow, wave).

mermaid-to-image
Convert Mermaid diagram code blocks to PNG images using mermaid.ink API.

milvus-meme-sticker
Generate expressive Milvus-mascot sticker memes for developer communities without text or IP concerns.

raw-video-processing
Remove silent segments and speed up raw screen recordings with FFmpeg-based post-processing.