Agent skill

WeChat Article Publisher

by iamzifei in iamzifei/wechat-article-publisher-skill

Publishes Markdown or HTML articles as drafts to a WeChat Official Account through an API client, with a first-time user walkthrough.

MITAuto-check: notesProductivity & Automation

Install WeChat Article Publisher

skills CLI
$ npx skills add iamzifei/wechat-article-publisher-skill --skill wechat-article-publisher -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install iamzifei/wechat-article-publisher-skill wechat-article-publisher --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/iamzifei/wechat-article-publisher-skill.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/wechat-article-publisher .claude/skills/wechat-article-publisher && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
wechat-article-publisher
GitHub stars
157
Token cost
~2.6k tokens
SKILL.md length
836 words
Files
3 (incl. scripts)
Skills in repo
1
Repo updated
First seen
Licence
MIT

At a glance

Publishes Markdown or HTML articles as drafts to a WeChat Official Account through an API client, with a first-time user walkthrough.

  • Works in 4 steps: Check API Key → List Available Accounts → Publish Article → …
  • Sending a Markdown article to a WeChat Official Account as a draft
  • SKILL.md covers Prerequisites, Scripts, Workflow and Step-by-Step Guide, plus 6 more sections
  • Runs Python scripts from its folder; calls python; reaches wx.limyai.com; needs WECHAT_API_KEY

What it does

The skill uses direct API calls, not browser automation, to create drafts in a WeChat Official Account. A Python client lists authorized accounts and publishes a file, and an optional parser extracts structured data from Markdown. Markdown files are converted by the WeChat API, HTML files are sent as they are to preserve formatting, and an image-text mode for short posts is also available.

The workflow checks that WECHAT_API_KEY is set from a .env file, lists accounts and uses the only one automatically or asks you to choose, notes the app ID, detects the format and calls publish, then reports the draft details. Prerequisites are Python 3.9 or later, an account authorized on wx.limyai.com, and the API key. Phrases like first time or how does this work trigger a beginner walkthrough instead of publishing straight away.

When your agent uses it

  • Sending a Markdown article to a WeChat Official Account as a draft
  • Publishing an HTML article while keeping its formatting
  • Learning how to use the publisher for the first time

Example prompts

  • “Publish article.md to my WeChat Official Account as a draft.”
  • “List my authorized WeChat accounts.”
  • “这个怎么用?我第一次用公众号发布”

Requirements

  • A WECHAT_API_KEY in a .env file
  • Python 3.9 or later
  • A WeChat Official Account authorized on wx.limyai.com

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Check API Key
  2. List Available Accounts
  3. Publish Article
  4. Report Result

What it can do on your machine

Read from SKILL.md and the folder at commit d3508c4. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • wx.limyai.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • WECHAT_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

WeChat Article Publisher loads about 2.6k tokens when it runs. Until then it costs about 44 tokens; SKILL.md has 836 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~44
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:13
    T_API_KEY environment variable set (from .env file)
  • NoteMentions a .env fileSKILL.md:66
    # Check if .env file exists and contains WECHAT_API_KEY
  • NoteMentions a .env fileSKILL.md:67
    cat .env | grep WECHAT_API_KEY
  • NoteMentions a .env fileSKILL.md:71
    1. Copy `.env.example` to `.env`
  • NoteMentions a .env fileSKILL.md:254
    cat .env | grep WECHAT_API_KEY
  • NoteMentions a .env fileSKILL.md:273
    cat .env | grep WECHAT_API_KEY
  • NoteMentions a .env fileSKILL.md:293
    **Solution**: Ask user to set up `.env` file with their API key.
  • NoteMentions a .env fileSKILL.md:336
    1. Check .env → list accounts → confirm with user
  • NoteMentions a .env fileSKILL.md:393
    **关于前置条件**:这个技能需要 公众号的 API 凭据(写在 .env 里的 WECHAT_API_KEY)。

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from iamzifei/wechat-article-publisher-skill at commit d3508c4, republished under its MIT licence (© iamzifei). 836 words, ~2,569 tokens.

Download SKILL.mdSave it as .claude/skills/wechat-article-publisher/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
wechat-article-publisher
description
Publish Markdown/HTML articles to WeChat Official Account (微信公众号) drafts via API 新手引导:输入 `/公众号发布 新手`、「这个怎么用」「第一次用」「能干嘛」时,走 SKILL.md 的〈新手上路〉,不要直接开始干活。

