Wechat Draft Publisher logo

Wechat Draft Publisher

Community
BND-1
wechat-draft-publisher

自动将 HTML 文章发布到微信公众号草稿箱,支持封面图上传、标题、作者和元数据管理。当用户说"推送到微信"、"发布到公众号草稿"、"上传到草稿箱"或提到微信文章发布时使用。

Overview

PublisherBND-1
Repositorywechat_article_skills
Skill namewechat-draft-publisher
Stars
317
Forks
82
Bundled files
10
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.

  • 10 bundled files

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

  • Open source

    Published by BND-1 on GitHub. Read the source before you install it.

Installation

Install the Wechat Draft Publisher 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.
  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/BND-1/wechat_article_skills.git /tmp/wechat_article_skills
mkdir -p .claude/skills
cp -r /tmp/wechat_article_skills/wechat-draft-publisher .claude/skills/wechat-draft-publisher
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Wechat Draft Publisher 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 Wechat Draft Publisher 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 Wechat Draft Publisher 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.

微信公众号草稿发布器

自动将 HTML 格式的文章发布到微信公众号草稿箱,支持封面图上传、标题、作者和摘要等元数据管理。

⚡ 快速开始

最简单的用法:

bash
python publisher.py --title "文章标题" --content article.html

完整参数:

bash
python publisher.py \
  --title "标题" \
  --content article.html \
  --author "作者名" \
  --cover cover.png \
  --digest "文章摘要"

默认值:

  • 作者:YanG
  • 封面图:cover.png

📋 执行步骤

发布文章到微信草稿箱的完整流程:

  1. 查找 HTML 文件

    • 优先查找 *_formatted.html(formatter 输出)
    • 回退到最新的 .html 文件
  2. 提取文章标题

    • 从 HTML 注释提取:<!-- Title: xxx -->
    • 从文件名提取
    • 询问用户
  3. 检查封面图

    • 查找 cover.png
    • 如缺失则警告但继续发布
  4. 调用发布脚本

    bash
    python publisher.py --title "xxx" --content xxx.html --cover xxx.png
  5. 验证结果

    • 确认草稿创建成功
    • 获取草稿 media_id
  6. 提示用户

    • 提供微信后台链接
    • 说明下一步操作

🔧 配置要求

首次使用

工具会在首次运行时引导配置:

  1. 获取微信公众号凭证

  2. 运行发布器

    bash
    python publisher.py --title "测试" --content test.html
  3. 添加服务器 IP 到白名单(如需要)

配置文件

位置: ~/.wechat-publisher/config.json

格式:

json
{
  "appid": "wx1234567890abcdef",
  "appsecret": "your_secret_here"
}

✨ 核心功能

  • ✅ access_token 自动缓存(有效期 7200 秒)
  • ✅ 封面图上传和管理
  • ✅ HTML 内容自动优化(适配微信)
  • ✅ 字段长度自动截断(标题/作者/摘要)
  • ✅ 错误处理和重试机制
  • ✅ 中文错误提示和解决方案
  • ✅ 交互模式和命令行模式

🛠️ 工作流集成

与其他 skill 协同工作:

完整工作流:

  1. wechat-tech-writer → 生成文章(xxx_article.md + cover.png
  2. wechat-article-formatter → 格式化 HTML(xxx_formatted.html
  3. wechat-draft-publisher → 发布到微信草稿箱(本 skill)

自动检测机制:

  • 自动查找 *_formatted.html 文件
  • 自动查找 cover.png 封面图
  • 自动识别内容图片

🚨 常见问题

错误:IP 不在白名单

症状: invalid ip not in whitelist 解决:

  1. 登录微信公众号后台
  2. 进入 设置 → 基本配置
  3. 添加服务器 IP 到白名单

错误:AppSecret 错误

症状: AppSecret error 解决:

  • 检查配置文件:~/.wechat-publisher/config.json
  • 验证 AppID 以 "wx" 开头(18 个字符)
  • 确认 AppSecret 正确

错误:标题/作者超出限制

症状: title/author size out of limit 解决:

  • 工具会自动截断(标题:32 字节,作者:20 字节)
  • 如需调整,修改 publisher.py

📁 文件结构

wechat-draft-publisher/
├── SKILL.md                # 本文件
├── publisher.py            # 核心发布脚本
├── scripts/                # 工具脚本
│   ├── fix-wechat-style.py # HTML 优化器
│   ├── optimize-html.py    # HTML 压缩工具
│   ├── publish-workflow.sh # 完整工作流
│   ├── install.sh          # 安装助手
│   └── test.sh             # 测试脚本
├── examples/               # 示例文件
│   ├── config.json.example # 配置示例
│   └── example.html        # HTML 示例
└── README.md               # 详细英文文档

💡 使用示例

示例 1:标准发布

bash
python publisher.py \
  --title "VSCode 更名事件" \
  --content article.html

示例 2:完整元数据

bash
python publisher.py \
  --title "技术文章" \
  --content article.html \
  --author "YanG" \
  --cover images/cover.png \
  --digest "这是一篇关于..."

示例 3:交互模式

bash
python publisher.py --interactive

📱 发布后操作

发布成功后:

  1. 登录微信公众号后台
  2. 进入"草稿箱"
  3. 预览效果
  4. 确认后发布

注意事项:

  • ⚠️ 草稿保存在微信后台,不会立即发布
  • ⚠️ 可以在草稿箱中编辑后再发布
  • ⚠️ 封面图会在预览时显示

🔗 相关文档

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 Wechat Draft Publisher AI skill do?

自动将 HTML 文章发布到微信公众号草稿箱,支持封面图上传、标题、作者和元数据管理。当用户说"推送到微信"、"发布到公众号草稿"、"上传到草稿箱"或提到微信文章发布时使用。

Why use Wechat Draft Publisher on TypingMind?

Because you install it once and use it with any model. Wechat Draft Publisher 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 Wechat Draft Publisher in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/BND-1/wechat_article_skills/tree/main/wechat-draft-publisher. 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 Wechat Draft Publisher?

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 Wechat Draft Publisher?

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

Is the Wechat Draft Publisher AI skill free?

It is published on GitHub by BND-1. Check the repository for licensing terms. 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 👇