Zhy Wechat Publish logo

Zhy Wechat Publish

Community
zhylq
zhy-wechat-publish

Use when publishing HTML articles to WeChat Official Account drafts, especially when you need cover upload, automatic cover generation, body image rewriting, CSS-variable compatibility, or draft metadata like author and comment settings.

Overview

Publisherzhylq
Repositoryyuan-skills
Skill namezhy-wechat-publish
Stars
35
Forks
9
Bundled files
3
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 3 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by zhylq on GitHub. Read the source before you install it.

Installation

Install the Zhy Wechat Publish AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/zhylq/yuan-skills/tree/main/skills/zhy-wechat-publish
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/zhylq/yuan-skills.git /tmp/yuan-skills
mkdir -p .claude/skills
cp -r /tmp/yuan-skills/skills/zhy-wechat-publish .claude/skills/zhy-wechat-publish
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Zhy Wechat Publish in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Zhy Wechat Publish on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Zhy Wechat Publish is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

微信公众号草稿箱发布技能

本技能用于将文章发布到微信公众号草稿箱。脚本仅依赖 Node.js 内置模块;自动封面生成步骤会复用现有 bun 生图脚本。

前置条件

  1. Node.js >= 16
  2. 若要自动生成封面,还需本机可用 bun
  3. 技能目录下 .env 至少包含:
env
WECHAT_APP_ID=你的公众号AppID
WECHAT_APP_SECRET=你的公众号AppSecret
WECHAT_DEFAULT_THUMB_MEDIA_ID=默认封面图media_id(可选)
WECHAT_DEFAULT_AUTHOR=AI源来如此(可选)
  1. 运行机器公网 IP 已加入公众号后台 IP 白名单
  2. 自动生成封面时,需保证 zhy-article-illustrator 的生图环境可用

安装说明

本 skill 适合与 npx skills add ... --skill zhy-wechat-publish 一起安装到 OpenCode、Claude Code 等支持 SKILL.md 的 agent 工具中。

安装后请在本地 skill 目录手动创建 .env,不要将真实凭据提交回仓库。

脚本清单

脚本位于 scripts/:

脚本用途
wechat_draft.js上传正文到公众号草稿箱
upload_image.js上传本地封面图到永久素材库,获取 media_id
publish_with_cover.js读取文章、生成封面、上传封面并推送草稿

核心能力

  • 自动处理正文 CSS 变量兼容
  • 自动将正文图片上传到微信正文图片接口并替换 URL
  • 自动将 ul/ol 降级为微信公众号编辑态更稳定的段落列表
  • 支持默认作者、评论开关、仅粉丝评论设置
  • 支持从文章内容生成单张公众号封面,并自动上传为 thumb_media_id

工作流

方式一:已准备好 HTML 与封面 media_id

bash
node scripts/wechat_draft.js --title "文章标题" --file "post.html" --author "AI源来如此" --thumb "MEDIA_ID" --need-open-comment "1" --only-fans-can-comment "1"

参数说明:

参数必填说明
--title是文章标题
--file是HTML 正文文件路径
--author否作者,不传时默认 WECHAT_DEFAULT_AUTHOR 或 AI源来如此
--digest否摘要
--thumb否封面 media_id,不传时读取 .env 默认值
--source-url否原文链接
--need-open-comment否是否开启评论,默认 1
--only-fans-can-comment否是否仅粉丝可评论,默认 1

方式二:自动生成封面并发布

当你已有文章源文件,以及最终用于上传的 HTML 文件时,可直接运行:

bash
node scripts/publish_with_cover.js --article "article.md" --html "post.html" --author "AI源来如此" --source-url "https://example.com"

该脚本会自动完成:

  1. 读取文章内容并提取标题/摘要
  2. 调用 zhy-article-illustrator/scripts/image-gen.ts 生成单张 16:9 封面图
  3. 调用 upload_image.js --json 上传封面,获得 thumb_media_id
  4. 调用 wechat_draft.js 推送草稿,并自动带上:
    • author
    • thumb_media_id
    • need_open_comment=1
    • only_fans_can_comment=1

可选参数:

参数说明
--article原始文章文件,推荐 Markdown,也可 HTML
--html最终上传到公众号的 HTML 文件
--title显式覆盖标题
--author显式覆盖作者
--cover-output自定义封面输出路径
--cover-ar封面宽高比,默认 16:9
--source-url原文链接
--need-open-comment是否开启评论,默认 1
--only-fans-can-comment是否仅粉丝可评论,默认 1

正文兼容说明

发布前,wechat_draft.js 会自动处理:

  1. var(--xxx) CSS 变量展开
  2. 微信 section 背景样式兼容
  3. 首个 h1 去除,避免与标题重复
  4. 正文图片上传到 cgi-bin/media/uploadimg
  5. 原生列表转换为普通段落列表

错误排查

  • [40013] invalid appid:检查 .env 中 WECHAT_APP_ID
  • [40164] invalid ip... not in whitelist:将报错 IP 加入微信后台白名单
  • [40007] invalid media_id:封面素材无效,重新上传封面图
  • 缺少 Xiaomi/Gemini/OpenAI API Key:自动封面生成所需生图配置缺失
  • 正文图片不显示:检查原图路径/URL 是否可访问,以及 media/uploadimg 是否成功

快速示例

bash
# 已有 HTML,直接发草稿
node scripts/wechat_draft.js --title "技术周报" --file "post.html"

# 自动生封面并发布
node scripts/publish_with_cover.js --article "article.md" --html "post.html"

# 上传封面图并把 media_id 回写 .env
node scripts/upload_image.js "cover.png" --write-env --json

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Zhy Wechat Publish AI skill do?

Use when publishing HTML articles to WeChat Official Account drafts, especially when you need cover upload, automatic cover generation, body image rewriting, CSS-variable compatibility, or draft metadata like author and comment settings.

Why use Zhy Wechat Publish on TypingMind?

Because you install it once and use it with any model. Zhy Wechat Publish is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Zhy Wechat Publish in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/zhylq/yuan-skills/tree/main/skills/zhy-wechat-publish. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Zhy Wechat Publish?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Zhy Wechat Publish?

As many as you like. As long as a model supports skills, you can use Zhy Wechat Publish with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Zhy Wechat Publish AI skill free?

Yes. It is published on GitHub by zhylq under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