zhy-wechat-writing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

微信公众号写作系统

WeChat Official Account Writing System

Purpose

Purpose

根据用户提供的主题(可选参考URL),自动完成公众号文章写作全流程:多来源检索与证据池整理、初稿生成、自审润色、参考资料整理,并可选自动配图与保存到公众号草稿箱(不提交发布)。
Automatically complete the full process of official account article writing based on the topic provided by the user (optional reference URLs): multi-source retrieval and evidence pool organization, first draft generation, self-review and polishing, reference material organization, with optional automatic illustration and saving to the official account draft box (no submission for publication).

When to Use

When to Use

  • 用户请求"写一篇关于XXX的公众号文章"
  • 用户请求"生成公众号文章,主题是XXX"
  • 用户需要完整的公众号文章创作流程
  • 用户希望"写完后自动配图"或"写完后发到公众号草稿箱"
  • User requests "Write a WeChat official account article about XXX"
  • User requests "Generate a WeChat official account article with the topic XXX"
  • User needs a complete WeChat official account article creation process
  • User hopes to "automatically add illustrations after writing" or "send to the official account draft box after writing"

Prerequisites

Prerequisites

执行前需要确认:
  • 用户已提供文章主题(
    topic
  • 如有参考文章 URL,可一并提供(
    urls
  • topic
    为纯中文且未提供
    slug
    ,建议补充英文/拼音
    kebab-case
    目录名;否则会使用 ASCII 降级方案
Before execution, confirm:
  • The user has provided the article topic (
    topic
    )
  • If there are reference article URLs, they can be provided together (
    urls
    )
  • If
    topic
    is purely Chinese and no
    slug
    is provided, it is recommended to supplement with an English/pinyin kebab-case directory name; otherwise, the ASCII downgrade scheme will be used

Workflow

Workflow

按照以下步骤顺序执行(产物默认落盘到
articles/<slug>/...
,便于复跑与追溯):
Execute in the following order (products are saved to
articles/<slug>/...
by default, facilitating re-running and traceability):

Phase 0: Preflight

Phase 0: Preflight

目标:确定可稳定复用的目录与路径规范
操作
  1. 计算
    slug
    • 若用户提供
      slug
      :直接使用(推荐:英文/拼音kebab-case)
    • topic
      含拉丁字母/数字:对其做kebab-case
    • 否则降级:
      wechat-article-YYYYMMDD
  2. 创建目录:
    • articles/<slug>/
    • articles/<slug>/sources/
  3. 规范:Markdown图片引用必须使用相对路径与
    /
    分隔符
Goal: Determine stable and reusable directory and path specifications
Operations:
  1. Calculate
    slug
    • If the user provides
      slug
      : use it directly (recommended: English/pinyin kebab-case)
    • If
      topic
      contains Latin letters/numbers: convert it to kebab-case
    • Otherwise, downgrade to:
      wechat-article-YYYYMMDD
  2. Create directories:
    • articles/<slug>/
    • articles/<slug>/sources/
  3. Specification: Markdown image references must use relative paths and
    /
    separators

Step 1: 素材搜集

Step 1: Material Collection

目标:搜集与主题相关的素材,并整理为可追溯的证据池
操作
  1. 若用户提供
    urls
    :并行使用
    webfetch
    获取内容,提取要点,并记录URL与可获得的发布日期
  2. 若用户未提供
    urls
    :并行使用
    WebSearch
    做多来源检索(建议覆盖:官方文档 / X(Twitter) / Reddit / 技术论坛 / 微信公众号 / 工程实践)
    • official/authority:官方文档、标准/规范、权威媒体解读
    • community:X(Twitter)、Reddit、论坛/讨论
    • practice:GitHub issues、工程博客、案例复盘
    • 推荐并行 query 模板(按需组合,尽量加年份/时间范围以强调近期):
      • {topic} official documentation
        /
        {topic} release notes 2025 2026
      • {topic} site:x.com
        /
        {topic} site:twitter.com
      • {topic} site:reddit.com
        /
        {topic} site:reddit.com/r/<subreddit>
      • {topic} site:github.com issues
        /
        {topic} site:github.com discussions
      • {topic} site:stackoverflow.com
        /
        {topic} site:news.ycombinator.com
      • {topic} site:mp.weixin.qq.com
        (公众号)
      • {topic} 实战 复盘 踩坑 2025 2026
        (中文工程实践)
  3. 合并去重,按可信度分级(high/medium/low),形成证据池,落盘:
    • articles/<slug>/sources/evidence.md
工具映射
  • 本流程中的“搜索”使用:
    WebSearch
  • 本流程中的“抓取网页内容”使用:
    webfetch
关于 WebSearch(实现说明)
  • 优先使用运行环境自带的
    WebSearch
    工具。
  • 若当前环境没有可用的
    WebSearch
    :用
    webfetch
    抓取公开搜索结果页(SERP),从结果中提取 URL 列表后再并行
    webfetch
    正文内容。
证据池条目格式(每条必须包含)
  • title
  • url
  • published_at(可得则写)
  • source_type(official/community/practice)
  • key_takeaways(3-6条要点,尽量可直接改写成正文素材)
  • confidence(high/medium/low)
停止条件(建议)
  • 候选来源 8-12 条,其中 medium/high >= 5 条
常见失败处理(新增)
  • X/Reddit 登录墙或无法抓取正文:
    • 优先选择可公开访问的镜像/引用(二手报道需标注
      confidence=low/medium
      ),或改抓同一观点的博客/论坛转载;
    • 若必须引用原帖:只使用 WebSearch 结果摘要 + 其他独立来源佐证,不编造细节。
  • SERP 抓取/解析失败(无 WebSearch 回退路径时):
    • 改用“站内检索”策略:直接用
      webfetch
      抓官方站点的搜索/博客索引页或 GitHub 搜索页;
    • 仍无法覆盖时:向用户要 3-5 个关键 URL 或指定信息源清单。
  • 去重与可信度:
    • 同一事实至少 2 个独立来源佐证;
    • 官方/一手文档优先标
      high
      ;社区讨论若无落地细节或无交叉验证标
      low
输出
sources_path
(证据池路径)

Goal: Collect materials related to the topic and organize them into a traceable evidence pool
Operations:
  1. If the user provides
    urls
    : use
    webfetch
    in parallel to obtain content, extract key points, and record the URL and available publication date
  2. If the user does not provide
    urls
    : use
    WebSearch
    in parallel for multi-source retrieval (recommended coverage: official documents / X(Twitter) / Reddit / technical forums / WeChat official accounts / engineering practices)
    • official/authority: official documents, standards/specifications, authoritative media interpretations
    • community: X(Twitter), Reddit, forums/discussions
    • practice: GitHub issues, engineering blogs, case reviews
    • Recommended parallel query templates (combine as needed, try to add years/time ranges to emphasize recent content):
      • {topic} official documentation
        /
        {topic} release notes 2025 2026
      • {topic} site:x.com
        /
        {topic} site:twitter.com
      • {topic} site:reddit.com
        /
        {topic} site:reddit.com/r/<subreddit>
      • {topic} site:github.com issues
        /
        {topic} site:github.com discussions
      • {topic} site:mp.weixin.qq.com
        (WeChat official accounts)
      • {topic} practical review pitfalls 2025 2026
        (Chinese engineering practices)
  3. Merge and deduplicate, grade by credibility (high/medium/low), form an evidence pool, and save it to:
    • articles/<slug>/sources/evidence.md
Tool Mapping:
  • "Search" in this process uses:
    WebSearch
  • "Fetch web page content" in this process uses:
    webfetch
About WebSearch (Implementation Notes):
  • Priority is given to using the
    WebSearch
    tool built into the runtime environment.
  • If no available
    WebSearch
    is present in the current environment: use
    webfetch
    to crawl public search results pages (SERP), extract the URL list from the results, then use
    webfetch
    in parallel to obtain the main content.
Evidence Pool Entry Format (Each entry must include):
  • title
  • url
  • published_at (if available)
  • source_type (official/community/practice)
  • key_takeaways (3-6 key points, preferably directly adaptable to main content materials)
  • confidence (high/medium/low)
Stop Conditions (Recommended):
  • 8-12 candidate sources, with medium/high >= 5 sources
Common Failure Handling (Newly Added):
  • X/Reddit login wall or inability to crawl main content:
    • Prioritize publicly accessible mirrors/references (second-hand reports must be marked
      confidence=low/medium
      ), or switch to crawling blogs/forum reposts with the same viewpoint;
    • If original posts must be cited: only use WebSearch result summaries + other independent sources for corroboration, do not fabricate details.
  • SERP crawling/parsing failure (when no WebSearch fallback path is available):
    • Switch to the "site-specific retrieval" strategy: directly use
      webfetch
      to crawl the official site's search/blog index page or GitHub search page;
    • If coverage is still not possible: ask the user for 3-5 key URLs or a specified list of information sources.
  • Deduplication and credibility:
    • At least 2 independent sources to corroborate the same fact;
    • Official/primary documents are prioritized as
      high
      ; community discussions without implementation details or cross-validation are marked
      low
      .
Output:
sources_path
(evidence pool path)

Step 2: 初稿生成

Step 2: First Draft Generation

目标:基于素材生成公众号文章初稿
写作要求
  1. 标题:吸引眼球,可使用以下技巧
    • 数字型:
      5个方法让你...
    • 提问型:
      为什么...?
    • 对比型:
      A与B的区别...
    • 悬念型:
      你不知道的...
  2. 开头(前3-5行):
    • 提出痛点或引发共鸣
    • 设置悬念或提出问题
    • 明确文章价值
  3. 正文结构
    • 使用小标题分段(## 或 ###)
    • 每段200-300字
    • 包含案例、数据支撑
    • 使用列表增强可读性
  4. 结尾
    • 总结核心观点
    • 引导互动(点赞、在看、评论)
    • 可添加金句或行动呼吁
  5. 字数要求:1500-2500字
  6. 可追溯性要求(新增硬约束)
    • 关键事实/数据/结论必须能在证据池中找到支撑
    • 文章末尾必须追加
      ## 参考资料/来源
      (5-10条链接,尽量带日期)
输出:Markdown 格式初稿,保存到:
articles/<slug>/article.md

Goal: Generate the first draft of the official account article based on materials
Writing Requirements:
  1. Title: Eye-catching, can use the following techniques
    • Number type:
      5 Methods to Help You...
    • Question type:
      Why...?
    • Comparison type:
      Differences Between A and B...
    • Suspense type:
      Things You Don't Know About...
  2. Opening (First 3-5 lines):
    • Present pain points or resonate with readers
    • Set suspense or raise questions
    • Clarify the value of the article
  3. Main Content Structure:
    • Use subheadings for segmentation (## or ###)
    • 200-300 words per paragraph
    • Include cases and data support
    • Use lists to enhance readability
  4. Conclusion:
    • Summarize core viewpoints
    • Guide interaction (likes, "read later", comments)
    • Can add golden sentences or calls to action
  5. Word Count Requirement: 1500-2500 words
  6. Traceability Requirement (New Hard Constraint):
    • Key facts/data/conclusions must be supported by the evidence pool
    • The end of the article must append
      ## References/Sources
      (5-10 links, preferably with dates)
Output: First draft in Markdown format, saved to:
articles/<slug>/article.md

Step 3: 智能审稿

Step 3: Intelligent Review

目标:从四个维度审稿,发现问题
审稿维度
维度检查要点权重
逻辑论点清晰、论据充分、推理合理30%
表达语言流畅、无AI痕迹、口语化适度25%
数据数据准确、案例恰当、引用规范25%
结构标题吸引、段落分明、首尾呼应20%
新增硬检查
  • 可追溯性:关键论断是否能在证据池中找到支撑
  • 标题一致性:标题承诺是否在正文明确兑现
审稿操作
  1. 逐段检查逻辑连贯性
  2. 标记AI痕迹词汇(如"综上所述"、"不难看出"等)
  3. 验证数据和案例的准确性
  4. 检查结构和节奏
评分标准
  • 90-100分:优秀,可直接发布
  • 80-89分:良好,小幅优化即可
  • 70-79分:合格,需要修改
  • 70分以下:需要重写
输出:审稿报告(包含问题和修改建议),建议保存到:
articles/<slug>/sources/review.md

Goal: Review the article from four dimensions to identify issues
Review Dimensions:
DimensionCheck PointsWeight
LogicClear arguments, sufficient evidence, reasonable reasoning30%
ExpressionFluent language, no AI traces, appropriate colloquialism25%
DataAccurate data, appropriate cases, standardized citations25%
StructureEye-catching title, clear paragraphs, echo between beginning and end20%
New Hard Checks:
  • Traceability: Whether key assertions are supported by the evidence pool
  • Title Consistency: Whether the title's promise is clearly fulfilled in the main content
Review Operations:
  1. Check logical coherence paragraph by paragraph
  2. Mark AI trace vocabulary (such as "To sum up", "It is not difficult to see", etc.)
  3. Verify the accuracy of data and cases
  4. Check structure and rhythm
Scoring Standards:
  • 90-100 points: Excellent, can be published directly
  • 80-89 points: Good, minor optimizations needed
  • 70-79 points: Qualified, needs revision
  • Below 70 points: Needs rewriting
Output: Review report (including issues and revision suggestions), recommended to be saved to:
articles/<slug>/sources/review.md

Step 4: 润色打磨

Step 4: Polishing

目标:修复问题,提升文章质量
润色操作
  1. 去除AI痕迹
    • 替换词汇:
      • 综上所述
        总的来说
      • 总而言之
        说到底
      • 由此可见
        所以说
      • 不难看出
        我们能发现
      • 众所周知
        大家都知道
    • 避免过于书面化的表达
  2. 增强口语化
    • 适当添加:
      其实
      说实话
      不得不说
    • 使用短句,避免长难句
    • 加入过渡词,增强流畅度
  3. 优化节奏
    • 长短句结合
    • 适当使用感叹句、反问句
    • 控制段落长度(建议不超过5行)
  4. 修复审稿问题
    • 根据审稿报告逐项修复
    • 补充缺失的数据或案例
    • 调整不合理的结构
输出:最终文章
强制要求(新增)
  • 最终文章必须保留或补齐
    ## 参考资料/来源
  • 参考资料建议保留 5-10 条,按
    official
    /
    community
    /
    practice
    分组更佳

Goal: Fix issues and improve article quality
Polishing Operations:
  1. Remove AI Traces
    • Replace vocabulary:
      • 综上所述
        All in all
      • 总而言之
        To put it simply
      • 由此可见
        So we can see
      • 不难看出
        We can find that
      • 众所周知
        As we all know
    • Avoid overly formal expressions
  2. Enhance Colloquialism
    • Appropriately add:
      Actually
      ,
      To be honest
      ,
      I have to say
    • Use short sentences, avoid long and complex sentences
    • Add transition words to enhance fluency
  3. Optimize Rhythm
    • Combine long and short sentences
    • Appropriately use exclamations and rhetorical questions
    • Control paragraph length (recommended no more than 5 lines)
  4. Fix Review Issues
    • Fix items one by one according to the review report
    • Supplement missing data or cases
    • Adjust unreasonable structures
Output: Final article
Mandatory Requirements (Newly Added):
  • The final article must retain or supplement
    ## References/Sources
  • It is recommended to keep 5-10 references, grouped by
    official
    /
    community
    /
    practice
    is better

Step 5: 保存与输出

Step 5: Saving and Output

操作
  1. 创建输出目录(如果不存在):
    • articles/<slug>/
  2. 保存文章:
    • articles/<slug>/article.md
  3. 输出执行摘要:
    • article_path
    • sources_path
    • 字数统计
    • 审稿评分

Operations:
  1. Create output directory (if not exists):
    • articles/<slug>/
  2. Save article:
    • articles/<slug>/article.md
  3. Output execution summary:
    • article_path
    • sources_path
    • Word count
    • Review score

Step 6: 自动配图(可选,调用 zhy-article-illustrator)

Step 6: Automatic Illustration (Optional, call zhy-article-illustrator)

触发条件
with_illustrations=true
目标:为文章生成统一风格的高完成度配图,并产出插图版文章
默认策略
  • article_path
    :使用
    articles/<slug>/article.md
  • slug
    :复用当前文章 slug
  • density
    illustration_density
    (默认 balanced)
  • upload
    illustration_upload
    (默认 false)
  • aspect_ratio
    illustration_aspect_ratio
    (默认 16:9)
  • prompt_profile
    illustration_prompt_profile
    (默认 nano-banana)
  • text_language
    illustration_text_language
    (默认 zh-CN)
  • english_terms_whitelist
    illustration_english_terms_whitelist
    (默认空)
  • image_provider
    illustration_image_provider
    (默认 xiaomi)
  • image_model
    illustration_image_model
    (默认 gemini-3.1-flash-image-preview)
  • image_size
    illustration_image_size
    (默认 1K)
  • image_base_url
    illustration_image_base_url
    (默认 Xiaomi 接口地址,也支持 Gemini 原生代理)
执行方式
  1. 优先调用
    zhy-article-illustrator
    的一键流程脚本:
    bash
    node <zhy-article-illustrator>/scripts/illustrate-article.ts \
      --article articles/<slug>/article.md \
      --slug <slug> \
      --density <illustration_density> \
      --aspect-ratio <illustration_aspect_ratio> \
      --prompt-profile <illustration_prompt_profile> \
      --text-language <illustration_text_language> \
      --image-provider <illustration_image_provider> \
      --image-model <illustration_image_model> \
      [--image-size <illustration_image_size>] \
      [--image-base-url <illustration_image_base_url>] \
      [--upload]
  2. illustration_english_terms_whitelist
    非空,则为每个术语追加
    --term <value>
    ,例如:
    bash
    --term Playwright --term Chromium --term Firefox --term WebKit
  3. 默认沿用新版配图策略:
    • 先生成文章级
      visual-bible.md
    • 再生成
      outline.md
      prompts/
    • 默认图片内文字为简体中文,仅白名单术语保留英文
    • 同一篇文章内所有图片共享统一风格体系
  4. 写作技能在集成时应遵循以下字段映射:
    • article_path -> --article
    • slug -> --slug
    • illustration_density -> --density
    • illustration_aspect_ratio -> --aspect-ratio
    • illustration_prompt_profile -> --prompt-profile
    • illustration_text_language -> --text-language
    • illustration_image_provider -> --image-provider
    • illustration_image_model -> --image-model
    • illustration_image_size -> --image-size
    • illustration_image_base_url -> --image-base-url
    • illustration_upload=true -> --upload
输出
  • illustrated_article_path
    :
    articles/<slug>/article.illustrated.md
  • illustrations_dir
    :
    articles/<slug>/illustrations/<slug>/
  • articles/<slug>/illustrations/<slug>/visual-bible.md
  • articles/<slug>/illustrations/<slug>/outline.md
  • articles/<slug>/illustrations/<slug>/prompts/
失败处理:单张失败可重试一次;仍失败则记录并继续,最终输出失败清单。若部分图片失败,也应保留
article.illustrated.md
,并插入图片占位注释。

Trigger Condition:
with_illustrations=true
Goal: Generate high-quality illustrations with a unified style for the article, and produce an illustrated version of the article
Default Strategy:
  • article_path
    : Use
    articles/<slug>/article.md
  • slug
    : Reuse the current article slug
  • density
    :
    illustration_density
    (default balanced)
  • upload
    :
    illustration_upload
    (default false)
  • aspect_ratio
    :
    illustration_aspect_ratio
    (default 16:9)
  • prompt_profile
    :
    illustration_prompt_profile
    (default nano-banana)
  • text_language
    :
    illustration_text_language
    (default zh-CN)
  • english_terms_whitelist
    :
    illustration_english_terms_whitelist
    (default empty)
  • image_provider
    :
    illustration_image_provider
    (default xiaomi)
  • image_model
    :
    illustration_image_model
    (default gemini-3.1-flash-image-preview)
  • image_size
    :
    illustration_image_size
    (default 1K)
  • image_base_url
    :
    illustration_image_base_url
    (default Xiaomi API address, also supports Gemini native proxy)
Execution Method:
  1. Prioritize calling the one-click process script of
    zhy-article-illustrator
    :
    bash
    node <zhy-article-illustrator>/scripts/illustrate-article.ts \
      --article articles/<slug>/article.md \
      --slug <slug> \
      --density <illustration_density> \
      --aspect-ratio <illustration_aspect_ratio> \
      --prompt-profile <illustration_prompt_profile> \
      --text-language <illustration_text_language> \
      --image-provider <illustration_image_provider> \
      --image-model <illustration_image_model> \
      [--image-size <illustration_image_size>] \
      [--image-base-url <illustration_image_base_url>] \
      [--upload]
  2. If
    illustration_english_terms_whitelist
    is not empty, append
    --term <value>
    for each term, for example:
    bash
    --term Playwright --term Chromium --term Firefox --term WebKit
  3. Default to the new illustration strategy:
    • First generate the article-level
      visual-bible.md
    • Then generate
      outline.md
      and
      prompts/
    • Default text in images is Simplified Chinese, only whitelisted terms retain English
    • All images in the same article share a unified style system
  4. When integrating writing skills, follow the following field mapping:
    • article_path -> --article
    • slug -> --slug
    • illustration_density -> --density
    • illustration_aspect_ratio -> --aspect-ratio
    • illustration_prompt_profile -> --prompt-profile
    • illustration_text_language -> --text-language
    • illustration_image_provider -> --image-provider
    • illustration_image_model -> --image-model
    • illustration_image_size -> --image-size
    • illustration_image_base_url -> --image-base-url
    • illustration_upload=true -> --upload
Output:
  • illustrated_article_path
    :
    articles/<slug>/article.illustrated.md
  • illustrations_dir
    :
    articles/<slug>/illustrations/<slug>/
  • articles/<slug>/illustrations/<slug>/visual-bible.md
  • articles/<slug>/illustrations/<slug>/outline.md
  • articles/<slug>/illustrations/<slug>/prompts/
Failure Handling: Retry once for single image failure; if still failed, record and continue, finally output the failure list. If some images fail,
article.illustrated.md
should still be retained, and image placeholder comments inserted.

Step 7: HTML 主题样式输出(可选,调用 zhy-markdown2wechat)

Step 7: HTML Theme Style Output (Optional, call zhy-markdown2wechat)

触发条件
with_html_theme=true
目标:使用
zhy-markdown2wechat
技能将 Markdown 转换为带微信内联样式的 HTML
操作
  1. 选择输入文件:
    • with_illustrations=true
      articles/<slug>/article.illustrated.md
      存在,则使用该文件
    • 否则使用
      articles/<slug>/article.md
  2. 将选中的 Markdown 文件记为
    <input_markdown>
  3. 调用
    zhy-markdown2wechat
    技能,执行转换脚本:
    bash
    node <zhy-markdown2wechat>/scripts/convert.js \
     <input_markdown> \
     <zhy-markdown2wechat>/resources/themes/default.css \
     articles/<slug>/article.zhy.html
    • 脚本零依赖(纯 Node.js),无需
      npm install
      ,自动在临时目录处理后清理
    • 输出包含
      <section id="MdWechat">
      容器与完整内联 CSS 样式
    • 如需换肤,可将第二个参数替换为
      resources/themes/
      下的其他主题文件(
      apple.css
      /
      blue.css
      /
      dark.css
      /
      green.css
      /
      notion.css
      /
      vibrant.css
    • <zhy-markdown2wechat>
      表示当前环境中该技能的安装目录,运行时应以实际路径为准
  4. 输入文件示例:
    • 若存在插图版文章:
      <input_markdown>=articles/<slug>/article.illustrated.md
    • 若不存在插图版文章:
      <input_markdown>=articles/<slug>/article.md
输出
html_article_path
articles/<slug>/article.zhy.html
失败处理:记录错误并在执行摘要中注明原因,跳过该步骤并继续后续流程

Trigger Condition:
with_html_theme=true
Goal: Use the
zhy-markdown2wechat
skill to convert Markdown to HTML with WeChat inline styles
Operations:
  1. Select input file:
    • If
      with_illustrations=true
      and
      articles/<slug>/article.illustrated.md
      exists, use this file
    • Otherwise, use
      articles/<slug>/article.md
  2. Record the selected Markdown file as
    <input_markdown>
  3. Call the
    zhy-markdown2wechat
    skill and execute the conversion script:
    bash
    node <zhy-markdown2wechat>/scripts/convert.js \
     <input_markdown> \
     <zhy-markdown2wechat>/resources/themes/default.css \
     articles/<slug>/article.zhy.html
    • The script has zero dependencies (pure Node.js), no need for
      npm install
      , automatically processes in a temporary directory and cleans up afterwards
    • Output includes a
      <section id="MdWechat">
      container and complete inline CSS styles
    • To change the theme, replace the second parameter with other theme files under
      resources/themes/
      (
      apple.css
      /
      blue.css
      /
      dark.css
      /
      green.css
      /
      notion.css
      /
      vibrant.css
      )
    • <zhy-markdown2wechat>
      refers to the installation directory of this skill in the current environment, use the actual path during runtime
  4. Input file examples:
    • If illustrated article exists:
      <input_markdown>=articles/<slug>/article.illustrated.md
    • If illustrated article does not exist:
      <input_markdown>=articles/<slug>/article.md
Output:
html_article_path
(
articles/<slug>/article.zhy.html
)
Failure Handling: Record the error and note the reason in the execution summary, skip this step and continue with subsequent processes

Step 8: 保存到公众号草稿箱(可选,调用 zhy-wechat-publish)

Step 8: Save to Official Account Draft Box (Optional, call zhy-wechat-publish)

触发条件
post_to_wechat=true
默认行为:通过微信官方 API 保存到草稿箱,不做最终发布提交
前置条件
  • zhy-wechat-publish
    技能目录下的
    .env
    已配置
    WECHAT_APP_ID
    WECHAT_APP_SECRET
  • 运行机器的公网 IP 已加入微信公众号后台 IP 白名单
  • 若要自动生成封面,发布技能依赖的生图环境也必须可用(由
    zhy-article-illustrator
    提供)
调用方式
  • 正文必须是带内联样式的 HTML 文件
  • 优先使用 Step 7 生成的
    article.zhy.html
    ;若不存在则跳过本步骤(或先补执行 Step 7)
  • 默认推荐的稳定入口是直接调用
    wechat_draft.js
    bash
    node <zhy-wechat-publish>/scripts/wechat_draft.js \
      --title "文章标题" \
      --file "articles/<slug>/article.zhy.html" \
      [--author "作者"] \
      [--digest "摘要"] \
      [--thumb "封面media_id"] \
      [--source-url "原文链接"] \
      [--need-open-comment "1"] \
      [--only-fans-can-comment "1"]
  • 若希望自动生成封面并发布,也可调用:
    bash
    node <zhy-wechat-publish>/scripts/publish_with_cover.js \
      --article "articles/<slug>/article.md" \
      --html "articles/<slug>/article.zhy.html" \
      [--title "文章标题"] \
      [--author "作者"] \
      [--source-url "原文链接"] \
      [--need-open-comment "1"] \
      [--only-fans-can-comment "1"]
  • <zhy-wechat-publish>
    表示当前环境中该技能的安装目录,运行时应以实际路径为准
  • wechat_draft.js
    未提供
    --thumb
    时会自动读取
    .env
    中的
    WECHAT_DEFAULT_THUMB_MEDIA_ID
  • publish_with_cover.js
    会自动从文章中提取标题/摘要、生成单张 16:9 封面、上传封面,并将返回的
    media_id
    作为
    thumb_media_id
  • 发布脚本会在上传前自动展开 HTML 中的
    var(--xxx)
    样式变量,避免微信草稿箱丢失颜色与边框样式
  • 发布脚本会在上传前自动将正文中的图片上传到微信正文图片接口,并将
    <img src>
    替换为微信返回的图片 URL
  • 发布脚本会在上传前将原生列表结构降级为“普通段落 + 圆点/编号”,以兼容微信草稿箱再次进入编辑模式时的列表解析问题
注意
  • 脚本零依赖(纯 Node.js >= 16),无需
    npm install
  • 使用
    publish_with_cover.js
    时,需要本机可用
    bun
    ,因为封面生成会复用现有生图脚本
  • 草稿保存后不会自动提交发布,需人工在公众号后台确认
  • 标题长度不得超过 64 字符
  • 若当前环境没有可用生图配置,优先改用
    wechat_draft.js
    直接上传 HTML,避免自动封面步骤失败
成功标准:输出
上传草稿成功! 草稿 MEDIA_ID: xxx
失败排障清单
错误信息原因与处理
[40013] invalid appid
AppID 错误,检查发布技能目录下的
.env
[40164] invalid ip
当前 IP 未加白名单,将报错中的 IP 加入公众号后台
[40007] invalid media_id
封面图 ID 无效,使用
upload_image.js
重新上传获取
缺少 Xiaomi/Gemini/OpenAI API Key
自动封面生成依赖的生图环境未配置,检查
zhy-article-illustrator
相关
.env
article.zhy.html
不存在
Step 7 未执行或失败,检查
with_html_theme=true
标题过长控制标题 <= 64 字符

Trigger Condition:
post_to_wechat=true
Default Behavior: Save to the draft box via the official WeChat API, no final publication submission
Prerequisites:
  • WECHAT_APP_ID
    and
    WECHAT_APP_SECRET
    have been configured in the
    .env
    file under the
    zhy-wechat-publish
    skill directory
  • The public IP of the running machine has been added to the IP whitelist in the WeChat official account backend
  • To automatically generate a cover image, the image generation environment dependent on the publishing skill must also be available (provided by
    zhy-article-illustrator
    )
Calling Method:
  • The main content must be an HTML file with inline styles
  • Prioritize using
    article.zhy.html
    generated in Step 7; if it does not exist, skip this step (or first complete Step 7)
  • The recommended stable entry is to directly call
    wechat_draft.js
    :
    bash
    node <zhy-wechat-publish>/scripts/wechat_draft.js \
      --title "Article Title" \
      --file "articles/<slug>/article.zhy.html" \
      [--author "Author"] \
      [--digest "Abstract"] \
      [--thumb "Cover media_id"] \
      [--source-url "Original Link"] \
      [--need-open-comment "1"] \
      [--only-fans-can-comment "1"]
  • To automatically generate a cover image and publish, you can also call:
    bash
    node <zhy-wechat-publish>/scripts/publish_with_cover.js \
      --article "articles/<slug>/article.md" \
      --html "articles/<slug>/article.zhy.html" \
      [--title "Article Title"] \
      [--author "Author"] \
      [--source-url "Original Link"] \
      [--need-open-comment "1"] \
      [--only-fans-can-comment "1"]
  • <zhy-wechat-publish>
    refers to the installation directory of this skill in the current environment, use the actual path during runtime
  • When
    --thumb
    is not provided in
    wechat_draft.js
    , it will automatically read
    WECHAT_DEFAULT_THUMB_MEDIA_ID
    from
    .env
  • publish_with_cover.js
    will automatically extract the title/abstract from the article, generate a 16:9 cover image, upload the cover image, and use the returned
    media_id
    as
    thumb_media_id
  • The publishing script will automatically expand
    var(--xxx)
    style variables in the HTML before uploading to avoid loss of colors and border styles in the WeChat draft box
  • The publishing script will automatically upload images in the main content to the WeChat main content image interface before uploading, and replace
    <img src>
    with the image URL returned by WeChat
  • The publishing script will automatically downgrade the native list structure to "ordinary paragraphs + dots/numbers" before uploading to resolve the list parsing issue when re-entering edit mode in the WeChat draft box
Notes:
  • The script has zero dependencies (pure Node.js >= 16), no need for
    npm install
  • When using
    publish_with_cover.js
    ,
    bun
    must be available locally, as the cover image generation reuses existing image generation scripts
  • After saving the draft, it will not be automatically submitted for publication; manual confirmation in the official account backend is required
  • The title length cannot exceed 64 characters
  • If no available image generation configuration exists in the current environment, prioritize using
    wechat_draft.js
    to directly upload HTML to avoid failure in the automatic cover image step
Success Criteria: Output
Upload draft successfully! Draft MEDIA_ID: xxx
Failure Troubleshooting List:
Error MessageCause and Handling
[40013] invalid appid
Incorrect AppID, check
.env
under the publishing skill directory
[40164] invalid ip
Current IP not in whitelist, add the IP in the error message to the official account backend
[40007] invalid media_id
Invalid cover image ID, re-upload using
upload_image.js
to obtain a new one
Missing Xiaomi/Gemini/OpenAI API Key
Image generation environment dependent on automatic cover image generation not configured, check
.env
related to
zhy-article-illustrator
article.zhy.html
does not exist
Step 7 not executed or failed, check
with_html_theme=true
Title too longControl title <= 64 characters

Data Flow

Data Flow

用户输入(topic, urls?, slug?, search_count?, time_range_days?, ...)
Preflight(确定slug与目录)
素材搜集(WebSearch + webfetch → evidence.md)
初稿生成(article.md)
智能审稿(含可追溯性/标题一致性)
润色打磨(强制References)
自动配图(article.illustrated.md + illustrations/)
HTML 主题样式输出(zhy-markdown2wechat → article.zhy.html)
保存到草稿箱(不提交发布)
User Input (topic, urls?, slug?, search_count?, time_range_days?, ...)
Preflight (Determine slug and directory)
Material Collection (WebSearch + webfetch → evidence.md)
First Draft Generation (article.md)
Intelligent Review (including traceability/title consistency)
Polishing (Mandatory References)
Automatic Illustration (article.illustrated.md + illustrations/)
HTML Theme Style Output (zhy-markdown2wechat → article.zhy.html)
Save to Draft Box (No submission for publication)

Error Handling

Error Handling

异常情况处理方式
搜索无结果提示用户提供更多信息或参考URL
参考文章无法访问跳过该URL,继续处理其他素材
初稿质量过低重新生成或提示用户提供更多素材
审稿评分<70建议用户检查主题是否合适
配图失败输出失败清单;可选择补图后再发布
HTML 转换失败记录错误并跳过该步骤(Step 7),继续后续流程
发布到草稿箱失败输出排障清单(AppID/IP白名单/封面media_id/标题长度)
ExceptionHandling Method
No search resultsPrompt user to provide more information or reference URLs
Reference article inaccessibleSkip this URL and continue processing other materials
Low quality of first draftRegenerate or prompt user to provide more materials
Review score <70Suggest user check if the topic is appropriate
Illustration failureOutput failure list; can choose to supplement images before publishing
HTML conversion failureRecord error and skip this step (Step 7), continue with subsequent processes
Failure to save to draft boxOutput troubleshooting list (AppID/IP whitelist/cover media_id/title length)

Example Usage

Example Usage

输入
topic: "如何提高工作效率"
urls: ["https://mp.weixin.qq.com/xxx"]
search_count: 5
with_illustrations: true
with_html_theme: true
post_to_wechat: true
执行流程
  1. 搜索"如何提高工作效率"相关文章
  2. 获取用户提供的参考文章内容
  3. 生成初稿(约1500-2500字)
  4. 审稿评分:85分
  5. 润色优化后保存
输出
article_path: articles/how-to-improve-work-efficiency/article.md
sources_path: articles/how-to-improve-work-efficiency/sources/evidence.md
illustrated_article_path: articles/how-to-improve-work-efficiency/article.illustrated.md
illustrations_dir: articles/how-to-improve-work-efficiency/illustrations/how-to-improve-work-efficiency/
html_article_path: articles/how-to-improve-work-efficiency/article.zhy.html
word_count: 2150
review_score: 92
wechat_draft_status: success
Input:
topic: "How to Improve Work Efficiency"
urls: ["https://mp.weixin.qq.com/xxx"]
search_count: 5
with_illustrations: true
with_html_theme: true
post_to_wechat: true
Execution Process:
  1. Search for articles related to "How to Improve Work Efficiency"
  2. Obtain content of the reference article provided by the user
  3. Generate first draft (about 1500-2500 words)
  4. Review score: 85 points
  5. Polish and optimize, then save
Output:
article_path: articles/how-to-improve-work-efficiency/article.md
sources_path: articles/how-to-improve-work-efficiency/sources/evidence.md
illustrated_article_path: articles/how-to-improve-work-efficiency/article.illustrated.md
illustrations_dir: articles/how-to-improve-work-efficiency/illustrations/how-to-improve-work-efficiency/
html_article_path: articles/how-to-improve-work-efficiency/article.zhy.html
word_count: 2150
review_score: 92
wechat_draft_status: success

Notes

Notes

  • 文章风格应符合公众号调性:轻松、有用、有共鸣
  • 避免敏感内容和过度营销
  • 保持原创性,不要直接复制素材内容
  • The article style should conform to the official account's tone: relaxed, useful, and resonant
  • Avoid sensitive content and excessive marketing
  • Maintain originality, do not directly copy material content