Xpersona
W

Wechat Mp Auto

CLAWHUB · Unverified

自动完成微信公众号文章的选题调研、Markdown写作、智能配图、内容审核和发布全流程管理。

62
Rank
84
Safety
1.1k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.1K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17czcm9ywc807tjzp8yf6dkn983g4t5:wechat-mp-auto
  1. Install using `clawhub skill install s17czcm9ywc807tjzp8yf6dkn983g4t5:wechat-mp-auto` in an isolated environment before connecting it to live workloads.
  2. No published capability contract is available yet, so validate auth and request/response behavior manually.
  3. Review the upstream CLAWHUB listing at https://clawhub.ai/wzhaojin/wechat-mp-auto before using production credentials.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-wzhaojin-wechat-mp-auto/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

158,133 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

# wechat-mp-auto - 微信公众号自动化 Skill

**版本**: v0.1.2
**描述**: 微信公众号文章从选题到发布的全流程自动化

---

## 架构理念

本 Skill 由 **AI 模型作为编排者**,Python 代码提供原子化工具能力。AI 读取本 SKILL.md 后自行决定调用哪些工具、完成全部流程。

Python 代码不包含任何 AI 调用逻辑,所有生成、推理、判断均由 AI 模型完成。

---

## 工具清单

AI 可调用的所有工具如下,调用时请传入完整参数:

### 1. 调研工具

**`research_topic(topic: str, keywords: Optional[List[str]] = None) -> dict`**
- 输入:文章主题(字符串),可选的关键词列表(用于精细化搜索)
- 输出:`{"search_results": [...], "summary": "..."}`
- 作用:对给定主题进行网络调研,返回搜索结果摘要
- 内部级联:Tavily → DuckDuckGo → 百度,任一成功即返回

---

**`generate_outline(topic: str, research: dict) -> dict`**
- 输入:主题字符串 + research_topic 的返回结果
- 输出:
```json
{
  "title": "深度解析:XXX",
  "sections": [
    {"name": "引言", "description": "...", "key_points": ["要点1", "要点2"]},
    {"name": "核心内容", "description": "...", "key_points": [...]},
    ...
  ]
}
```
- 作用:根据调研结果生成文章大纲,包含 4 个标准章节(引言/核心内容/实践方法/结论)

---

### 2. 写作工具

**`convert_to_html(markdown: str, theme: str) -> str`**
- 输入:Markdown 格式文章内容 + 主题名称
- 输出:微信可用的 HTML 字符串
- 主题可选值:
  - `default` — 默认蓝色
  - `macaron` — 马卡龙粉紫色
  - `shuimo` — 水墨深灰蓝
  - `wenyan` — 文雁深蓝绿
  - `houge` — 猴哥深蓝橙
  - `cuiyu` — 翠玉青绿黄

### 3. 图片工具

**`search_image(query: str, count: int) -> list`**
- 输入:搜索关键词(字符串),请求图片数量(整数)
- 输出:图片信息列表,每个元素含 `url`(下载链接)和 `local_path`(本地缓存路径)
- 作用:通过 Pexels/Unsplash 图库搜索并下载图片,返回本地文件路径
- 注意:如未配置图库 API Key,此工具不可用

---

**`generate_image(prompt: str, size: str) -> dict`**
- 输入:图片描述提示词(字符串),图片尺寸(字符串,格式如 `"1024x1024"`)
- 输出:`{"local_path": "本地文件路径"}`
- 作用:调用 AI 生图模型生成图片,返回本地保存路径

---

**`upload_image(file_path: str) -> dict`**
- 输入:本地图片文件路径(字符串)
- 输出:`{"media_id": "...", "url": "微信图片URL"}`
- 作用:将本地图片上传至微信素材库,返回微信图片 URL 和 media_id
- 注意:上传前需确保图片文件存在,支持 JPG/PNG

---

### 4. 内容审核工具

**`review_article(article: dict) -> dict`**
- 输入:文章对象,格式如下:
```json
{
  "markdown": "Markdown 内容(字符串)",
  "content": "HTML 内容(字符串,可选)"
}
```
- 输出:
```json
{
  "passed": true/false,
  "plagiarism": {"similarity": 0, "is_duplicated": false},
  "prohibited": {"violations": []}
}
```
- 作用:审核文章内容,返回是否通过及问题列表

---

### 5. 草稿工具

**`create_draft(articles: list, auto_upload_thumb: bool = False) -> dict`**
- 输入:文章列表,每篇格式如下:
```json
{
  "title": "文章标题",
  "author": "贾维斯",
  "content": "HTML内容(字符串)",
  "thumb_media_id": "封面缩略图的media_id",
  "content_source_url": "原文链接,可填 https://openclaw.ai"
}
```
- 输出:`{"media_id": "草稿ID", "msg": "..."}`
- 作用:将文章推送到微信公众号草稿箱

---

## AI 编排流程

AI 读取本 SKILL.md 后,按以下步骤执行。每一步都需要显式调用对应工具:

```
第一步:调研
  → 调用 research_topic(topic)
  → 获得 search_results 和 summary

第二步:生成大纲
  → 调用 generate_outline(topic, research结果)
  → 获得 title 和 sections(含章节名、描述、要点)

第三步:组装提示词并生成文章
  → 根据第二步的大纲,自行组装提示词(见下方"提示词组装规范")
  → 用大模型根据提示词生成完整的 Markdown 文章
  → 注意:大模型直接输出 Markdown,不需要调用任何工具来"写作"

第四步:内容审核
  → 调用 review_article({"markdown": 第三步生成的Markdown})
  → 如 passed=false 或存在 prohibited.violations,应重新生成或修改内容
  → 审核通过后再进入第五步

第五步:生成并上传配图
  → 生成封面图(generate_images=True 时):
    - 优先调用 search_image(文章标题关键词, count=5),下载到本地
    - 或调用 generate_image(封面图描述, size="900x500"),得到本地路径
  → 调用 upload_ima

README.md

# wechat-mp-auto

微信公众号自动化 Skill - 从选题到发布的全流程自动化

[![Python Version](https://img.shields.io/badge/python-3.9+-blue)](https://www.python.org/)
[![License](https://img.shields.io/badge/license-MIT-green)](LICENSE.txt)
[![Version](https://img.shields.io/badge/version-v0.0.9-blue)](SKILL.md)

## 功能特性

本 Skill 由 **AI 模型作为编排者**,Python 代码提供原子化工具能力。AI 阅读 SKILL.md 后自行决定调用哪些工具,完成全部流程。

- **选题调研** - 级联搜索(Tavily → DuckDuckGo → 百度),多源自动切换
- **文章写作** - AI 根据提示词生成 Markdown,Python 负责格式转换
- **智能配图** - Pexels/Unsplash 图库搜索 + AI 生图(可选择)
- **图片处理** - 调整微信尺寸、压缩
- **内容审核** - 本地+网络重复度检测、敏感词扫描
- **模板管理** - 6 种本地主题切换(default/macaron/shuimo/wenyan/houge/cuiyu)
- **草稿发布** - 一键推送到公众号草稿箱

## 快速开始

### 1. 安装依赖

```bash
pip install -r requirements.txt
```

### 2. 配置凭证

在 `~/.config/wechat-mp-auto/config.json` 中配置微信公众号凭证:

```json
{
  "app_id": "your_app_id",
  "app_secret": "your_app_secret"
}
```

或设置环境变量:

```bash
export WECHAT_APP_ID="your_app_id"
export WECHAT_APP_SECRET="your_app_secret"
```

### 3. 可选:配置图片生成 API

首次使用时系统会引导选择图片来源方式,支持以下两种:

**图片接口检索(推荐,无需信用卡):**
```bash
export PEXELS_API_KEY="your_pexels_key"
export UNSPLASH_API_KEY="your_unsplash_key"
```
注册地址:Pexels https://www.pexels.com/api/ | Unsplash https://unsplash.com/developers



### 4. 可选:配置网络重复度检测

**Tavily:**
```bash
export TAVILY_API_KEY="your_tavily_key"
```

## 使用方法

本 Skill 由 **AI 模型作为编排者**,所有流程通过 AI 读取 SKILL.md 后自行调用工具完成,无需手动编写 Python 脚本。

**详细工具说明和编排流程见 [SKILL.md](./SKILL.md)。**

以下代码仅供手动调试参考:

```python
from skills.topic_research import TopicResearchSkill
from skills.article_writer import ArticleWriterSkill
from skills.image_generator import ImageGeneratorSkill
from skills.material_skill import MaterialSkill
from skills.draft_skill import DraftSkill
from skills.content_reviewer import ContentReviewerSkill

# 调研
research = TopicResearchSkill().research_topic("AI大模型应用")

# 生成大纲
outline = TopicResearchSkill().generate_outline("AI大模型应用", research)

# 内容审核(Markdown 生成后)
review = ContentReviewerSkill().review_article({"markdown": markdown_text})
if not review["passed"]:
    print("审核未通过:", review)

# 转换 HTML
html = ArticleWriterSkill().convert_to_html(markdown_text, theme="macaron")

# 上传图片
result = MaterialSkill().upload_image("/path/to/image.jpg")

# 创建草稿
DraftSkill().create_draft([{"title": "...", "content": html, ...}])
```

## 支持的主题

| 主题 | 说明 |
|------|------|
| macaron | 马卡龙风格(粉紫色 #FF6B9D) |
| shuimo | 水墨风格(深灰蓝 #2C3E50) |
| wenyan | 文雁风格(深蓝绿 #0066FF) |
| houge | 猴哥风格(深蓝橙 #6b5b8a) |
| cuiyu | 翠玉风格(青绿 #1EA089) |
| default | 默认风格(蓝色 #007AFF) |

## 内容审核详解

### 本地重复度检测
- **算法**:n-gram + Jaccard 相似度
- **阈值**:30% 以上判定为重复
- **存储**:自动保存到 `~/.cache/wechat-mp-auto/article_history.json`

### 网络重复度检测
- **算法**:提取关键句 → Tavily 搜索 → 相似度比对
- **阈值**:10% 以上判定为匹配
- **特点**:异步执行,不阻塞主流程
- **缓存**:搜索结果缓存到 `~/.cache/wechat-mp-auto/search_cache.json`

### 敏感词检测
检测词汇:`反动、暴力、色情、赌博、毒品、诈骗、谣言`

## 项目结构

```
wechat-mp-auto/
├── SKILL.md                    # AI 编排指南(本 Skill 的核心文档)
├── metadata.json                # Skill 元数据
├── READ

_meta.json

{
  "ownerId": "kn727d9p0m1nhp3cbbj031hzw98361m5",
  "slug": "wechat-mp-auto",
  "version": "0.1.2",
  "publishedAt": 1774334356963
}

CHANGELOG.md

## [0.1.2] - 2026-03-24

### Fixed
- `article_writer.py`:`convert_to_html` 新增 Markdown 图片语法 `![alt](url)` 处理,修复此前图片无法转 HTML 的问题
- `article_writer.py`:修复 `_remove_mixed_language_spaces` 将 `<img>` 标签误删的问题
- `article_writer.py`:`inject_section_images` 新增 Unicode 标点归一化(U+3001/U+FF0C)和 substring 匹配,修复章节图注入失败
- `article_writer.py`:统一所有 `<img>` 标签的 margin 样式为 16px

### Added
- `image_generator.py`:搜图失败时自动重试 3 次,提升图片获取成功率
- `article_writer.py`:新增 Markdown 图片语法支持(`![name](url)` 在 `convert_to_html` 中转为 `<img>`)

### Changed
- `SKILL.md`:重写第五至八步工作流,描述与实际代码流程一致
- `article_writer.py`:`convert_to_html` 中 `_convert_inline_formatting` 生成的 img 标签统一加 inline style

### Removed
- `article_writer.py`:移除 `convert_to_html` 中冗余的 `inject_section_images` 调用(图片已通过 Markdown 插入,不再依赖此路径)

# Changelog

All notable changes to this project will be documented in this file.

## [0.1.0] - 2026-03-22

### Fixed
- `token_manager.py`:修复 `from .exceptions` 相对导入在 `-m` 模块方式运行时报错的问题,改为绝对导入
- `publish.py`:修复章节图永远 fallback 封面图的问题,新增 `img_gen.search_image()` 搜索并上传各章节独立图片

### Changed
- `draft_skill.py`:统一动态导入为绝对导入风格

## [0.0.8] - 2026-03-21

### Added
- `article_writer.py`:新增 Markdown 语法支持:删除线 `~~text~~`、上标 `^text^`、下标 `~text~`、高亮 `==text==`
- `article_writer.py`:新增任务列表 `- [ ]` / `- [x]`
- `article_writer.py`:新增缩进代码块(4空格或tab开头)
- `article_writer.py`:新增 `*text*` 斜体支持(此前只有 `_text_`)
- `article_writer.py`:新增 HTML 标签透传(`<br>`、`<div>`、`<details>` 等安全标签保留,`<script>` 等危险标签转义)
- `article_writer.py`:新增 `---` 分隔线转 `<hr>`
- `publish.py`:外部图片 URL 自动下载后上传到微信素材库,解决微信不显示外部图片的问题

### Changed
- h2 标题改为使用 `colors.secondary` 作为字体颜色和左侧装饰线,替代原来的 text/primary 色
- `colors.secondary` 正式投入使用,theme YAML 中 h2.color 字段移除(由 secondary 替代)
- `publish.py`:`--theme` 默认值从 `macaron` 改为 `default`
- 统一版本号:README.md、SKILL.md、pyproject.toml、metadata.json 均更新至 v0.0.8

### Fixed
- `article_writer.py`:修复 YAML 中 `h2.color` 显式定义导致 secondary 默认值不生效的问题
- `publish.py`:`find_cover_image` 改为优先用 Pexels 横向搜索封面图,解决封面竖图问题
- `publish.py`:封面图下载后自动压缩(900×500,JPEG 85%)
- `image_generator.py`:新增 Pillow 图片压缩,封面 900×500 / 插图 900×400,统一 JPEG 85%
- `image_generator.py`:Pexels/Unsplash 搜索加 `orientation=landscape` 优先横图
- `draft_skill.py`:`list_drafts` API 返回 key 为 `item`
- 多个 skills 文件:修复 `from src.xxx` import 路径,统一改为 `from xxx`

## [0.0.7] - 2026-03-21
- 重构 `convert_to_html`:Theme YAML 完整读取,所有颜色/字体/间距从 YAML 配置读取,不再硬编码
- 5 个主题 YAML(default/houge/macaron/shuimo/wenyan)统一完整字段结构:colors/body/h1-h3/p/link/blockquote/ul/ol
- 列表改为语义化 `<ul>/<ol>/<li>` 结构

### Fixed
- `publish.py`:修复审核时 `html` 变量未定义的 bug
- `publish.py`:修复封面图占位符 `cover_image_url` 只替换第一处的问题,改为全局替换
- `publish.py`:新增章节图占位符 `*_url` 替换逻辑
- `publish.py`:新增草稿完整性检查中图片 URL 可访问性验证(HEAD 请求)
- `publish.py`:修复 `find_cover_image` 选中缩略图(_thumb)的问题
- `publish.py`:修复外部图片 URL 正则无法匹配 `data-src` 和 `https` 协议的问题

## [0.0.6] - 2026-03-21

### Added
- SKILL.md 新增「接口权限说明」表格,明确标注数据分析 API 仅服务号或已认证订阅号可用
- README.md 注意事项补充数据分析权限说明

### Fixed
- 统一 pyproject.toml 版本号(0.0.3 → 0.0.6),与 metadata.json 保持一致
- 删除临时文件 article_final.h

skill-card.md

## Description:

Wechat Mp Auto automates WeChat Official Account article workflows from topic research and Markdown writing through image handling, content review, WeChat-ready HTML conversion, and draft or publication-related account operations.

This skill is ready for commercial/non-commercial use.

## Publisher:

[wzhaojin](https://clawhub.ai/user/wzhaojin)

### License/Terms of Use:

MIT

## Use Case:

Developers and content operators use this skill to prepare WeChat Official Account posts, research topics, convert Markdown into themed HTML, upload media, review content, and create drafts for account publication workflows.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: The skill can affect a real WeChat account by uploading media, creating drafts, publishing content, reading account data, or using messaging and analytics capabilities.

Mitigation: Use a narrowly scoped account and API keys, review generated drafts before release, and enable only the WeChat permissions needed for the intended workflow.

Risk: Credential handling relies on local files and environment variables.

Mitigation: Store credentials in restricted local files or managed secrets, limit file permissions, and rotate WeChat and third-party API keys regularly.

Risk: Research, review, and image workflows can fetch remote URLs or send content to third-party services.

Mitigation: Avoid untrusted image URLs, use approved research and image providers, and confirm that article content is appropriate to share with configured third-party services.

Risk: Drafts may include a default source URL or attribution that does not match the publisher's intended article source.

Mitigation: Review and change the source URL before creating or publishing drafts.

## Reference(s):

- [ClawHub skill page](https://clawhub.ai/wzhaojin/skills/wechat-mp-auto)
- [Publisher profile](https://clawhub.ai/user/wzhaojin)
- [Homepage URL from artifact metadata](https://github.com/wzhaojin/wechat-mp-auto)
- [Pexels API](https://www.pexels.com/api/)
- [Unsplash Developers](https://unsplash.com/developers)
- [Tavily](https://tavily.com/)

## Skill Output:

**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]

**Output Format:** [Markdown, WeChat-ready HTML, JSON-like tool results, and shell command snippets.]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Uses local configuration and cache paths plus external API credentials for WeChat, optional image providers, and optional research or review services.]

## Skill Version(s):

0.1.2 (source: evidence.json release.version, artifact/CHANGELOG.md, artifact/pyproject.toml, artifact/metadata.json)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to Wechat Mp Auto and adjacent AI workflows.