zhy-article-illustrator
Original:🇨🇳 Chinese
Translated
4 scripts
Use this skill when you need to illustrate Markdown articles with high-polish editorial visuals, visual bible planning, structured prompts, optional Qiniu Cloud upload, and insert image references into article publishing workflows.
3installs
Sourcezhylq/yuan-skills
Added on
NPX Install
npx skill4agent add zhylq/yuan-skills zhy-article-illustratorTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →zhy-article-illustrator
Purpose
Automatically plan and generate illustrations for any Markdown article. This skill uses "high-polish editorial visuals" as the default global quality baseline: not simple illustrations, not decorative icon collages, nor low-information-density sketches. The system first generates a unified visual bible for the article, then creates structured prompts for each image, ensuring all illustrations in the same article share a consistent stylistic language, while adjusting composition, information focus, and layout based on chapter content.
It is prioritized to be compatible with the Gemini Nano Banana workflow by default, and uses the Xiaomi Gemini compatible interface by default; it also supports Gemini native proxy/relay mode and the official Gemini interface.
When to Use
- User requests like "illustrate article", "add images to article"
- Called in Step 6 of the skill (
zhy-wechat-writing)with_illustrations=true - Users want to generate high-polish thematic visuals suitable for official account scenarios
- Users want to upload local images to Qiniu Cloud to get CDN URLs
Prerequisites
- The Markdown article file already exists
- At least one available image generation channel is configured:
- Official Gemini direct connection: or
GEMINI_API_KEYGOOGLE_API_KEY - Gemini native proxy/relay: ,
IMAGE_PROVIDER=gemini, optionalIMAGE_API_KEYIMAGE_BASE_URL - Xiaomi Gemini compatible interface: or
IMAGE_PROVIDER=xiaomi, optionalXIAOMI_API_KEYXIAOMI_BASE_URL - If upload is enabled: Qiniu Cloud configuration is ready (/
QINIU_ACCESS_KEY/QINIU_SECRET_KEY/QINIU_BUCKETin theQINIU_DOMAINfile at the skill root directory).env
- Official Gemini direct connection:
Workflow
Step 1: Analyze the Article
Goal: Understand the article structure, determine the number, positions, and expression methods of illustrations
Operations:
- Read the full content of
article_path - Parse the article structure: title, chapter headings (/
##), number of paragraphs, positions of code blocks### - Identify core information points:
- Key concepts/term explanations -> suitable for infographics
- Comparison/difference descriptions -> suitable for comparison charts
- Step/process descriptions -> suitable for flowcharts
- Architecture/framework descriptions -> suitable for architecture diagrams
- Data/statistics -> suitable for data visualizations
- Scene/narrative descriptions -> suitable for thematic illustrations or editorial scene images
- Determine the illustration strategy based on :
density- : Only add illustrations for 1-2 core information points
minimal - : Add one illustration for each major chapter at
balancedlevel## - : Add one illustration every ~300 words or for each important paragraph
rich
- Determine the :
slug- If the user provides : Use it directly
slug - Otherwise, derive a slug from the article's H1 title
kebab-case
- If the user provides
- Create the output directory:
{article_dir}/illustrations/{slug}/
Output: Article structure analysis results, list of illustration positions
Step 2: Generate Visual Bible and Illustration Plan
Goal: Establish a unified visual baseline for the entire article, and generate planning information for each illustration
Operations:
- First generate the article-level and save it to
visual_bible{article_dir}/illustrations/{slug}/visual-bible.md - The must cover:
visual_bible- : Uniformly adopt high-polish editorial visual/thematic illustration standards
quality_baseline - : Overall style direction of this article
visual_theme - : Primary color, secondary color, accent color, background tendency
color_system - : Graphic style, lines/materials/lighting, information hierarchy methods
graphic_language - : Page white space, module density, rhythm between title area and content area
layout_discipline - : Simplified Chinese by default; only terms in the
text_policyretain Englishenglish_terms_whitelist - : Prohibit simple drawings, childish cartoons, meaningless decorations, garbled English, random style mixing
negative_rules
- Then generate outline entries for each illustration position, which must include at least:
- : Insertion position (after which chapter/paragraph)
position - : What information this image needs to convey
purpose - : Comparison chart / Flowchart / Architecture diagram / Data visualization / Scene image / Editorial thematic visual
image_type - : The unique core expression of this image
core_message - : Content blocks that must appear in the frame
content_blocks - : Titles, labels, annotations needed in the image (Simplified Chinese by default)
text_blocks - : Subset of English terms allowed in this image
english_terms_used - : Layout direction and information partitioning
layout_hint - : Output filename (format:
filename)NN-brief-description.png - : Alt text for Markdown images
alt_text
- Save to
{article_dir}/illustrations/{slug}/outline.md - Simultaneously generate independent prompt files for each image, saved to
{article_dir}/illustrations/{slug}/prompts/
outline.md Format:
yaml
---
article: <article_path>
slug: <slug>
density: <density>
aspect_ratio: <ratio>
prompt_profile: <profile>
text_language: <language>
image_provider: <provider>
image_model: <model>
image_count: <N>
generated_at: <ISO timestamp>
---Output: ,
visual_bible_pathoutline_pathStep 3: Generate Images
Goal: Generate high-quality image files based on + outline
visual_bibleOperations:
- Construct structured prompts for each image, which must inherit:
- Global quality baseline: High-polish editorial visuals, not simple drawings
- Article-level
visual_bible - Single-image content plan
- The prompt must include the following layers:
- : This is a finished thematic visual directly usable in official account articles
Task Positioning - : Reuse the unified visual language of this article
Style Anchor - : Core objects, information modules, foreground-middle-ground-background relationships
Main Subject - : Organization method of title area, content area, comparison area, process area, data area
Layout Structure - : Priority of main title, secondary labels, supplementary explanations
Information Hierarchy - : All visible text uses Simplified Chinese by default; only whitelisted terms retain English
Text Rules - : Rich details, clear hierarchy, strong layout sense, avoid template-like effects
Quality Requirements - : Childish style, vague content, overly decorative, meaningless icon stacking, garbled English
Prohibited Items
- For Nano Banana / Gemini-like models, prioritize optimizing the following features:
- Complete frame information, clear instructions, specific elements
- Text display should be as short and accurate as possible, avoid long paragraphs of explanatory text
- All images in the same article share the same color system, graphic language, and polish level
- Images should look like editorial thematic visuals rather than ordinary illustrations
- Save all prompts to the directory
{article_dir}/illustrations/{slug}/prompts/ - Call the built-in script of this skill to generate images:
- Script path:
scripts/image-gen.ts - Parameters:
--prompt "<prompt content>" --output "<output path>" --ar <aspect ratio> - Optional:
--provider gemini|google|xiaomi|openai - Optional:
--model <model name> - Optional:
--base-url <Gemini native proxy base address> - Optional:
--api-key <temporary key> - Optional: (e.g.,
--image-size <clarity/size identifier>for Xiaomi)1K - Optional: (for Gemini multimodal scenarios)
--ref <reference image path> - Parallel Generation: Maximum 4 concurrent tasks recommended
- Script path:
- To complete planning + image generation + insertion back into the article in one click, directly call:
bash
node scripts/illustrate-article.ts --article <article.md>- If using the Xiaomi Gemini compatible interface, add:
--image-provider xiaomi --image-model gemini-3-pro-image-preview --image-size 1K
- If using the Xiaomi Gemini compatible interface, add:
- Failure Handling:
- Single image generation failed -> Retry once, fine-tune layout, text density or prohibited items in the prompt if needed
- Still failed -> Record to the failure list, proceed to the next image
- Do not interrupt the overall process
Output: List of image files, failure list
Step 4: Upload to Image Hosting (Optional)
Trigger Condition:
upload=trueGoal: Upload generated images to Qiniu Cloud to obtain CDN URLs
Operations:
- Check Qiniu Cloud configuration: Read the file at the skill root directory
.env - Call the upload script:
bash
bun run scripts/qiniu-upload.ts --file <local path> --key <remote path> - Remote key format:
illustrations/{slug}/{filename} - Upload one by one, record the CDN URL of each image
- If upload fails, retain the local path and do not interrupt the process
Output: list (CDN URL or )
uploaded_urlsnullStep 5: Insert into Article Copy
Goal: Create an article copy with image references
Operations:
- Copy to
article_path(same directory)article.illustrated.md - Insert image references at each position specified in the outline:
- If uploaded (has CDN URL):
 - If not uploaded:

- If uploaded (has CDN URL):
- For images that failed to generate, insert a placeholder comment:
markdown
<!-- IMAGE PLACEHOLDER: {filename} — {purpose} --> - Output completion summary:
illustrated_article_path- Statistics of success / failure / upload
- List of failed images and reasons
Output:
illustrated_article_pathData Flow
text
article.md
|
v
Step 1: Analyze article structure -> List of illustration positions
|
v
Step 2: Generate visual-bible.md + outline.md
|
v
Step 3: Generate structured prompts -> illustrations/{slug}/*.png
|
v
Step 4: (--upload) Upload to Qiniu Cloud -> CDN URLs
|
v
Step 5: Insert into copy -> article.illustrated.mdError Handling
| Failure Scenario | Handling Method |
|---|---|
| Article file does not exist | Report error and exit immediately |
| Gemini / proxy configuration missing | Prompt the user to configure |
| Xiaomi interface configuration missing | Prompt the user to configure |
| Single image generation failed | Retry once; if still failed, record and skip, proceed to the next one |
| Poor effect due to excessive text | Retry after simplifying the length of titles/labels/annotations |
| Qiniu Cloud configuration missing | Prompt the user to configure the |
| Qiniu Cloud upload failed | Retain local path, record error, proceed to the next image |
| Slug directory already exists | Use it directly (overwrite files with the same name) |
Example Usage
Default Nano Banana style illustrations:
yaml
article_path: articles/playwright-introduction/article.md
density: balanced
prompt_profile: nano-banana
text_language: zh-CN
image_provider: xiaomi
image_model: gemini-3.1-flash-image-preview
image_base_url: https://your-compatible-endpoint.example/v1beta
image_size: 1K
upload: falseGenerate images via Gemini native proxy:
yaml
article_path: articles/playwright-introduction/article.md
density: balanced
image_provider: gemini
image_model: gemini-3.1-flash-image-preview
image_base_url: https://your-relay.example.com/v1beta
upload: falseGenerate images via Xiaomi Gemini compatible interface:
yaml
article_path: articles/playwright-introduction/article.md
density: balanced
image_provider: xiaomi
image_model: gemini-3.1-flash-image-preview
image_base_url: https://your-compatible-endpoint.example/v1beta
image_size: 1K
upload: falseSpecify English whitelist terms:
yaml
article_path: articles/playwright-introduction/article.md
english_terms_whitelist:
- Playwright
- Chromium
- Firefox
- WebKitNotes
- The global quality baseline is fixed as high-polish editorial visuals, no simple decorative images are generated
- Different articles can have different visual styles, but the same article must share a unified style system
- All visible text uses Simplified Chinese by default; only whitelisted terms retain English
- Always create a copy (), do not modify the original article
article.illustrated.md - Image references force the use of relative paths and separators (local mode)
/ - Prompts are saved to the directory for easy tracing and re-generation after manual adjustment
prompts/ - You can use to automatically generate
bun run scripts/plan-illustrations.ts --article <article.md>,visual-bible.mdandoutline.mdprompts/ - You can use to complete planning, image generation and
node scripts/illustrate-article.ts --article <article.md>generation in one clickarticle.illustrated.md - Xiaomi/Gemini compatible interfaces can be configured via and custom
image_provider=xiaomi; the open-source repository does not preset any private relay addressesimage_base_url