SuperAPI AI Directory

WeChat Publish Pipeline

Design & creation

View repository

Updated 10-15 17:32

About this skill

WeChat Full Publish Pipeline

Fully automatic mode: From topic selection to the drafts folder, no interruptions in between. After receiving the instruction, execute the following steps in order, without waiting for user confirmation at any point.

⚡ Progress reporting specification (mandatory)

After completing each Step, and before starting the tool call for the next Step, first output a line of reporting text. The text and the tool call for the next step are in the same response, in this order:

[文字:✅ Step N 完成:...]
[工具调用:Step N+1 的第一个工具]

This is the only way to let the user see progress in real time. Do not wait for the user to reply, do not "end this round and wait", send the text and the tool call together.

Reporting format:

✅ Step 0 完成:选题「{标题}」(HN {N} points)
✅ Step 1 完成:文章写好,{字数}字
✅ Step 2 完成:5张插图全部生成
✅ Step 3 完成:封面图生成
✅ Step 4 完成:排版完成
✅ Step 5 完成:已发布草稿箱,media_id: {id}

Pipeline Steps

Step 0: Topic Selection        (web-search + judgment)
Step 1: Research & Write       (url-to-markdown + translate + write)
Step 2: Article Illustrations  (baoyu-article-illustrator)
Step 3: Cover Image            (baoyu-imagine)
Step 4: Markdown → HTML        (baoyu-markdown-to-html)
Step 5: Publish to Draft Box   (baoyu-post-to-wechat API)

After completing each stepimmediatelysend a progress message to the user (see the progress reporting specification above).


Step 0: Topic Selection (autonomous topic selection)

Fully autonomous, do not ask the user.

0.1 Collect hot topics

Search the following sources simultaneously, taking content from the last 24-48 hours:

