article-illustration-generator
9
总安装量
4
周安装量
#32461
全站排名
安装命令
npx skills add https://github.com/2898117012/agent-skills --skill article-illustration-generator
Agent 安装分布
opencode
4
codex
3
github-copilot
3
gemini-cli
3
amp
2
Skill 文档
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
google.genaiSDK to generate images. - Model:
gemini-2.5-flash-image(default, or user specified). - Config: Use
aspect_ratio="16:9"or4:3for article images.
-
HTML Construction:
- Use the HTML template provided in
assets/template.html(“æ é½çç§” style). - 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:
references/template.html: The HTML/CSS template with serif fonts and clean layout. Use this as the base for the output file.references/api_guide.md: Detailed documentation for the Nano Banana Pro (Gemini 3 Pro Image) API, which can be used for advanced image generation needs.references/script_template.py: A Python script template containing the API calling logic.
Usage Guide
When invoked, the agent should:
-
Check API Key Configuration:
- Use Bash to check if GOOGLE_API_KEY environment variable is set:
echo $GOOGLE_API_KEY(Linux/Mac) orecho %GOOGLE_API_KEY%(Windows). - 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 (
scripts/article_to_html.py) with appropriate parameters:- 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.