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目录名;否则会使用 ASCII 降级方案kebab-case
Before execution, confirm:
- The user has provided the article topic ()
topic - If there are reference article URLs, they can be provided together ()
urls - If is purely Chinese and no
topicis provided, it is recommended to supplement with an English/pinyin kebab-case directory name; otherwise, the ASCII downgrade scheme will be usedslug
Workflow
Workflow
按照以下步骤顺序执行(产物默认落盘到 ,便于复跑与追溯):
articles/<slug>/...Execute in the following order (products are saved to by default, facilitating re-running and traceability):
articles/<slug>/...Phase 0: Preflight
Phase 0: Preflight
目标:确定可稳定复用的目录与路径规范
操作:
- 计算
slug- 若用户提供 :直接使用(推荐:英文/拼音kebab-case)
slug - 若 含拉丁字母/数字:对其做kebab-case
topic - 否则降级:
wechat-article-YYYYMMDD
- 若用户提供
- 创建目录:
articles/<slug>/articles/<slug>/sources/
- 规范:Markdown图片引用必须使用相对路径与 分隔符
/
Goal: Determine stable and reusable directory and path specifications
Operations:
- Calculate
slug- If the user provides : use it directly (recommended: English/pinyin kebab-case)
slug - If contains Latin letters/numbers: convert it to kebab-case
topic - Otherwise, downgrade to:
wechat-article-YYYYMMDD
- If the user provides
- Create directories:
articles/<slug>/articles/<slug>/sources/
- Specification: Markdown image references must use relative paths and separators
/
Step 1: 素材搜集
Step 1: Material Collection
目标:搜集与主题相关的素材,并整理为可追溯的证据池
操作:
- 若用户提供 :并行使用
urls获取内容,提取要点,并记录URL与可获得的发布日期webfetch - 若用户未提供 :并行使用
urls做多来源检索(建议覆盖:官方文档 / X(Twitter) / Reddit / 技术论坛 / 微信公众号 / 工程实践)WebSearch- 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
- 合并去重,按可信度分级(high/medium/low),形成证据池,落盘:
articles/<slug>/sources/evidence.md
工具映射:
- 本流程中的“搜索”使用:
WebSearch - 本流程中的“抓取网页内容”使用:
webfetch
关于 WebSearch(实现说明):
- 优先使用运行环境自带的 工具。
WebSearch - 若当前环境没有可用的 :用
WebSearch抓取公开搜索结果页(SERP),从结果中提取 URL 列表后再并行webfetch正文内容。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 回退路径时):
- 改用“站内检索”策略:直接用 抓官方站点的搜索/博客索引页或 GitHub 搜索页;
webfetch - 仍无法覆盖时:向用户要 3-5 个关键 URL 或指定信息源清单。
- 改用“站内检索”策略:直接用
- 去重与可信度:
- 同一事实至少 2 个独立来源佐证;
- 官方/一手文档优先标 ;社区讨论若无落地细节或无交叉验证标
high。low
输出:(证据池路径)
sources_pathGoal: Collect materials related to the topic and organize them into a traceable evidence pool
Operations:
- If the user provides : use
urlsin parallel to obtain content, extract key points, and record the URL and available publication datewebfetch - If the user does not provide : use
urlsin parallel for multi-source retrieval (recommended coverage: official documents / X(Twitter) / Reddit / technical forums / WeChat official accounts / engineering practices)WebSearch- 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 - (WeChat official accounts)
{topic} site:mp.weixin.qq.com - (Chinese engineering practices)
{topic} practical review pitfalls 2025 2026
- 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 tool built into the runtime environment.
WebSearch - If no available is present in the current environment: use
WebSearchto crawl public search results pages (SERP), extract the URL list from the results, then usewebfetchin parallel to obtain the main content.webfetch
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 ), or switch to crawling blogs/forum reposts with the same viewpoint;
confidence=low/medium - If original posts must be cited: only use WebSearch result summaries + other independent sources for corroboration, do not fabricate details.
- Prioritize publicly accessible mirrors/references (second-hand reports must be marked
- SERP crawling/parsing failure (when no WebSearch fallback path is available):
- Switch to the "site-specific retrieval" strategy: directly use to crawl the official site's search/blog index page or GitHub search page;
webfetch - If coverage is still not possible: ask the user for 3-5 key URLs or a specified list of information sources.
- Switch to the "site-specific retrieval" strategy: directly use
- Deduplication and credibility:
- At least 2 independent sources to corroborate the same fact;
- Official/primary documents are prioritized as ; community discussions without implementation details or cross-validation are marked
high.low
Output: (evidence pool path)
sources_pathStep 2: 初稿生成
Step 2: First Draft Generation
目标:基于素材生成公众号文章初稿
写作要求:
-
标题:吸引眼球,可使用以下技巧
- 数字型:
5个方法让你... - 提问型:
为什么...? - 对比型:
A与B的区别... - 悬念型:
你不知道的...
- 数字型:
-
开头(前3-5行):
- 提出痛点或引发共鸣
- 设置悬念或提出问题
- 明确文章价值
-
正文结构:
- 使用小标题分段(## 或 ###)
- 每段200-300字
- 包含案例、数据支撑
- 使用列表增强可读性
-
结尾:
- 总结核心观点
- 引导互动(点赞、在看、评论)
- 可添加金句或行动呼吁
-
字数要求:1500-2500字
-
可追溯性要求(新增硬约束):
- 关键事实/数据/结论必须能在证据池中找到支撑
- 文章末尾必须追加 (5-10条链接,尽量带日期)
## 参考资料/来源
输出:Markdown 格式初稿,保存到:
articles/<slug>/article.mdGoal: Generate the first draft of the official account article based on materials
Writing Requirements:
-
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...
- Number type:
-
Opening (First 3-5 lines):
- Present pain points or resonate with readers
- Set suspense or raise questions
- Clarify the value of the article
-
Main Content Structure:
- Use subheadings for segmentation (## or ###)
- 200-300 words per paragraph
- Include cases and data support
- Use lists to enhance readability
-
Conclusion:
- Summarize core viewpoints
- Guide interaction (likes, "read later", comments)
- Can add golden sentences or calls to action
-
Word Count Requirement: 1500-2500 words
-
Traceability Requirement (New Hard Constraint):
- Key facts/data/conclusions must be supported by the evidence pool
- The end of the article must append (5-10 links, preferably with dates)
## References/Sources
Output: First draft in Markdown format, saved to:
articles/<slug>/article.mdStep 3: 智能审稿
Step 3: Intelligent Review
目标:从四个维度审稿,发现问题
审稿维度:
| 维度 | 检查要点 | 权重 |
|---|---|---|
| 逻辑 | 论点清晰、论据充分、推理合理 | 30% |
| 表达 | 语言流畅、无AI痕迹、口语化适度 | 25% |
| 数据 | 数据准确、案例恰当、引用规范 | 25% |
| 结构 | 标题吸引、段落分明、首尾呼应 | 20% |
新增硬检查:
- 可追溯性:关键论断是否能在证据池中找到支撑
- 标题一致性:标题承诺是否在正文明确兑现
审稿操作:
- 逐段检查逻辑连贯性
- 标记AI痕迹词汇(如"综上所述"、"不难看出"等)
- 验证数据和案例的准确性
- 检查结构和节奏
评分标准:
- 90-100分:优秀,可直接发布
- 80-89分:良好,小幅优化即可
- 70-79分:合格,需要修改
- 70分以下:需要重写
输出:审稿报告(包含问题和修改建议),建议保存到:
articles/<slug>/sources/review.mdGoal: Review the article from four dimensions to identify issues
Review Dimensions:
| Dimension | Check Points | Weight |
|---|---|---|
| Logic | Clear arguments, sufficient evidence, reasonable reasoning | 30% |
| Expression | Fluent language, no AI traces, appropriate colloquialism | 25% |
| Data | Accurate data, appropriate cases, standardized citations | 25% |
| Structure | Eye-catching title, clear paragraphs, echo between beginning and end | 20% |
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:
- Check logical coherence paragraph by paragraph
- Mark AI trace vocabulary (such as "To sum up", "It is not difficult to see", etc.)
- Verify the accuracy of data and cases
- 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.mdStep 4: 润色打磨
Step 4: Polishing
目标:修复问题,提升文章质量
润色操作:
-
去除AI痕迹
- 替换词汇:
- →
综上所述总的来说 - →
总而言之说到底 - →
由此可见所以说 - →
不难看出我们能发现 - →
众所周知大家都知道
- 避免过于书面化的表达
- 替换词汇:
-
增强口语化
- 适当添加:、
其实、说实话不得不说 - 使用短句,避免长难句
- 加入过渡词,增强流畅度
- 适当添加:
-
优化节奏
- 长短句结合
- 适当使用感叹句、反问句
- 控制段落长度(建议不超过5行)
-
修复审稿问题
- 根据审稿报告逐项修复
- 补充缺失的数据或案例
- 调整不合理的结构
输出:最终文章
强制要求(新增):
- 最终文章必须保留或补齐
## 参考资料/来源 - 参考资料建议保留 5-10 条,按 /
official/community分组更佳practice
Goal: Fix issues and improve article quality
Polishing Operations:
-
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
- Replace vocabulary:
-
Enhance Colloquialism
- Appropriately add: ,
Actually,To be honestI have to say - Use short sentences, avoid long and complex sentences
- Add transition words to enhance fluency
- Appropriately add:
-
Optimize Rhythm
- Combine long and short sentences
- Appropriately use exclamations and rhetorical questions
- Control paragraph length (recommended no more than 5 lines)
-
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/communityis betterpractice
Step 5: 保存与输出
Step 5: Saving and Output
操作:
- 创建输出目录(如果不存在):
articles/<slug>/
- 保存文章:
articles/<slug>/article.md
- 输出执行摘要:
article_pathsources_path- 字数统计
- 审稿评分
Operations:
- Create output directory (if not exists):
articles/<slug>/
- Save article:
articles/<slug>/article.md
- Output execution summary:
article_pathsources_path- Word count
- Review score
Step 6: 自动配图(可选,调用 zhy-article-illustrator)
Step 6: Automatic Illustration (Optional, call zhy-article-illustrator)
触发条件:
with_illustrations=true目标:为文章生成统一风格的高完成度配图,并产出插图版文章
默认策略:
- :使用
article_patharticles/<slug>/article.md - :复用当前文章 slug
slug - :
density(默认 balanced)illustration_density - :
upload(默认 false)illustration_upload - :
aspect_ratio(默认 16:9)illustration_aspect_ratio - :
prompt_profile(默认 nano-banana)illustration_prompt_profile - :
text_language(默认 zh-CN)illustration_text_language - :
english_terms_whitelist(默认空)illustration_english_terms_whitelist - :
image_provider(默认 xiaomi)illustration_image_provider - :
image_model(默认 gemini-3.1-flash-image-preview)illustration_image_model - :
image_size(默认 1K)illustration_image_size - :
image_base_url(默认 Xiaomi 接口地址,也支持 Gemini 原生代理)illustration_image_base_url
执行方式:
- 优先调用 的一键流程脚本:
zhy-article-illustratorbashnode <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] - 若 非空,则为每个术语追加
illustration_english_terms_whitelist,例如:--term <value>bash--term Playwright --term Chromium --term Firefox --term WebKit - 默认沿用新版配图策略:
- 先生成文章级
visual-bible.md - 再生成 与
outline.mdprompts/ - 默认图片内文字为简体中文,仅白名单术语保留英文
- 同一篇文章内所有图片共享统一风格体系
- 先生成文章级
- 写作技能在集成时应遵循以下字段映射:
article_path -> --articleslug -> --slugillustration_density -> --densityillustration_aspect_ratio -> --aspect-ratioillustration_prompt_profile -> --prompt-profileillustration_text_language -> --text-languageillustration_image_provider -> --image-providerillustration_image_model -> --image-modelillustration_image_size -> --image-sizeillustration_image_base_url -> --image-base-urlillustration_upload=true -> --upload
输出:
- :
illustrated_article_patharticles/<slug>/article.illustrated.md - :
illustrations_dirarticles/<slug>/illustrations/<slug>/ articles/<slug>/illustrations/<slug>/visual-bible.mdarticles/<slug>/illustrations/<slug>/outline.mdarticles/<slug>/illustrations/<slug>/prompts/
失败处理:单张失败可重试一次;仍失败则记录并继续,最终输出失败清单。若部分图片失败,也应保留 ,并插入图片占位注释。
article.illustrated.mdTrigger Condition:
with_illustrations=trueGoal: Generate high-quality illustrations with a unified style for the article, and produce an illustrated version of the article
Default Strategy:
- : Use
article_patharticles/<slug>/article.md - : Reuse the current article slug
slug - :
density(default balanced)illustration_density - :
upload(default false)illustration_upload - :
aspect_ratio(default 16:9)illustration_aspect_ratio - :
prompt_profile(default nano-banana)illustration_prompt_profile - :
text_language(default zh-CN)illustration_text_language - :
english_terms_whitelist(default empty)illustration_english_terms_whitelist - :
image_provider(default xiaomi)illustration_image_provider - :
image_model(default gemini-3.1-flash-image-preview)illustration_image_model - :
image_size(default 1K)illustration_image_size - :
image_base_url(default Xiaomi API address, also supports Gemini native proxy)illustration_image_base_url
Execution Method:
- Prioritize calling the one-click process script of :
zhy-article-illustratorbashnode <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] - If is not empty, append
illustration_english_terms_whitelistfor each term, for example:--term <value>bash--term Playwright --term Chromium --term Firefox --term WebKit - Default to the new illustration strategy:
- First generate the article-level
visual-bible.md - Then generate and
outline.mdprompts/ - Default text in images is Simplified Chinese, only whitelisted terms retain English
- All images in the same article share a unified style system
- First generate the article-level
- When integrating writing skills, follow the following field mapping:
article_path -> --articleslug -> --slugillustration_density -> --densityillustration_aspect_ratio -> --aspect-ratioillustration_prompt_profile -> --prompt-profileillustration_text_language -> --text-languageillustration_image_provider -> --image-providerillustration_image_model -> --image-modelillustration_image_size -> --image-sizeillustration_image_base_url -> --image-base-urlillustration_upload=true -> --upload
Output:
- :
illustrated_article_patharticles/<slug>/article.illustrated.md - :
illustrations_dirarticles/<slug>/illustrations/<slug>/ articles/<slug>/illustrations/<slug>/visual-bible.mdarticles/<slug>/illustrations/<slug>/outline.mdarticles/<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, should still be retained, and image placeholder comments inserted.
article.illustrated.mdStep 7: HTML 主题样式输出(可选,调用 zhy-markdown2wechat)
Step 7: HTML Theme Style Output (Optional, call zhy-markdown2wechat)
触发条件:
with_html_theme=true目标:使用 技能将 Markdown 转换为带微信内联样式的 HTML
zhy-markdown2wechat操作:
- 选择输入文件:
- 若 且
with_illustrations=true存在,则使用该文件articles/<slug>/article.illustrated.md - 否则使用
articles/<slug>/article.md
- 若
- 将选中的 Markdown 文件记为
<input_markdown> - 调用 技能,执行转换脚本:
zhy-markdown2wechatbashnode <zhy-markdown2wechat>/scripts/convert.js \ <input_markdown> \ <zhy-markdown2wechat>/resources/themes/default.css \ articles/<slug>/article.zhy.html- 脚本零依赖(纯 Node.js),无需 ,自动在临时目录处理后清理
npm install - 输出包含 容器与完整内联 CSS 样式
<section id="MdWechat"> - 如需换肤,可将第二个参数替换为 下的其他主题文件(
resources/themes//apple.css/blue.css/dark.css/green.css/notion.css)vibrant.css - 表示当前环境中该技能的安装目录,运行时应以实际路径为准
<zhy-markdown2wechat>
- 脚本零依赖(纯 Node.js),无需
- 输入文件示例:
- 若存在插图版文章:
<input_markdown>=articles/<slug>/article.illustrated.md - 若不存在插图版文章:
<input_markdown>=articles/<slug>/article.md
- 若存在插图版文章:
输出:()
html_article_patharticles/<slug>/article.zhy.html失败处理:记录错误并在执行摘要中注明原因,跳过该步骤并继续后续流程
Trigger Condition:
with_html_theme=trueGoal: Use the skill to convert Markdown to HTML with WeChat inline styles
zhy-markdown2wechatOperations:
- Select input file:
- If and
with_illustrations=trueexists, use this filearticles/<slug>/article.illustrated.md - Otherwise, use
articles/<slug>/article.md
- If
- Record the selected Markdown file as
<input_markdown> - Call the skill and execute the conversion script:
zhy-markdown2wechatbashnode <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 , automatically processes in a temporary directory and cleans up afterwards
npm install - Output includes a container and complete inline CSS styles
<section id="MdWechat"> - 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 - refers to the installation directory of this skill in the current environment, use the actual path during runtime
<zhy-markdown2wechat>
- The script has zero dependencies (pure Node.js), no need for
- 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
- If illustrated article exists:
Output: ()
html_article_patharticles/<slug>/article.zhy.htmlFailure 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_IDWECHAT_APP_SECRET - 运行机器的公网 IP 已加入微信公众号后台 IP 白名单
- 若要自动生成封面,发布技能依赖的生图环境也必须可用(由 提供)
zhy-article-illustrator
调用方式:
- 正文必须是带内联样式的 HTML 文件
- 优先使用 Step 7 生成的 ;若不存在则跳过本步骤(或先补执行 Step 7)
article.zhy.html - 默认推荐的稳定入口是直接调用 :
wechat_draft.jsbashnode <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中的.envWECHAT_DEFAULT_THUMB_MEDIA_ID - 会自动从文章中提取标题/摘要、生成单张 16:9 封面、上传封面,并将返回的
publish_with_cover.js作为media_idthumb_media_id - 发布脚本会在上传前自动展开 HTML 中的 样式变量,避免微信草稿箱丢失颜色与边框样式
var(--xxx) - 发布脚本会在上传前自动将正文中的图片上传到微信正文图片接口,并将 替换为微信返回的图片 URL
<img src> - 发布脚本会在上传前将原生列表结构降级为“普通段落 + 圆点/编号”,以兼容微信草稿箱再次进入编辑模式时的列表解析问题
注意:
- 脚本零依赖(纯 Node.js >= 16),无需
npm install - 使用 时,需要本机可用
publish_with_cover.js,因为封面生成会复用现有生图脚本bun - 草稿保存后不会自动提交发布,需人工在公众号后台确认
- 标题长度不得超过 64 字符
- 若当前环境没有可用生图配置,优先改用 直接上传 HTML,避免自动封面步骤失败
wechat_draft.js
成功标准:输出
上传草稿成功! 草稿 MEDIA_ID: xxx失败排障清单:
| 错误信息 | 原因与处理 |
|---|---|
| AppID 错误,检查发布技能目录下的 |
| 当前 IP 未加白名单,将报错中的 IP 加入公众号后台 |
| 封面图 ID 无效,使用 |
| 自动封面生成依赖的生图环境未配置,检查 |
| Step 7 未执行或失败,检查 |
| 标题过长 | 控制标题 <= 64 字符 |
Trigger Condition:
post_to_wechat=trueDefault Behavior: Save to the draft box via the official WeChat API, no final publication submission
Prerequisites:
- and
WECHAT_APP_IDhave been configured in theWECHAT_APP_SECRETfile under the.envskill directoryzhy-wechat-publish - 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 generated in Step 7; if it does not exist, skip this step (or first complete Step 7)
article.zhy.html - The recommended stable entry is to directly call :
wechat_draft.jsbashnode <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"] - refers to the installation directory of this skill in the current environment, use the actual path during runtime
<zhy-wechat-publish> - When is not provided in
--thumb, it will automatically readwechat_draft.jsfromWECHAT_DEFAULT_THUMB_MEDIA_ID.env - will automatically extract the title/abstract from the article, generate a 16:9 cover image, upload the cover image, and use the returned
publish_with_cover.jsasmedia_idthumb_media_id - The publishing script will automatically expand style variables in the HTML before uploading to avoid loss of colors and border styles in the WeChat draft box
var(--xxx) - The publishing script will automatically upload images in the main content to the WeChat main content image interface before uploading, and replace with the image URL returned by WeChat
<img src> - 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.jsmust be available locally, as the cover image generation reuses existing image generation scriptsbun - 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 to directly upload HTML to avoid failure in the automatic cover image step
wechat_draft.js
Success Criteria: Output
Upload draft successfully! Draft MEDIA_ID: xxxFailure Troubleshooting List:
| Error Message | Cause and Handling |
|---|---|
| Incorrect AppID, check |
| Current IP not in whitelist, add the IP in the error message to the official account backend |
| Invalid cover image ID, re-upload using |
| Image generation environment dependent on automatic cover image generation not configured, check |
| Step 7 not executed or failed, check |
| Title too long | Control 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/标题长度) |
| Exception | Handling Method |
|---|---|
| No search results | Prompt user to provide more information or reference URLs |
| Reference article inaccessible | Skip this URL and continue processing other materials |
| Low quality of first draft | Regenerate or prompt user to provide more materials |
| Review score <70 | Suggest user check if the topic is appropriate |
| Illustration failure | Output failure list; can choose to supplement images before publishing |
| HTML conversion failure | Record error and skip this step (Step 7), continue with subsequent processes |
| Failure to save to draft box | Output 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执行流程:
- 搜索"如何提高工作效率"相关文章
- 获取用户提供的参考文章内容
- 生成初稿(约1500-2500字)
- 审稿评分:85分
- 润色优化后保存
输出:
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: successInput:
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: trueExecution Process:
- Search for articles related to "How to Improve Work Efficiency"
- Obtain content of the reference article provided by the user
- Generate first draft (about 1500-2500 words)
- Review score: 85 points
- 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: successNotes
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