- Hacker News 热榜 Top 20(https://news.ycombinator.com/best)
- GitHub Trending(https://github.com/trending)
- 如有必要:Twitter/X AI/tech 话题

0.2 Selection criteria

Prioritize topics that meet the following conditions:

Criteria Description
Relevance AI, development tools, technology trends, security incidents, engineering practices
Timeliness The event occurred within 48 hours, with first-hand materials available for checking
Depth potential There are technical details to dig into, not a pure news retelling
Audience match Suitable for a technology-oriented official account audience (engineers, AI practitioners)
Not written before Check /agent/articles/ to avoid duplicate topics

0.3 Autonomous decision

Choose the one with the highest score from the candidate topics, record the reason for the topic selection, and go directly to Step 1. Do not display the candidate list, do not wait for feedback.

📢 Output ✅ Step 0 完成:选题「{标题}」(HN {N} points,来源:{URL}), then in the same response immediately start the tool call for Step 1 (fetching the original text).


Step 1: Research & Write (research and writing)

1.1 Obtain source materials

Use baoyu-url-to-markdown to fetch the main source page:

SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-url-to-markdown"
npx -y bun "$SKILL_DIR/scripts/main.ts" --url "{source_url}" --output /tmp/source.md

If there are multiple key sources (original text + discussion thread), fetch them all.

1.2 If translation is needed

If the original text is in English, use baoyu-translate to carefully translate the core content as a reference (do not directly publish the translation draft):

SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-translate"
npx -y bun "$SKILL_DIR/scripts/main.ts" /tmp/source.md --mode normal --to zh

1.3 Write the original article

Article style requirements:

  • First-person narrative perspective ("That day...", "Let's start from...") or third-person narrative
  • Start by hooking the reader with a specific scene/event, do not start from "background"
  • Have structure: opening hook → core event/concept → technical details → impact/significance → conclusion
  • Have your own viewpoint, not a news retelling
  • Code examples, data, and citations must be accurate and come from the source materials
  • Length: 2000-4000 characters
  • Language: Chinese

File naming and storage:

/agent/articles/drafts/{slug}-{YYYY-MM-DD}.md

slug: English kebab-case, 2-4 words, from the article topic

Frontmatter:

---
title: 文章标题
date: YYYY-MM-DD
source: 原文URL
tags: [tag1, tag2]
digest: 文章摘要(≤15字,发布时传给微信)
---

Summary requirements:

  • No more than 15 characters
  • Point out the core event/conclusion, not a restatement of the title
  • Example: "AI supply chain hijacked, thousands of apps quietly compromised"

📢 Output ✅ Step 1 完成:文章写好,约 {字数} 字,保存至 {路径}, then in the same response immediately start the tool call for Step 2 (creating illustration prompts).


Step 2: Article Illustrations (Add Illustrations)

Skill: baoyu-article-illustrator

2.1 Analyze the article and plan illustrations

Read the article and determine:

  • Content type → choose preset
    • Technical/Security/AI → tech-explainer(infographic + blueprint)
    • Narrative + technical hybrid → tech-explainer, use timeline type for key events
    • Methodology/Framework → system-design
  • Density:per-section(at least 1 per major section)
  • Create {article-dir}/imgs/outline.md

Good illustration positions:

  • Before the beginning of the article (timeline or global overview)
  • After the explanation of key technical mechanisms (flowchart/framework diagram)
  • Data/comparison sections (infographic/comparison)
  • Summary diagram before the conclusion

2.2 Create all prompt files (BLOCKING, all must be created before generation)

Save to {article-dir}/imgs/prompts/NN-{type}-{slug}.md

Prompt quality requirements:

  • Layout: describe the overall composition
  • ZONES: each area has specific content, cannot be vague
  • LABELS: use actual numbers/terms/quotes from the article
  • COLORS: hexadecimal color values + semantic explanation
  • STYLE: for technical/security use blueprint/dark/digital style
  • ASPECT: 16:9

Content moderation safety rules(to avoid triggering OpenAI content policy):

  • ❌ "fork bomb", "malware install", "exploit", "hack", "kill process"
  • ✅ Change to describing behavior/outcome: "process multiplication", "malicious payload", "vulnerability abuse mechanism"
  • If an image is moderation_blocked rejected, immediately rewrite the prompt to describe the behavior rather than technical terms, and retry separately

2.3 Batch generation

Create {article-dir}/imgs/batch.json:

{
  "jobs": 3,
  "tasks": [
    {
      "id": "01-slug",
      "promptFiles": ["prompts/01-type-slug.md"],
      "image": "01-type-slug.png",
      "provider": "openai",
      "model": "gpt-image-1",
      "ar": "16:9",
      "quality": "2k"
    }
  ]
}
cd {article-dir}/imgs
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-imagine"
npx -y bun "$SKILL_DIR/scripts/main.ts" --batchfile batch.json --jobs 3

2.4 Insert into the article

Insert each image after the corresponding paragraph:

![描述文字](imgs/NN-type-slug.png)

📢 Output ✅ Step 2 完成:5张插图全部生成并插入文章, then immediately start the Step 3 tool call (generate cover image) in the same response.


Step 3: Cover Image

Save the cover image to {article-dir}/imgs/cover.png(wechat-api.ts reads this path by default).

3.1 Create the cover prompt

Save to {article-dir}/imgs/prompts/cover.md

Cover type selection for technical/AI articles:

  • type: conceptual
  • palette: dark
  • rendering: digital
  • Mood: bold, high contrast
  • Color scheme: deep navy blue/black background + electric red-orange (sense of threat) or cyan-blue (sense of technology)
  • No text (WeChat displays the title separately)
  • The main visual element must be strongly related to the article topic (do not use generic tech imagery)

3.2 Generate the cover

cd {article-dir}/imgs
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-imagine"
npx -y bun "$SKILL_DIR/scripts/main.ts" \
  --promptfiles "prompts/cover.md" \
  --image "cover.png" \
  --provider openai \
  --model gpt-image-1 \
  --ar 16:9 \
  --quality 2k

📢 Output ✅ Step 3 完成:封面图生成, then immediately start the Step 4 tool call (formatting) in the same response.


Step 4: Markdown → HTML (Formatting)

cd {article-dir}
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-markdown-to-html"
npx -y bun "$SKILL_DIR/scripts/main.ts" {article-file} --theme grace --cite

Default configuration:

  • Theme: grace(elegant, suitable for technical content)
  • --cite: convert external links to bottom references (WeChat-friendly)

Confirm that in the output JSON contentImages contains all illustrations before continuing.

📢 Output ✅ Step 4 完成:排版完成, then immediately start the Step 5 tool call (publish to WeChat) in the same response.


Step 5: Publish to WeChat Draft Box

cd {article-dir}
SKILL_DIR="/agent/wechat-agent-skills/skills/baoyu-post-to-wechat"
npx -y bun "$SKILL_DIR/scripts/wechat-api.ts" \
  {article-file} \
  --theme grace \
  --color blue \
  --cover imgs/cover.png

Key notes:

  • Upload .md file, do not upload .html(the script handles conversion and image upload internally)
  • Images are automatically compressed to <1MB JPEG before upload
  • On success, return media_id

📢 Final report: send ✅ Step 5 完成:已发布草稿箱,media_id: {media_id}, pipeline ends.


First-run environment check

EXTEND.md check and auto-creation

test -f "$HOME/.baoyu-skills/baoyu-article-illustrator/EXTEND.md" || mkdir -p "$HOME/.baoyu-skills/baoyu-article-illustrator" && cat > "$HOME/.baoyu-skills/baoyu-article-illustrator/EXTEND.md" << 'EOF'
---
version: 1
watermark:
  enabled: false
  content: ""
  position: bottom-right
  opacity: 0.7
preferred_style:
  name: null
  description: ""
default_output_dir: imgs-subdir
language: zh
custom_styles: []
---
EOF

test -f "$HOME/.baoyu-skills/baoyu-imagine/EXTEND.md" || mkdir -p "$HOME/.baoyu-skills/baoyu-imagine" && cat > "$HOME/.baoyu-skills/baoyu-imagine/EXTEND.md" << 'EOF'
---
version: 1
default_provider: openai
default_quality: 2k
default_aspect_ratio: null
default_image_size: null
default_model:
  google: null
  openai: gpt-image-1
  azure: null
  openrouter: null
  dashscope: null
  minimax: null
  replicate: null
---
EOF

test -f "$HOME/.baoyu-skills/baoyu-cover-image/EXTEND.md" || mkdir -p "$HOME/.baoyu-skills/baoyu-cover-image" && cat > "$HOME/.baoyu-skills/baoyu-cover-image/EXTEND.md" << 'EOF'
---
version: 1
watermark:
  enabled: false
  content: ""
  position: bottom-right
  opacity: 0.7
preferred_type: null
preferred_palette: null
preferred_rendering: null
preferred_text: title-only
preferred_mood: balanced
preferred_font: clean
default_aspect: 16:9
default_output_dir: imgs-subdir
quick_mode: false
language: zh
custom_palettes: []
---
EOF

test -f "$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md" || mkdir -p "$HOME/.baoyu-skills/baoyu-post-to-wechat" && cat > "$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md" << 'EOF'
default_theme: grace
default_color: blue
default_publish_method: api
default_author: 宝玉
need_open_comment: 1
only_fans_can_comment: 0
EOF

npm dependency check

ls /agent/skills/baoyu-skills/node_modules/jimp 2>/dev/null || \
  (cd /agent/skills/baoyu-skills && npm install jimp @jsquash/webp)

Completion report

WeChat Full Pipeline Complete!

选题: [topic]
来源: [source URL]
文章: [article path]
插图: X 张
封面: imgs/cover.png
主题: grace + blue

✓ 已发布至公众号草稿箱
• media_id: [media_id]

→ 草稿箱: https://mp.weixin.qq.com(内容管理 → 草稿箱)