zhy-article-illustrator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesezhy-article-illustrator
zhy-article-illustrator
Purpose
Purpose
为任意 Markdown 文章自动规划并生成配图。技能默认采用“高完成度编辑视觉”作为
全局质量基线:不是简单插画,不是装饰图标拼贴,也不是低信息密度草图。系统会先
为文章生成统一的 visual bible,再为每张图生成结构化提示词,使同一篇文章的配图
共享统一风格语言,同时根据章节内容调整构图、信息重点和版式。
默认优先兼容 Gemini Nano Banana 工作流,并默认走 Xiaomi Gemini 兼容接口;同时支持 Gemini 原生代理 / 中转站模式与官方 Gemini 接口。
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
When to Use
- 用户请求“为文章配图”、“illustrate article”、“add images to article”
- 技能的 Step 6 调用(
zhy-wechat-writing)with_illustrations=true - 用户希望生成更适合公众号场景的高完成度专题视觉
- 用户希望将本地图片上传到七牛云获取 CDN URL
- 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
Prerequisites
- 文章 Markdown 文件已存在
- 已配置至少一种可用生图通道:
- Gemini 官方直连:或
GEMINI_API_KEYGOOGLE_API_KEY - Gemini 原生代理 / 中转站:、
IMAGE_PROVIDER=gemini、可选IMAGE_API_KEYIMAGE_BASE_URL - Xiaomi Gemini 兼容接口:或
IMAGE_PROVIDER=xiaomi,可选XIAOMI_API_KEYXIAOMI_BASE_URL - 若启用上传:七牛云配置已就绪(技能根目录 中的
.env/QINIU_ACCESS_KEY/QINIU_SECRET_KEY/QINIU_BUCKET)QINIU_DOMAIN
- Gemini 官方直连:
- 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
Workflow
Step 1: 分析文章
Step 1: Analyze the Article
目标:理解文章结构,确定配图数量、位置与表达方式
操作:
- 读取 的完整内容
article_path - 解析文章结构:标题、各章节标题(/
##)、段落数、代码块位置### - 识别核心信息点:
- 关键概念 / 术语解释 -> 适合信息图
- 对比 / 差异描述 -> 适合对比图
- 步骤 / 流程描述 -> 适合流程图
- 架构 / 框架描述 -> 适合架构图
- 数据 / 统计 -> 适合数据可视化
- 场景 / 叙事描述 -> 适合专题插画或编辑场景图
- 根据 确定配图策略:
density- :仅为最核心的 1-2 个信息点配图
minimal - :每个
balanced级主要章节配一张图## - :每 300 字左右或每个重要段落配一张图
rich
- 确定 :
slug- 若用户提供 :直接使用
slug - 否则从文章 H1 标题推导
kebab-case
- 若用户提供
- 创建输出目录:
{article_dir}/illustrations/{slug}/
输出:文章结构分析结果、配图位置列表
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: 生成 visual bible 与配图规划
Step 2: Generate Visual Bible and Illustration Plan
目标:为整篇文章建立统一视觉基线,并生成每张图的规划信息
操作:
- 先生成文章级 ,保存到
visual_bible{article_dir}/illustrations/{slug}/visual-bible.md - 必须覆盖:
visual_bible- :统一采用高完成度编辑视觉 / 专题配图标准
quality_baseline - :本篇文章的整体风格方向
visual_theme - :主色、辅色、强调色、背景倾向
color_system - :图形语言、线条/材质/光感、信息层级方式
graphic_language - :页面留白、模块密度、标题区与内容区节奏
layout_discipline - :默认简体中文;仅
text_policy中的术语保留英文english_terms_whitelist - :禁止简单画图、低幼卡通、无意义装饰、英文乱码、随意混搭风格
negative_rules
- 再对每个配图位置生成 outline 条目,至少包含:
- :插入位置(在哪个章节/段落之后)
position - :这张图要传达什么信息
purpose - :对比图 / 流程图 / 架构图 / 数据图 / 场景图 / 编辑专题视觉
image_type - :本图唯一核心表达
core_message - :画面中必须出现的内容块
content_blocks - :图中需要出现的标题、标签、注释(默认中文)
text_blocks - :本图允许出现的英文术语子集
english_terms_used - :布局方向与信息分区
layout_hint - :输出文件名(格式:
filename)NN-简短描述.png - :Markdown 图片的 alt 文本
alt_text
- 保存到
{article_dir}/illustrations/{slug}/outline.md - 同时为每张图生成独立提示词文件,保存到
{article_dir}/illustrations/{slug}/prompts/
outline.md 格式:
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>
---输出:、
visual_bible_pathoutline_pathGoal: 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: 生成图片
Step 3: Generate Images
目标:根据 + outline 生成高质量图片文件
visual_bible操作:
- 为每张图构建结构化提示词,提示词必须同时继承:
- 全局质量基线:高完成度编辑视觉,而非简单画图
- 文章级
visual_bible - 单图内容规划
- 提示词必须包含以下层次:
- :这是可直接用于公众号文章的成品级专题视觉
任务定位 - :复用本篇文章统一视觉语言
风格锚点 - :核心对象、信息模块、前中后景关系
画面主体 - :标题区、内容区、对比区、流程区、数据区的组织方式
版式结构 - :主标题、次要标签、补充说明的优先级
信息层级 - :默认所有可见文字使用简体中文;仅白名单术语保留英文
文字规则 - :丰富细节、清晰层级、强版式感、避免模板感
质量要求 - :低幼、空泛、装饰性过强、无意义图标堆砌、英文乱码
禁止项
- 对 Nano Banana / Gemini 类模型,优先优化以下特性:
- 画面信息完整、指令明确、元素具体
- 文本展示尽量短而准,避免大段说明文字
- 同一篇文章的每张图共享统一色系、统一图形语言、统一完成度
- 图片更像编辑专题视觉,而不是普通插图
- 将所有提示词保存到 目录
{article_dir}/illustrations/{slug}/prompts/ - 调用本技能内置脚本生成图片:
- 脚本路径:
scripts/image-gen.ts - 参数:
--prompt "<提示词内容>" --output "<输出路径>" --ar <宽高比> - 可选:
--provider gemini|google|xiaomi|openai - 可选:
--model <模型名> - 可选:
--base-url <Gemini 原生代理基础地址> - 可选:
--api-key <临时 key> - 可选:(如 Xiaomi 的
--image-size <清晰度/尺寸标识>)1K - 可选:(Gemini 多模态场景)
--ref <参考图路径> - 并行生成:建议最多 4 个并发
- 脚本路径:
- 若需要一键完成规划 + 生图 + 插回文章,可直接调用:
bash
node scripts/illustrate-article.ts --article <article.md>- 若使用 Xiaomi Gemini 兼容接口,可补充:
--image-provider xiaomi --image-model gemini-3-pro-image-preview --image-size 1K
- 若使用 Xiaomi Gemini 兼容接口,可补充:
- 失败处理:
- 单张失败 -> 重试一次,可微调提示词中的布局、文字密度或禁止项
- 仍失败 -> 记录到失败列表,继续下一张
- 不中断整体流程
输出:图片文件列表、失败列表
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: 上传图床(可选)
Step 4: Upload to Image Hosting (Optional)
触发条件:
upload=true目标:将生成的图片上传到七牛云,获取 CDN URL
操作:
- 检查七牛云配置:读取技能根目录
.env - 调用上传脚本:
bash
bun run scripts/qiniu-upload.ts --file <本地路径> --key <远程路径> - 远程 key 格式:
illustrations/{slug}/{filename} - 逐张上传,记录每张的 CDN URL
- 上传失败时保留本地路径,不中断流程
输出: 列表(CDN URL 或 )
uploaded_urlsnullTrigger 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: 插入文章副本
Step 5: Insert into Article Copy
目标:创建带有图片引用的文章副本
操作:
- 复制 为
article_path(同目录)article.illustrated.md - 在 outline 指定的每个位置插入图片引用:
- 若已上传(有 CDN URL):
 - 若未上传:

- 若已上传(有 CDN URL):
- 对生成失败的图片,插入占位注释:
markdown
<!-- IMAGE PLACEHOLDER: {filename} — {purpose} --> - 输出完成摘要:
illustrated_article_path- 成功 / 失败 / 上传统计
- 失败图片列表及原因
输出:
illustrated_article_pathGoal: 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
Data Flow
text
article.md
|
v
Step 1: 分析文章结构 -> 配图位置列表
|
v
Step 2: 生成 visual-bible.md + outline.md
|
v
Step 3: 生成结构化 prompts -> illustrations/{slug}/*.png
|
v
Step 4: (--upload) 上传七牛云 -> CDN URLs
|
v
Step 5: 插入副本 -> article.illustrated.mdtext
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
Error Handling
| 失败场景 | 处理方式 |
|---|---|
| 文章文件不存在 | 立即报错退出 |
| Gemini / 代理配置缺失 | 提示用户配置 |
| Xiaomi 接口配置缺失 | 提示用户配置 |
| 单张图片生成失败 | 重试一次;仍失败记录跳过,继续下一张 |
| 文字过多导致效果差 | 精简标题/标签/注释长度后重试 |
| 七牛云配置缺失 | 提示用户配置技能根目录 |
| 七牛云上传失败 | 保留本地路径,记录错误,继续下一张 |
| slug 目录已存在 | 直接使用(覆盖同名文件) |
| 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
Example Usage
默认 Nano Banana 风格配图:
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: false通过 Gemini 原生代理生图:
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: false通过 Xiaomi Gemini 兼容接口生图:
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: false指定英文白名单术语:
yaml
article_path: articles/playwright-introduction/article.md
english_terms_whitelist:
- Playwright
- Chromium
- Firefox
- WebKitDefault 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
Notes
- 全局质量基线固定为高完成度编辑视觉,不生成简单装饰图
- 不同文章可以有不同视觉风格,但同一篇文章内必须共享统一风格体系
- 默认所有可见文字使用简体中文;仅白名单术语保留英文
- 始终创建副本(),不修改原文
article.illustrated.md - 图片引用强制使用相对路径和 分隔符(本地模式)
/ - 提示词保存到 目录,便于追溯和手动调整后重新生成
prompts/ - 可使用 自动生成
bun run scripts/plan-illustrations.ts --article <article.md>、visual-bible.md和outline.mdprompts/ - 可使用 一键完成规划、出图和
node scripts/illustrate-article.ts --article <article.md>生成article.illustrated.md - Xiaomi/Gemini 兼容接口可通过 与自定义
image_provider=xiaomi配置;开源仓库不预设任何私有中转地址image_base_url
- 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