WeChat Article Publisher

Publish Markdown or HTML content to WeChat Official Account drafts via API, with automatic format conversion.

Prerequisites

  • WECHAT_API_KEY environment variable set (from .env file)
  • Python 3.9+
  • Authorized WeChat Official Account on wx.limyai.com

Scripts

Located in ~/.claude/skills/wechat-article-publisher/scripts/:

wechat_api.py

WeChat API client for listing accounts and publishing articles:

bash
# List authorized accounts
python wechat_api.py list-accounts

# Publish from markdown file
python wechat_api.py publish --appid <wechat_appid> --markdown /path/to/article.md

# Publish from HTML file (preserves formatting)
python wechat_api.py publish --appid <wechat_appid> --html /path/to/article.html

# Publish with custom options
python wechat_api.py publish --appid <appid> --markdown /path/to/article.md --type newspic
parse_markdown.py

Parse Markdown and extract structured data (optional, for advanced use):

bash
python parse_markdown.py <markdown_file> [--output json|html]

Workflow

Strategy: "API-First Publishing"

Unlike browser-based publishing, this skill uses direct API calls for reliable, fast publishing.

  1. Load WECHAT_API_KEY from environment
  2. List available WeChat accounts (if user hasn't specified)
  3. Detect file format (Markdown or HTML) and parse accordingly
  4. Call publish API to create draft in WeChat
  5. Report success with draft details

Supported File Formats:

  • .md files → Parsed as Markdown, converted by WeChat API
  • .html files → Sent as HTML, formatting preserved

Step-by-Step Guide

Step 1: Check API Key

Before any operation, verify the API key is available:

bash
# Check if .env file exists and contains WECHAT_API_KEY
cat .env | grep WECHAT_API_KEY

If not set, remind user to:

  1. Copy .env.example to .env
  2. Set their WECHAT_API_KEY value
Step 2: List Available Accounts

Get the list of authorized WeChat accounts:

bash
python ~/.claude/skills/wechat-article-publisher/scripts/wechat_api.py list-accounts

Output example:

json
{
  "success": true,
  "data": {
    "accounts": [
      {
        "name": "我的公众号",
        "wechatAppid": "wx1234567890",
        "username": "gh_abc123",
        "type": "subscription",
        "verified": true,
        "status": "active"
      }
    ],
    "total": 1
  }
}

Important:

  • If only one account, use it automatically
  • If multiple accounts, ask user to choose
  • Note the wechatAppid for publishing
Step 3: Publish Article

For Markdown files:

bash
python ~/.claude/skills/wechat-article-publisher/scripts/wechat_api.py publish \
  --appid <wechatAppid> \
  --markdown /path/to/article.md

For HTML files (preserves formatting):

bash
python ~/.claude/skills/wechat-article-publisher/scripts/wechat_api.py publish \
  --appid <wechatAppid> \
  --html /path/to/article.html

For 小绿书 (image-text mode):

bash
python ~/.claude/skills/wechat-article-publisher/scripts/wechat_api.py publish \
  --appid <wechatAppid> \
  --markdown /path/to/article.md \
  --type newspic

Success response:

json
{
  "success": true,
  "data": {
    "publicationId": "uuid-here",
    "materialId": "uuid-here",
    "mediaId": "wechat-media-id",
    "status": "published",
    "message": "文章已成功发布到公众号草稿箱"
  }
}
Step 4: Report Result

After successful publishing:

  • Confirm the draft was created
  • Remind user to review and publish manually in WeChat admin panel
  • Provide any relevant IDs for reference

API Reference

Authentication

All API requests require the X-API-Key header:

X-API-Key: WECHAT_API_KEY
Get Accounts List
POST https://wx.limyai.com/api/openapi/wechat-accounts
Publish Article
POST https://wx.limyai.com/api/openapi/wechat-publish

Parameters:

ParameterTypeRequiredDescription
wechatAppidstringYesWeChat AppID
titlestringYesArticle title (max 64 chars)
contentstringYesArticle content (Markdown/HTML)
summarystringNoArticle summary (max 120 chars)
coverImagestringNoCover image URL
authorstringNoAuthor name
contentFormatstringNo'markdown' (default) or 'html'
articleTypestringNo'news' (default) or 'newspic'
Error Codes
CodeDescription
API_KEY_MISSINGAPI key not provided
API_KEY_INVALIDAPI key invalid
ACCOUNT_NOT_FOUNDAccount not found or unauthorized
ACCOUNT_TOKEN_EXPIREDAccount authorization expired
INVALID_PARAMETERInvalid parameter
WECHAT_API_ERRORWeChat API call failed
INTERNAL_ERRORServer error

Critical Rules

  1. NEVER auto-publish - Only save to drafts, user publishes manually
  2. Check API key first - Fail fast if not configured
  3. List accounts first - User may have multiple accounts
  4. Handle errors gracefully - Show clear error messages
  5. Preserve original content - Don't modify user's markdown unnecessarily

Supported Formats

Markdown Files (.md)
  • H1 header (# ) → Article title
  • H2/H3 headers (##, ###) → Section headers
  • Bold (text)
  • Italic (text)
  • Links text
  • Blockquotes (> )
  • Code blocks (...)
  • Lists (- or 1.)
  • Images Image: alt → Auto-uploaded to WeChat
HTML Files (.html)
  • <title> or <h1> → Article title
  • All HTML formatting preserved (styles, tables, etc.)
  • <img> tags → Images auto-uploaded to WeChat
  • First <p> → Auto-extracted as summary
  • Supports inline styles and rich formatting

HTML Title Extraction Priority:

  1. <title> tag content
  2. First <h1> tag content
  3. "Untitled" as fallback

HTML Content Extraction:

  • If <body> exists, uses body content
  • Otherwise, strips <html>, <head>, <!DOCTYPE> and uses remaining content

Article Types

Show full SKILL.md (335 more words)Show less
news (普通文章)
  • Standard WeChat article format
  • Full Markdown/HTML support
  • Rich text with images
newspic (小绿书/图文消息)
  • Image-focused format (like Instagram posts)
  • Maximum 20 images extracted from content
  • Text content limited to 1000 characters
  • Images auto-uploaded to WeChat

Example Flow

Markdown File

User: "把 ~/articles/ai-tools.md 发布到微信公众号"

bash
# Step 1: Verify API key
cat .env | grep WECHAT_API_KEY

# Step 2: List accounts
python ~/.claude/skills/wechat-article-publisher/scripts/wechat_api.py list-accounts

# Step 3: Publish (assuming single account with appid wx1234567890)
python ~/.claude/skills/wechat-article-publisher/scripts/wechat_api.py publish \
  --appid wx1234567890 \
  --markdown ~/articles/ai-tools.md

# Step 4: Report
# "文章已成功发布到公众号草稿箱!请登录微信公众平台预览并发布。"
HTML File

User: "把这个HTML文章发布到公众号:~/articles/newsletter.html"

bash
# Step 1: Verify API key
cat .env | grep WECHAT_API_KEY

# Step 2: List accounts
python ~/.claude/skills/wechat-article-publisher/scripts/wechat_api.py list-accounts

# Step 3: Publish HTML (auto-detects format)
python ~/.claude/skills/wechat-article-publisher/scripts/wechat_api.py publish \
  --appid wx1234567890 \
  --html ~/articles/newsletter.html

# Step 4: Report
# "文章已成功发布到公众号草稿箱!HTML格式已保留。请登录微信公众平台预览并发布。"

Error Handling

API Key Not Found
Error: WECHAT_API_KEY environment variable not set.

Solution: Ask user to set up .env file with their API key.

Account Not Found
Error: ACCOUNT_NOT_FOUND - 公众号不存在或未授权

Solution: Ask user to authorize their account on wx.limyai.com.

Token Expired
Error: ACCOUNT_TOKEN_EXPIRED - 公众号授权已过期

Solution: Ask user to re-authorize on wx.limyai.com.

WeChat API Error
Error: WECHAT_API_ERROR - 微信接口调用失败

Solution: May be temporary issue, retry or check WeChat service status.

Best Practices

Why use API instead of browser automation?
  1. Reliability: Direct API calls are more stable than browser automation
  2. Speed: No browser startup, page loading, or UI interactions
  3. Simplicity: Single command to publish
  4. Portability: Works on any system with Python (no macOS-only dependencies)
Content Guidelines
  1. Images: Use public URLs when possible; local images will be uploaded
  2. Title: Keep under 64 characters
  3. Summary: Auto-extracted from first paragraph if not provided
  4. Cover: First image in markdown becomes cover if not specified
Workflow Efficiency
Minimal workflow (1 command):
- list-accounts → get appid → publish → done

Full workflow (with verification):
1. Check .env → list accounts → confirm with user
2. Publish with options → report result

Troubleshooting

Q: How do I get a WECHAT_API_KEY?

A: Register and authorize your WeChat account at wx.limyai.com to get your API key.

Q: Can I publish to multiple accounts?

A: Yes, use list-accounts to see all authorized accounts, then specify the target --appid.

Q: Images not showing in WeChat?

A: Ensure images are accessible URLs. Local images are auto-uploaded but may fail if path is incorrect.

Q: Title is too long?

A: WeChat limits titles to 64 characters. The script will use the first 64 chars of H1.

Q: What's the difference between news and newspic?

A: news is standard article format; newspic (小绿书) is image-focused with limited text.

新手上路(用户不知道该输入什么时,走这里)

触发:/公众号发布 新手、「这个怎么用」「第一次用」「能干嘛」「带我走一遍」, 以及用户输入了技能名却没有给任何任务的时候。

这个模式的铁律:不假设、不索取。用户可能什么都没准备, 不要一上来就问他要文件、要 API key、要具体需求。按下面四步走:

一、先说清楚这是什么(三句话以内)

一句话:把 Markdown 文章直接发进公众号草稿箱,图片自动上传。 走的是微信官方接口,不是模拟点击,所以稳定。 发的是草稿,最终点「发表」的还是你。

二、给编号选项,让他按回车就能继续

不要问开放式问题(「你想做什么?」对新手是负担)。给 3 个选项加一个默认:

想先看哪个?(直接回车 = 1)
  1. 先看看发出去长什么样(示例)
  2. 把我的 Markdown 发成草稿
  3. 先讲讲要准备什么

三、直接演示一遍,边做边解释

选完立刻做给他看,用示例数据,不需要他提供任何东西。 每做完一步,加一行「💡 刚才发生了什么」,一句话说明这步的意义。

四、毕业

演示完只问一个是非题:「要不要用你自己的文章真跑一遍?」 答是就进正常流程;答否就告诉他随时回来输 /公众号发布 新手。

关于前置条件:这个技能需要 公众号的 API 凭据(写在 .env 里的 WECHAT_API_KEY)。 新手模式下不要提前索取——先用示例数据演示完,到第四步真跑的时候再引导他配置, 并说清楚在哪配、怎么拿。新手最容易在这一步流失。

© iamzifei, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (scripts) in skills/wechat-article-publisher of iamzifei/wechat-article-publisher-skill.

  • SKILL.md
  • scripts/parse_markdown.py
  • scripts/wechat_api.py

Open the folder on GitHubat commit d3508c4

Compare with similar skills

WeChat Article Publisher next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

WeChat Article Publisher compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
WeChat Article Publisher this skilliamzifei/wechat-article-publisher-skill157—~2.6kAutomated safety check: NotesMIT
WeChat Article Compliance Revieweraiworkskills/wechat-article-skills672—~1.5kAutomated safety check: PassApache-2.0
WeChat Official Account Publisheraiworkskills/wechat-article-skills672—~1.5kAutomated safety check: PassApache-2.0
Create Experkfly/ex-skill2.5k—~3.7kAutomated safety check: NotesMIT
Wechat Publishersakuraoxo-clio/wechat-publisher115—~1.4kAutomated safety check: NotesMIT
Wechat AutomationLAVARONG/wechat-automation-api181—~1.2kAutomated safety check: PassNone

Similar skills

  • WeChat Article Compliance Reviewer

    aiworkskills/wechat-article-skills

    Local, offline pre-publish review for a WeChat official account article: sensitive words, typos and platform compliance, producing an actionable fix list.

    672 GitHub stars~1.5k tokensUpdated 18 days ago
    Productivity & AutomationAuto-check passed
  • WeChat Official Account Publisher

    aiworkskills/wechat-article-skills

    Publishes a finished article and its images directly to a WeChat official account through its official API, as a draft or a live broadcast.

    672 GitHub stars~1.5k tokensUpdated 18 days ago
    Productivity & AutomationAuto-check passed
  • Create Ex

    perkfly/ex-skill

    Distill an ex-girlfriend into an AI Skill. An agent skill from perkfly/ex-skill.

    2.5k GitHub stars~3.7k tokensUpdated 6 mo ago
    Productivity & AutomationAuto-check: notes
  • Wechat Publisher

    sakuraoxo-clio/wechat-publisher

    把文章排版成微信公众号合规 HTML、自动上传图片、可选自动生成封面图,并通过官方 API 一键写入公众号草稿箱,用户只需在后台预览后发布。优先用组件化手写 HTML 做精排版,也支持 Markdown 快速排版。当用户提到「发布公众号」「推送到草稿箱」「公众号排版」「post to wechat」「微信公众号文章」时使用。

    115 GitHub stars~1.4k tokensUpdated 3 mo ago
    Productivity & AutomationAuto-check: notes
  • Wechat Automation

    LAVARONG/wechat-automation-api

    微信发信能力:通过 Windows 桌面微信发送文本、图片URL或本地文件。适合各类 Agent 在本机直接发送一次性消息。触发词:给[某人]发微信、通知[某人]、把这个用微信发给[某人]、用微信发个图片、把本地文件发给[某人]

    181 GitHub stars~1.2k tokensUpdated 23 days ago
    Productivity & AutomationAuto-check passed
  • Wechat Article Search

    nexus-research-lab/nexus

    搜索微信公众号文章,并整理标题、摘要、发布时间、来源公众号和链接。用户提到微信公众号、 公众号文章、微信文章、搜一批公众号资料、按关键词找公众号内容、查某公众号相关报道, 或需要为中文研究收集微信公众平台文章时使用;即使用户只说“搜微信里的文章”也应触发。

    151 GitHub stars~858 tokensUpdated yesterday
    Productivity & AutomationAuto-check: notes

Works with

Questions about WeChat Article Publisher

What does WeChat Article Publisher do?

Publishes Markdown or HTML articles as drafts to a WeChat Official Account through an API client, with a first-time user walkthrough. The skill uses direct API calls, not browser automation, to create drafts in a WeChat Official Account. A Python client lists authorized accounts and publishes a file, and an optional parser extracts structured data from Markdown.

When should I use WeChat Article Publisher?

WeChat Article Publisher fits situations like: sending a Markdown article to a WeChat Official Account as a draft; publishing an HTML article while keeping its formatting; learning how to use the publisher for the first time.

How do I install WeChat Article Publisher in Claude Code?

Run `npx skills add iamzifei/wechat-article-publisher-skill --skill wechat-article-publisher -a claude-code`. Or copy the skill folder (skills/wechat-article-publisher in iamzifei/wechat-article-publisher-skill) into .claude/skills/wechat-article-publisher in your project. Claude Code loads it when a task matches its description.

How do I install WeChat Article Publisher in Codex?

Run `npx skills add iamzifei/wechat-article-publisher-skill --skill wechat-article-publisher -a codex`. Or copy the skill folder (skills/wechat-article-publisher in iamzifei/wechat-article-publisher-skill) into .agents/skills/wechat-article-publisher in your project. Codex loads it when a task matches its description.

Can I use WeChat Article Publisher in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add iamzifei/wechat-article-publisher-skill --skill wechat-article-publisher -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/wechat-article-publisher, .gemini/skills/wechat-article-publisher, .github/skills/wechat-article-publisher and .opencode/skills/wechat-article-publisher in your project.

What does WeChat Article Publisher need to run?

Going by SKILL.md and its folder, WeChat Article Publisher needs Python for the scripts in its folder, the command-line tools its instructions call (python) and credentials named WECHAT_API_KEY. Our summary lists: A WECHAT_API_KEY in a .env file; Python 3.9 or later; A WeChat Official Account authorized on wx.limyai.com.

Does WeChat Article Publisher access the network?

SKILL.md names 1 domain. In commands or code: wx.limyai.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.

Is WeChat Article Publisher safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does WeChat Article Publisher use?

WeChat Article Publisher is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does WeChat Article Publisher use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to WeChat Article Publisher?

Skills that share tags, products or a category with WeChat Article Publisher: WeChat Article Compliance Reviewer (aiworkskills/wechat-article-skills, 672 stars), WeChat Official Account Publisher (aiworkskills/wechat-article-skills, 672 stars), Create Ex (perkfly/ex-skill, 2.5k stars) and Wechat Publisher (sakuraoxo-clio/wechat-publisher, 115 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains WeChat Article Publisher?

iamzifei (a GitHub user) maintains it in iamzifei/wechat-article-publisher-skill, which has 157 GitHub stars. The repository was last updated on August 12, 2026.

Source: iamzifei/wechat-article-publisher-skill on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.