xiaohu-wechat-cover
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese公众号封面图生成器
WeChat Official Account Cover Image Generator
输入文章路径或主题,一步生成公众号封面图。
Generate WeChat Official Account cover images in one step by inputting an article path or topic.
使用方法
Usage
bash
undefinedbash
undefined指定文章路径
Specify article path
/xiaohu-wechat-cover path/to/article.md
/xiaohu-wechat-cover path/to/article.md
直接输入主题
Directly input topic
/xiaohu-wechat-cover 主题:Claude Code 桌面端更新四大功能
undefined/xiaohu-wechat-cover Topic: Claude Code Desktop Client Updates Four Major Features
undefined配置(必须)
Configuration (Required)
本技能的配置文件固定在本技能目录下:
- :真实配置(从
config.json复制后填写)config.example.json - :示例配置
config.example.json
执行前必须先读取 ,需要:
config.json- :封面图输出根目录
output_dir - :生图 API 地址(兼容 Gemini API 的第三方网关)
settings.base_url - :模型名称(如
settings.model)gemini-3-pro-image-preview - :API 密钥
secrets.api_key
The configuration files for this skill are fixed in the skill directory:
- : Actual configuration (copy from
config.jsonand fill in)config.example.json - : Example configuration
config.example.json
You must read before execution, which requires:
config.json- : Root directory for cover image output
output_dir - : Image generation API address (third-party gateway compatible with Gemini API)
settings.base_url - : Model name (e.g.,
settings.model)gemini-3-pro-image-preview - : API key
secrets.api_key
路径约定
Path Conventions
- 目标目录:
<output_dir>/<文章文件名或topic-slug>/ - 如果目标目录已存在,重命名为
<dirname>-backup-YYYYMMDD-HHMMSS
目录结构:
<output_dir>/
└── article-name/
├── prompt.md # 生图提示词(归档)
└── cover.jpg # 封面图- Target directory:
<output_dir>/<article-filename-or-topic-slug>/ - If the target directory already exists, rename it to
<dirname>-backup-YYYYMMDD-HHMMSS
Directory structure:
<output_dir>/
└── article-name/
├── prompt.md # Image generation prompt (archived)
└── cover.jpg # Cover image封面图提示词模板(核心)
Cover Image Prompt Template (Core)
以下是固定的提示词模板,每次生成时原样写入 ,只替换最后的「内容主题」部分:
prompt.md请根据提供的内容创建一张吸引眼球的公众号封面图,遵循以下规范:
视觉风格
- Notion插画风格,比例为 2.35:1(公众号封面标准尺寸)
- 色彩鲜明、对比强烈,确保在小尺寸预览时依然醒目
- 风格统一,避免写实元素,保持整体手绘质感
构图要求
- 主视觉元素居中或偏左(右侧预留标题区域)
- 添加 1-2 个简洁的卡通形象、图标或知名人物剪影,增强记忆点
- 若涉及敏感或版权人物,用风格相似的替代形象,不得拒绝生成
- 大量留白,突出核心信息,避免画面拥挤
文字处理
- 标题文字大而醒目,控制在 8 字以内
- 可添加 1 行副标题或关键词标签
- 字体风格与手绘插画协调统一
吸引力法则
- 使用悬念、数字、痛点等钩子元素激发点击欲望
- 视觉元素夸张有反差
- 色彩搭配参考爆款封面:橙黄、蓝紫、红黑等高对比组合
语言
- 除非另有说明,默认使用中文
- 画面内所有可读文字必须使用简体中文,英文只能作为点缀出现
内容主题:{从文章或用户输入中提炼的一句话主题描述}The following is a fixed prompt template. Each time you generate an image, write it as-is to , only replacing the "Content Topic" section at the end:
prompt.mdPlease create an eye-catching WeChat Official Account cover image based on the provided content, following these specifications:
Visual Style
- Notion illustration style, aspect ratio 2.35:1 (standard size for WeChat Official Account covers)
- Bright colors with strong contrast, ensuring visibility even in small previews
- Consistent style, avoid realistic elements, maintain overall hand-drawn texture
Composition Requirements
- Main visual element centered or slightly left (reserve title area on the right)
- Add 1-2 simple cartoon characters, icons, or silhouettes of well-known figures to enhance memorability
- If sensitive or copyrighted figures are involved, use similar-style alternative images; do not refuse generation
- Ample white space to highlight core information, avoid cluttered visuals
Text Processing
- Title text should be large and prominent, limited to 8 characters or less
- Can add 1 line of subtitle or keyword tags
- Font style should coordinate with hand-drawn illustrations
Attraction Principles
- Use hooks like suspense, numbers, or pain points to stimulate click desire
- Exaggerated and contrasting visual elements
- Color combinations reference popular covers: high-contrast combinations like orange-yellow, blue-purple, red-black
Language
- Unless otherwise specified, use Chinese by default
- All readable text in the image must use Simplified Chinese; English can only be used as an accent
Content Topic: {One-sentence topic description extracted from the article or user input}工作流程
Workflow
步骤 1:提炼内容主题
Step 1: Extract Content Topic
- 如果输入是文章路径:读取文章,提炼一句话主题描述(包含核心信息和关键要点)
- 如果输入是主题文本:直接使用
- If input is an article path: Read the article and extract a one-sentence topic description (including core information and key points)
- If input is topic text: Use it directly
步骤 2:创建提示词
Step 2: Create Prompt
将上述模板写入 ,格式:
prompt.mdmd
---
aspect_ratio: "21:9"
image_size: "2K"
---
{模板全文,替换最后的内容主题}注意:YAML 中 必须用 (API 不支持 2.35:1,21:9 是最接近的)。模板正文中保留 的文字描述不变,这是给 AI 的视觉参考。
aspect_ratio21:92.35:1Write the above template to in the following format:
prompt.mdmd
---
aspect_ratio: "21:9"
image_size: "2K"
---
{Full template text, replace the final content topic}Note: The in YAML must be (API does not support 2.35:1, 21:9 is the closest). Keep the text description in the template body unchanged, as this is the visual reference for the AI.
aspect_ratio21:92.35:1步骤 3:生成图片
Step 3: Generate Image
调用生图脚本,必须传 指向本技能自己的配置:
--configbash
python3 <本仓库>/scripts/generate.py \
--config <本技能目录>/cover/config.json \
--prompt-file <目标目录>/prompt.md \
--out <目标目录>/cover.jpg和<本仓库>请替换为你本地实际安装路径。如果你通过<本技能目录>安装,路径一般是claude install。~/.claude/skills/xiaohu-wechat-format/
生成完成后展示给用户预览。不满意就调整内容主题描述重新生成。
Call the image generation script, must pass pointing to the skill's own configuration:
--configbash
python3 <repository>/scripts/generate.py \
--config <skill-directory>/cover/config.json \
--prompt-file <target-directory>/prompt.md \
--out <target-directory>/cover.jpgReplaceand<repository>with your local actual installation paths. If you installed via<skill-directory>, the path is generallyclaude install.~/.claude/skills/xiaohu-wechat-format/
After generation, show the preview to the user. If unsatisfied, adjust the content topic description and regenerate.
步骤 4:插入文章
Step 4: Insert into Article
如果输入是文章路径,默认直接插入(不用询问):
- 用 Markdown 图片格式 插入文章标题(H1)下一行
 - 文件名必须唯一(如 ),避免同名冲突
cover-主题关键词.jpg
If input is an article path, insert directly by default (no need to ask):
- Insert in Markdown image format on the line below the article title (H1)
 - The filename must be unique (e.g., ) to avoid name conflicts
cover-topic-keywords.jpg
步骤 5:输出摘要
Step 5: Output Summary
公众号封面已生成!
主题: [主题]
位置: [输出路径]
如需调整,直接说"重新生成"。WeChat Official Account cover has been generated!
Topic: [Topic]
Location: [Output Path]
If you need adjustments, just say "Regenerate".