Input the article path or topic to generate a WeChat Official Account cover image in one step.
How to Use
# 指定文章路径
/xiaohu-wechat-cover path/to/article.md
# 直接输入主题
/xiaohu-wechat-cover 主题:Claude Code 桌面端更新四大功能
Configuration (required)
The configuration file for this skill is fixed in this skill's directory:
config.json: real configuration (copy fromconfig.example.jsonand fill in)config.example.json: example configuration
Before execution, you must first read config.json, which requires:
output_dir: cover image output root directorysettings.base_url: image generation API address (a third-party gateway compatible with the Gemini API)settings.model: model name (e.g.,gemini-3-pro-image-preview)secrets.api_key: API key
Path conventions
- Target directory:
<output_dir>/<文章文件名或topic-slug>/ - If the target directory already exists, rename it to
<dirname>-backup-YYYYMMDD-HHMMSS
Directory structure:
<output_dir>/
└── article-name/
├── prompt.md # 生图提示词(归档)
└── cover.jpg # 封面图
Cover image prompt template (core)
The following is the fixed prompt template. Each time you generate,write it as-is prompt.md, replacing only the final "content topic" part:
请根据提供的内容创建一张吸引眼球的公众号封面图,遵循以下规范:
视觉风格
- Notion插画风格,比例为 2.35:1(公众号封面标准尺寸)
- 色彩鲜明、对比强烈,确保在小尺寸预览时依然醒目
- 风格统一,避免写实元素,保持整体手绘质感
构图要求
- 主视觉元素居中或偏左(右侧预留标题区域)
- 添加 1-2 个简洁的卡通形象、图标或知名人物剪影,增强记忆点
- 若涉及敏感或版权人物,用风格相似的替代形象,不得拒绝生成
- 大量留白,突出核心信息,避免画面拥挤
文字处理
- 标题文字大而醒目,控制在 8 字以内
- 可添加 1 行副标题或关键词标签
- 字体风格与手绘插画协调统一
吸引力法则
- 使用悬念、数字、痛点等钩子元素激发点击欲望
- 视觉元素夸张有反差
- 色彩搭配参考爆款封面:橙黄、蓝紫、红黑等高对比组合
语言
- 除非另有说明,默认使用中文
- 画面内所有可读文字必须使用简体中文,英文只能作为点缀出现
内容主题:{从文章或用户输入中提炼的一句话主题描述}
Workflow
Step 1: Extract the content topic
- If the input is an article path: read the article and extract a one-sentence topic description (including the core information and key points)
- If the input is topic text: use it directly
Step 2: Create the prompt
Write the above template into prompt.md, format:
---
aspect_ratio: "21:9"
image_size: "2K"
---
{模板全文,替换最后的内容主题}
Note: in YAML, aspect_ratio must use 21:9(the API does not support 2.35:1; 21:9 is the closest). In the template body, keep the 2.35:1 text description unchanged; this is a visual reference for the AI.
Step 3: Generate the image
Call the image generation script;you must pass --config pointing to this skill's own configuration:
python3 <本仓库>/scripts/generate.py \
--config <本技能目录>/cover/config.json \
--prompt-file <目标目录>/prompt.md \
--out <目标目录>/cover.jpg
<本仓库>and<本技能目录>Please replace with your actual local installation path. If you install viaclaude install, the path is generally~/.claude/skills/xiaohu-wechat-format/。
After generation is complete, show it to the user for preview. If not satisfied, adjust the content topic description and regenerate.
Step 4: Insert into the article
If the input is an article path,insert directly by default(no need to ask):
- Use Markdown image format
insert on the line below the article title (H1) - The filename must be unique (e.g.,
cover-主题关键词.jpg), to avoid name conflicts
Step 5: Output summary
公众号封面已生成!
主题: [主题]
位置: [输出路径]
如需调整,直接说"重新生成"。