← 返回 Skills 市场
slientrain-new

Wechat Mp Editor

作者 slientRain-new · GitHub ↗ · v1.0.2 · MIT-0
cross-platform ⚠ suspicious
57
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install wechat-mp-editor
功能描述
Create, edit, and manage WeChat Official Account (公众号/服务号) articles via the official WeChat API. Handles access token management, image uploads, draft CRUD,...
使用说明 (SKILL.md)

WeChat MP Editor

Overview

Full workflow: credentials → access token → image upload → draft creation → publishing.

One fixed template — visual branding consistent. Only content (text, date, banner) changes.

Priority: Write from ideas queue first.


Ideas Queue (灵感队列)

File: skills/wechat-mp-editor/ideas-queue.json

Status: pending / writing / done / archived

FIFO by default, or ask user. Empty queue → scan ClawHub/GitHub Trending → propose 3-5 topics.


Prerequisites

Read before writing:

  1. references/templates.md — 唯一排版规范
  2. references/review-checklist.md — 发布前检查清单

严格规则

  • padding 全篇 20px
  • section 不嵌套
  • 含中文的 \x3Csection>\x3Cp>word-break:normal;white-space:normal
  • footer:padding:36px 20px 40px;text-align:center;
  • 品牌:巡梦人#bbb)+ 从一颗星星开始,温暖整个宇宙#aaa
  • 高亮:每 2-4 段一处 color:#d4a574

Workflow

0. Pre-writing

0.1 实体确认 — 同名产品/公司先确认目标实体。

0.2 信息收集 + 事实校验 — 两轮:广度收集 → 逐句核查论断性句子。

0.3 方向确认 — 输出 3-5 句 What/Why/How。用户确认后再写。如果中途文章结构发生重大变更(改比喻方向、替换方案、增加大段内容),重新输出方向确认,不可直接下笔。

1. Credentials

credentials/wechat-official.json:

{"name":"巡梦人","appId":"wx...","appSecret":"...","type":"wechat_mp"}

2. Get token

GET https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=***

Returns access_token, valid 2h.

3. Upload images

Body images (/cgi-bin/media/uploadimg):

curl -s -F "[email protected]" "https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token=***"

Returns {"url": "http://mmbiz.qpic.cn/..."}.

Cover image (/cgi-bin/material/add_material):

curl -s -F "[email protected]" "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=***&type=image"

Returns {"media_id": "..."}. 封面图必须 1:1 方形,否则报 53402。

4. Build HTML

Use references/templates.md. Fill in variables at marked locations.

5. Submit draft

编码规则(写死规则,不可违反)

requests 库的 json= 参数默认 ensure_ascii=True,会将中文转为 \uXXXX 转义码,微信编辑器显示为乱码。

禁止使用 requests.post(url, json=payload)

必须使用 以下两种方式之一:

方式 A(推荐):写文件 + curl

import json
with open('/tmp/draft.json', 'w', encoding='utf-8') as f:
    json.dump(payload, f, ensure_ascii=False)  # ensure_ascii=False 是必须的
curl -s -X POST "https://api.weixin.qq.com/cgi-bin/draft/add?access_token=***" \
  -H "Content-Type: application/json; charset=utf-8" \
  --data-binary @/tmp/draft.json

方式 B(仅没有 curl 时):

import json, requests
requests.post(url, data=json.dumps(payload, ensure_ascii=False).encode('utf-8'),
              headers={"Content-Type": "application/json"})

迭代规则

第一次创建用 draft/add。后续所有修改用 draft/update不要重复 add 制造新草稿

# 更新已有草稿
payload["media_id"] = "已有DRAFT_ID"
requests.post(".../draft/update?...", data=..., headers=...)

提交后立即回读验证

resp = requests.post(".../draft/get?...", json={"media_id": draft_id})
content = resp.json()["news_item"][0]["content"]

# 必须验证的内容
checks = {
    "title": "预期的标题",
    "已设置的中文摘要": True,
    "\\u": False,                # 必须为 False — 不得有转义码
    "[\u4e00-\u9fff]": True,    # 必须有真实中文字符
}

6. Publish

POST /cgi-bin/freepublish/submit with {"media_id": "DRAFT_ID"}.


HTML Content Rules

  • Inline CSS only, no \x3Cstyle> / \x3Cscript>
  • Images must be WeChat CDN URLs
  • Body 15px / headline 24px / quote 22px / small 11-13px
  • Line-height: body 2.0, cards 1.9
  • Mobile-first: paragraphs ≤ 2-3 lines on 375px viewport

配图(即梦 AI)

文章用图通过 即梦 AI 由用户生成。本 skill 仅负责:

  1. 确定每张图的叙事任务
  2. 调用 dreamina-cli 生成提示词
  3. 上传用户返回的图片到微信 CDN
  4. 嵌入 HTML

不自行写提示词格式,不维护提示词经验池。


发布前自检清单(十项全过才能提交)

□ 移动端:每段 ≤35 中文字符,特征卡 ≤20 字符
□ 移动端:特征卡间距正确(首 N-1 张 12px,末张 0px)
□ 移动端:连续正文不超过 3 段,需插入图片/分隔线/特征卡
□ 格式:分隔线全篇 padding 统一为 12px 20px
□ 格式:footer 颜色 品牌名 #bbb / 标语 #aaa
□ 格式:section 开闭数一致(\x3Csection> 数 = \x3C/section> 数)
□ 封面:media_id 已更换(非上次文章的残留 ID)
□ 编码:提交后回读验证 content 无 \uXXXX 转义
□ 编码:提交后回读验证 content 有真实中文字符
□ 摘要:digest 已设置且前 54 字不是 HTML 标签

References

  • references/templates.md — 排版规范
  • references/review-checklist.md — 检查清单
  • scripts/generate_images.py — 图片生成
安全使用建议
Install only if you trust the publisher with your WeChat Official Account workflow. Use a dedicated least-privilege account or token if possible, keep app secrets out of plain files and logs, review every article and image before upload, and require explicit confirmation before draft updates or freepublish submission.
能力标签
cryptorequires-oauth-tokenrequires-sensitive-credentials
能力评估
Purpose & Capability
The stated WeChat editor purpose matches token handling, image uploads, draft CRUD, and publishing, but those are high-impact actions on a live official account and the artifacts do not clearly require explicit user approval before each remote mutation or publish.
Instruction Scope
The workflow includes public publishing, draft updates, read-back verification, ClawHub/GitHub Trending topic discovery, and dreamina-cli image-prompt support; most is disclosed, but the scope is broad for a single editor skill and external discovery/CLI use is under-scoped.
Install Mechanism
No package install or persistence mechanism was found, but bundled executable Python scripts can perform WeChat API uploads and draft creation when invoked with a token.
Credentials
Local file reads/writes, temporary draft JSON files, and media uploads are generally proportionate to article publishing, but users should restrict inputs to intended article assets and avoid broad local paths.
Persistence & Privilege
The skill expects sensitive WeChat credentials and access tokens and can publish externally visible content; there is no strong documented token redaction, retention, or separate confirmation step for publishing.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install wechat-mp-editor
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /wechat-mp-editor 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.2
Added mobile viewport checks to templates.md checklist. Added ensure_ascii encoding rules to SKILL.md. Fixed draft update-vs-add iteration rules.
v1.0.1
Fixed: ensure_ascii=False encoding rule, draft update vs add rule, mobile viewport checks. Removed misleading Writing Style Guide section.
元数据
Slug wechat-mp-editor
版本 1.0.2
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Wechat Mp Editor 是什么?

Create, edit, and manage WeChat Official Account (公众号/服务号) articles via the official WeChat API. Handles access token management, image uploads, draft CRUD,... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 57 次。

如何安装 Wechat Mp Editor?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install wechat-mp-editor」即可一键安装,无需额外配置。

Wechat Mp Editor 是免费的吗?

是的,Wechat Mp Editor 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Wechat Mp Editor 支持哪些平台?

Wechat Mp Editor 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Wechat Mp Editor?

由 slientRain-new(@slientrain-new)开发并维护,当前版本 v1.0.2。

💬 留言讨论