modelscope.cn

wechat-publisher

Use when publishing articles (Markdown or HTML) to WeChat Official Account draft box via wx.limyai.com OpenAPI - supports news and 小绿书 (newspic) modes, account listing, and Markdown utilities. Use when user says "发布到?

Installation

$ npx skills add https://modelscope.cn

Also in this package

Other skills from modelscope.cn · top by installs.

npx skills add https://modelscope.cn

Browse all from modelscope.cn

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Declared
Cursor Not declared
Codex Declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Skill metadata

Parsed from SKILL.md frontmatter.

Version1.0
Declared agents claude-code codex
More metadata
author
42ailab
version
1.0
title
微信�

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 5,984 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

微信公众号文章发布

安装位置要求(重要)

本技能只安装到项目级,不要安装到全局目录(~/.claude/skills/、~/.agents/skills/ 等):

  • 多数工具(Codex、Kimi Code、Cursor 等):解压到项目根目录的 .agents/skills/wechat-publisher/(Agent Skills 开放标准 universal 目录,工具自动发现)
  • Claude Code:解压到项目根目录的 .claude/skills/wechat-publisher/

安装方式:从技能中心页面下载 zip 解压到上述项目目录;或安装 content-system-setup 技能后运行 python3 scripts/setup.py --install-skills,自动下载安装全部配套技能(项目级)。

Overview

通过 wx.limyai.com OpenAPI 将文章发布到微信公众号草稿箱。支持 Markdown 和 HTML 两种内容格式、普通图文(news)和小绿书(newspic)两种文章类型。提供公众号列表查询和 Markdown 工具能力。

When to Use

  • 发布 Markdown 或 HTML 文章到公众号草稿箱
  • 用小绿书(图文)模式发布图片为主的内容
  • 查询已授权的公众号列表及其 AppID
  • 用户说「发布到公众号」「推送到草稿箱」「发文章」「小绿书发布」「获取公众号列表」

When NOT to Use

  • 文章还在写作阶段 → 先完成内容再发布
  • 只需要 HTML 排版(不需发布)→ 使用 wechat-layout-apply 或 wechat-layout-template
  • 需要抓取已发布文章 → 使用配套的存档技能

Quick Reference

操作 命令
发布 Markdown 文章 npx tsx .claude/skills/wechat-publisher/scripts/publish.ts publish article.md
发布 HTML 文章 npx tsx .claude/skills/wechat-publisher/scripts/publish.ts publish article.html
发布小绿书 npx tsx .claude/skills/wechat-publisher/scripts/publish.ts publish content.md --type newspic --cover-image https://... --images img1.jpg,img2.jpg
获取公众号列表 npx tsx .claude/skills/wechat-publisher/scripts/publish.ts list
仅验证不发布 加 --dry-run
指定 AppID --appid wxXXXXXX
指定标题 --title "自定义标题"
指定摘要 --summary "文章摘要"
指定封面图 --cover-image https://example.com/cover.jpg
指定作者 --author "作者名"

Publishing Workflow

Step 1: 确认配置

发布前检查环境变量(在项目根目录 .env.local 或 .env 中配置):

变量 必填 说明
weChatbloomkey 是 API 密钥
weChatbloomAppID 否* 默认公众号 AppID(未指定 --appid 时自动从账号列表获取第一个)

如果未配置 weChatbloomAppID,脚本会自动调用账号列表接口获取第一个 active 账号的 AppID。

Step 2: 准备内容

  • Markdown 文件(.md):直接发布,自动以 contentFormat: markdown 发送
  • HTML 文件(.html):自动以 contentFormat: html 发送
  • 标题:从文件首行 # 标题 或 <h1> 提取,也可 --title 手动指定(最长 64 字符)
  • 摘要:从首个段落提取,也可 --summary 手动指定(最长 120 字符)

Step 3: 执行发布

推荐先 dry-run 验证:

npx tsx .claude/skills/wechat-publisher/scripts/publish.ts publish article.md --dry-run

正式发布:

npx tsx .claude/skills/wechat-publisher/scripts/publish.ts publish article.md

Step 4: 确认结果

成功输出示例:

发布成功!
标题: 示例文章标题
状态: draft
mediaId: xxx
publicationId: yyy

小绿书(图文模式)

当 --type newspic 时发布为小绿书:

  • 必须通过 --cover-image 或 --images 提供图片(至少一张)
  • 图片合并顺序:封面图 → 主体图片,自动去重,最多 20 张
  • 文字内容仅支持纯文本,最多 600 字
  • 适合以图片为主的内容发布
npx tsx .claude/skills/wechat-publisher/scripts/publish.ts publish content.md \
  --type newspic \
  --cover-image https://example.com/cover.jpg \
  --images "https://example.com/1.jpg,https://example.com/2.jpg"

获取公众号列表

npx tsx .claude/skills/wechat-publisher/scripts/publish.ts list

输出示例:

已授权公众号列表 (1 个):
  - 示例公众号
    AppID: wxaaaaaaaaaa000000
    类型: 订阅号
    状态: active

Common Mistakes

错误 原因 修复
Could not find API key .env.local 未配置 添加 weChatbloomkey=xxx
HTTP 401 API 密钥无效 检查密钥值是否正确
ACCOUNTNOTFOUND 公众号不存在或未授权 先用 list 命令查看可用账号,检查 --appid
NO_IMAGES 小绿书模式未提供图片 添加 --cover-image 或 --images
INVALID_PARAMETER 参数错误(标题/摘要超长等) 标题 ≤64 字符,摘要 ≤120 字符,小绿书文字 ≤600 字
标题提取为空 文件无 # 标题 或 <h1> 使用 --title 手动指定
封面图必须是 HTTP(S) URL 使用了本地路径 先上传图片到图床,获取公网 URL

Resources

  • [scripts/publish.ts](scripts/publish.ts) — TypeScript 发布脚本(strict 模式,零依赖)
  • [references/api-reference.md](references/api-reference.md) — wx.limyai.com API 完整接口文档