install
source · Clone the upstream repo
git clone https://github.com/NeverSight/learn-skills.dev
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/NeverSight/learn-skills.dev "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/skills-md/2898117012/agent-skills/article-illustration-generator" ~/.claude/skills/neversight-learn-skills-dev-article-illustration-generator && rm -rf "$T"
manifest:
data/skills-md/2898117012/agent-skills/article-illustration-generator/SKILL.mdsource content
Article Illustration Generator
This skill automatically generates relevant illustrations for a text article using the Gemini Image API and converts it into a visually appealing HTML file.
Workflow
-
API Key Check:
- First, check if the GOOGLE_API_KEY environment variable is set.
- If not set, use the AskUserQuestion tool to ask the user if they have configured their API key.
- If the user hasn't configured it, ask them to provide their Google API key.
- Store the API key for use in the script execution.
-
Input Analysis:
- Read the user's article text.
- Split the text into logical sections (paragraphs).
- Identify key scenes for illustration (aim for 1 image every 2-3 paragraphs).
-
Image Generation:
- For each identified scene, generate a descriptive prompt based on the text context.
- Use the
SDK to generate images.google.genai - Model:
(default, or user specified).gemini-2.5-flash-image - Config: Use
oraspect_ratio="16:9"
for article images.4:3
-
HTML Construction:
- Use the HTML template provided in
("故都的秋" style).assets/template.html - Insert the text and generated images (saved locally) into the HTML structure.
- Use the HTML template provided in
Resources
This skill includes reference files in the
references/ directory:
: The HTML/CSS template with serif fonts and clean layout. Use this as the base for the output file.references/template.html
: Detailed documentation for the Nano Banana Pro (Gemini 3 Pro Image) API, which can be used for advanced image generation needs.references/api_guide.md
: A Python script template containing the API calling logic.references/script_template.py
Usage Guide
When invoked, the agent should:
-
Check API Key Configuration:
- Use Bash to check if GOOGLE_API_KEY environment variable is set:
(Linux/Mac) orecho $GOOGLE_API_KEY
(Windows).echo %GOOGLE_API_KEY% - If empty or not set, use AskUserQuestion to ask: "您是否已经配置了 Google API Key?"
- Option 1: "是,已配置为环境变量" - Proceed with the script.
- Option 2: "否,我需要提供 API Key" - Ask for the API key and pass it as a command-line argument to the script.
- If the user provides an API key, store it temporarily for this execution.
- Use Bash to check if GOOGLE_API_KEY environment variable is set:
-
Read the target article provided by the user.
-
Plan the image insertion points.
-
Execute the Python script (
) with appropriate parameters:scripts/article_to_html.py- If API key was provided by user:
python scripts/article_to_html.py <article_file> <api_key> - If using environment variable:
python scripts/article_to_html.py <article_file> - Optional parameters:
,--images N
,--model MODEL
,--ratio RATIO--size SIZE
- If API key was provided by user:
-
Verify the result and inform the user of the output location.