Three-stage automated pipeline: writing → cover → publishing, with a checkpoint at each stage, continuing only after the user gives the go-ahead.
Core Philosophy
用户说"写一篇公众号文章"
│
▼
┌──────────────────────────────────────┐
│ STAGE 1 — 内容创作 │
│ wechat-article-writer │
│ 搜索→撰写→标题→排版 │
│ │
│ 🔴 CHECKPOINT 1: 内容审查 │
│ → 展示文章 + 5个标题,等用户确认 │
└──────────────┬───────────────────────┘
│ 用户回复"继续"
▼
┌──────────────────────────────────────┐
│ STAGE 2 — 封面生成 │
│ code-to-image │
│ 设计HTML→渲染PNG │
│ │
│ 🔴 CHECKPOINT 2: 封面审查 │
│ → 展示封面图,等用户确认或要求重做 │
└──────────────┬───────────────────────┘
│ 用户回复"继续"
▼
┌──────────────────────────────────────┐
│ STAGE 3 — 发布推送 │
│ md2wechat │
│ 门禁审查→create_draft→草稿入库 │
│ │
│ 🔴 CHECKPOINT 3: 发布门禁 │
│ → 标题/作者/封面/摘要全展示 │
│ → 等用户回复"发" │
└──────────────────────────────────────┘
Trigger Words
Any of the following keywords triggers this pipeline:
公众号创作、写公众号文章、公众号发布公众号流水线、发公众号、公众号全流程写一篇公众号、帮我发公众号
Core Iron Rules (Must Not Be Violated)
- The three stages must be serial — no stage may be skipped, and no two stages may run in parallel
- Each stage must have a checkpoint — after each stage ends, it must stop and wait for user confirmation, and must not automatically proceed to the next stage
- Gate checks must not be skipped — the publishing gate check of Stage 3 must fully display the title/author/cover/summary
- The cover must be code-generated — it is forbidden to use
image_generate(AI image generation) to replacecode-to-image(code rendering), because the gaps in Chinese text accuracy, direct topic relevance, and style reproducibility are enormous - Publishing must use create_draft — it is forbidden to use
test-draft(the test command does not pass the title/author, which would result in 'AI-generated test article') - Errors must be recorded — when each stage fails, take a screenshot and save it, record the root cause, and do not retry silently
Stage 1: Content Creation
Sub-skill: wechat-article-writer
4-step process: search for materials → write the article → generate the title → layout suggestions
Step 1.1: Search for Materials
Use WebSearch to search in parallel:
- Official documentation / GitHub / technical forums
- Prioritize materials from the current month/quarter
- Summarize in depth, annotate sources
Step 1.2: Write the Article
- Read CLAUDE.md to get the writing style (if it exists)
- Word count: as requested by the user, default 2000-3000 words
- Structure: story-style opening → problem description → step-by-step teaching → elevated summary
- Prepare 2-3 alternative titles
- Output the Markdown file to the
output/directory
Step 1.3: Generate the Title
Generate 5 viral titles:
- Clear pain point ("still doing it manually...")
- Attractive numbers ("3 minutes" "5 tips")
- Result-oriented ("efficiency skyrockets 10x")
- Emotional appeal ("stunning" "godlike trick")
- Title ≤ 32 characters (WeChat limit)
Step 1.4: Layout Suggestions
- Paragraph structure: 3-5 lines per paragraph
- Code blocks: leave blank space before and after, label the language
- Punchlines: stand alone as a paragraph in bold
- Image markers: annotate
[图: 描述]for subsequent generation
🔴 CHECKPOINT 1: Content Review
Must be shown to the user and wait for confirmation:
📝 内容审查
📖 文章标题候选(选一个):
1. xxx
2. xxx
3. xxx
4. xxx
5. xxx
📊 文章概况:
- 字数:约 X,XXX 字
- 结构:[段落数] 段,[代码块数] 个代码块
📄 内容预览:
[展示文章前 3 段或关键段落]
---
请选择标题编号,或告诉我修改意见。
回复"继续"进入封面生成阶段。
Before the user confirms, absolutely do not enter Stage 2.
Stage 2: Cover Generation
Sub-skill: code-to-image
Step 2.1: Choose a Template
From the library of 15 templates, recommend 2-3 styles that match the article's topic:
- Tech tutorials → Blueprint / MIT Tech Review / Swiss
- Startup Insights → Kinfolk / Coffee Notes / Notebook
- Deep Analysis → Editorial / Monocle / Paper & Ink
Step 2.2: Design Cover HTML
- Cover size:WeChat Official Account 900×383 (16:9), render
-w 900 -H 383 --scale 2 - Must be directly connected to the article topic (not a generic image!)
- Includes: core concept visualization + key data metrics + style and color palette
- Example: md2wechat tutorial → terminal commands + formatting conversion arrow + "1 command line/20 theme sets/2min full workflow"
Step 2.3: Render
python3 ~/.openclaw/skills/code-to-image/render.py cover.html -w 900 -H 383 --scale 2 -o cover.png
🔴 CHECKPOINT 2: Cover Review
Must send the cover image to the user and wait for confirmation:
🖼️ 封面审查
[发送封面图片]
🎨 封面信息:
- 风格:[模板名]
- 尺寸:1800×766 (2x)
- 色调:[主色/强调色]
---
封面满意吗?
- 回复"继续"接受此封面
- 回复"重做 + 要求"重新生成(如"重做 更暗的色调")
Before the user confirms, absolutely do not enter Stage 3.
Stage 3: Publish and Push
Sub-skill: md2wechat
Step 3.1: Pre-check
md2wechat config validate # 检查 WECHAT_APPID/SECRET
md2wechat inspect article.md # 检查标题/摘要/图片
Step 3.2: Render HTML
Based on the layout theme selected by the user (e.g., Coffee Notes / Deep Ocean / Swiss Minimal), convert Markdown into WeChat-compatible HTML with inline CSS.
If the md2wechat.cn API key is unavailable:
- Use a Python script to render HTML (inline CSS + theme color palette)
- Reference: coffee_notes_renderer.py (Coffee Notes example)
Step 3.3: Upload Cover
md2wechat upload_image cover.png
# 获取 thumb_media_id
Step 3.4: Generate Digest
- Extract from the first 120 characters of the article
- The WeChat fold line is at ~60 characters, so the core information must appear within 60 characters
- Can be overridden via
--digestoverride
🔴 CHECKPOINT 3: Publish Gate
This is the final checkpoint. All fields must be displayed, and wait for the user to say "publish".
📋 发布审查
🏷️ 标题(XX/32字):
[完整标题文本]
✍️ 作者(XX/16字):
[作者名]
📝 摘要(XX/128字,折叠线≈60字):
[完整摘要文本]
🖼️ 封面:
[发送封面图]
🎨 排版风格:[主题名]
---
以上信息确认无误?回复"发"推送到草稿箱,或告知修改内容。
Step 3.5: Push Draft
After the user replies "publish"/"push"/"OK":
md2wechat create_draft draft.json
draft.json must contain complete fields:
{
"articles": [{
"title": "完整标题",
"author": "完整作者",
"digest": "完整摘要",
"thumb_media_id": "封面media_id",
"content": "HTML正文",
"show_cover_pic": 1,
"need_open_comment": 0,
"only_fans_can_comment": 0
}]
}
⚠️ Do not use test-draft — it does not pass title/author/digest, which will cause the title to display "AI-generated test article".
Step 3.6: Completion Confirmation
✅ 发布完成
📋 草稿信息:
media_id: dpn_xxx
位置:微信公众号后台 → 内容管理 → 草稿箱
🧹 如有旧版草稿,请手动删除。
去后台扫码预览,满意后一键群发。
Common Errors and Countermeasures
| Error | Root Cause | Countermeasure |
|---|---|---|
| Title displays "AI-generated test article" | Used test-draft instead of create_draft |
Switch to create_draft + complete JSON |
| Cover is unrelated to the article | Used image_generate generic image generation |
Switch to code-to-image code rendering |
| md2wechat.cn API key invalid | wme_* key expired |
Use Python inline CSS rendering + create_draft push |
| Volcano Engine image generation key expired | ARK API key expired | Switch to code-to-image(always free) |
| create_draft reports "no articles" | JSON is missing the articles array wrapper |
Use the {"articles":[{...}]} format |
Version History
| Version | Date | Changes |
|---|---|---|
| v1.0 | 2026-06-01 | Initial version. Distilled from a real publishing process: writing (wechat-article-writer) → cover (code-to-image) → publishing (md2wechat + Publish Gate). Records 5 lessons learned from pitfalls. |
Copyright © Daniel Li. All rights reserved.