Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问clear审计提醒

wechat-article-publisher微信文章发布者

Agent Skill

wechat-article-publisher 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 Codex、Claude、Cursor、Gemini CLI 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

41,616

周安装

1,667

GitHub Stars

132

下载量

13,464
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:wechat-article-publisher(微信文章发布者)
来源仓库:https://github.com/iamzifei/wechat-article-publisher-skill
仓库路径:skills/wechat-article-publisher
安装命令:
npx skills add https://github.com/iamzifei/wechat-article-publisher-skill --skill wechat-article-publisher
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/iamzifei/wechat-article-publisher-skill --skill wechat-article-publisher

简介

通过API将Markdown或HTML文章发布到微信公众号草稿中。

  • 支持Markdown和HTML文件格式并自动转换; HTML 保留原始格式
  • 两种文章类型可供选择:标准新闻格式和以图像为中心的新闻图片(小绿书)模式
  • 需要WECHAT_API_KEY环境变量和wx.limyai.com上授权的微信帐号
  • 仅发布到草稿(用户在微信管理面板中手动发布);包括帐户列表和过期令牌或缺少授权的错误处理

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:

# 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):

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:

# 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:

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

Output example:

{
  "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:

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

For HTML files (preserves formatting):

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

For 小绿书 (image-text mode):

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

Success response:

{
  "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.)
  • Imagesalt → 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

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 发布到微信公众号"

# 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"

# 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.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

31.3%
按下载量换算4,214

OpenCode

19.97%
按下载量换算2,689

Gemini CLI

18.58%
按下载量换算2,502

Cursor

11.16%
按下载量换算1,503

Antigravity

7.05%
按下载量换算949

windsurf

3.54%
按下载量换算477

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills