baoyu-post-to-wechat
This skill publishes content to WeChat Official Accounts through API or browser automation, supporting article posts in HTML, markdown, or plain text formats, and image-text posts with multiple images. Use it when users request WeChat Official Account publishing, indicated by phrases like "发布公众号," "post to wechat," or "图文/文章."
git clone --depth 1 https://github.com/anbeime/skill /tmp/baoyu-post-to-wechat && cp -r /tmp/baoyu-post-to-wechat/skills/content-creation-publisher/baoyu-post-to-wechat ~/.claude/skills/baoyu-post-to-wechatSKILL.md
# Post to WeChat Official Account
## Language
**Match user's language**: Respond in the same language the user uses. If user writes in Chinese, respond in Chinese. If user writes in English, respond in English.
## Script Directory
**Agent Execution**: Determine this SKILL.md directory as `SKILL_DIR`, then use `${SKILL_DIR}/scripts/<name>.ts`.
| Script | Purpose |
|--------|---------|
| `scripts/wechat-browser.ts` | Image-text posts (图文) |
| `scripts/wechat-article.ts` | Article posting via browser (文章) |
| `scripts/wechat-api.ts` | Article posting via API (文章) |
## Preferences (EXTEND.md)
Use Bash to check EXTEND.md existence (priority order):
```bash
# Check project-level first
test -f .baoyu-skills/baoyu-post-to-wechat/EXTEND.md && echo "project"
# Then user-level (cross-platform: $HOME works on macOS/Linux/WSL)
test -f "$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md" && echo "user"
```
┌────────────────────────────────────────────────────────┬───────────────────┐
│ Path │ Location │
├────────────────────────────────────────────────────────┼───────────────────┤
│ .baoyu-skills/baoyu-post-to-wechat/EXTEND.md │ Project directory │
├────────────────────────────────────────────────────────┼───────────────────┤
│ $HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md │ User home │
└────────────────────────────────────────────────────────┴───────────────────┘
┌───────────┬───────────────────────────────────────────────────────────────────────────┐
│ Result │ Action │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Found │ Read, parse, apply settings │
├───────────┼───────────────────────────────────────────────────────────────────────────┤
│ Not found │ Run first-time setup ([references/config/first-time-setup.md](references/config/first-time-setup.md)) → Save → Continue │
└───────────┴───────────────────────────────────────────────────────────────────────────┘
**EXTEND.md Supports**: Default theme | Default publishing method (api/browser) | Default author | Default open-comment switch | Default fans-only-comment switch | Chrome profile path
First-time setup: [references/config/first-time-setup.md](references/config/first-time-setup.md)
**Minimum supported keys** (case-insensitive, accept `1/0` or `true/false`):
| Key | Default | Mapping |
|-----|---------|---------|
| `default_author` | empty | Fallback for `author` when CLI/frontmatter not provided |
| `need_open_comment` | `1` | `articles[].need_open_comment` in `draft/add` request |
| `only_fans_can_comment` | `0` | `articles[].only_fans_can_comment` in `draft/add` request |
**Recommended EXTEND.md example**:
```md
default_theme: default
default_publish_method: api
default_author: 宝玉
need_open_comment: 1
only_fans_can_comment: 0
chrome_profile_path: /path/to/chrome/profile
```
**Value priority**:
1. CLI arguments
2. Frontmatter
3. EXTEND.md
4. Skill defaults
## Image-Text Posting (图文)
For short posts with multiple images (up to 9):
```bash
npx -y bun ${SKILL_DIR}/scripts/wechat-browser.ts --markdown article.md --images ./images/
npx -y bun ${SKILL_DIR}/scripts/wechat-browser.ts --title "标题" --content "内容" --image img.png --submit
```
See [references/image-text-posting.md](references/image-text-posting.md) for details.
## Article Posting Workflow (文章)
Copy this checklist and check off items as you complete them:
```
Publishing Progress:
- [ ] Step 0: Load preferences (EXTEND.md)
- [ ] Step 1: Determine input type
- [ ] Step 2: Check markdown-to-html skill
- [ ] Step 3: Convert to HTML
- [ ] Step 4: Validate metadata (title, summary, cover)
- [ ] Step 5: Select method and configure credentials
- [ ] Step 6: Publish to WeChat
- [ ] Step 7: Report completion
```
### Step 0: Load Preferences
Check and load EXTEND.md settings (see Preferences section above).
**CRITICAL**: If not found, complete first-time setup BEFORE any other steps or questions.
Resolve and store these defaults for later steps:
- `default_author`
- `need_open_comment` (default `1`)
- `only_fans_can_comment` (default `0`)
### Step 1: Determine Input Type
| Input Type | Detection | Action |
|------------|-----------|--------|
| HTML file | Path ends with `.html`, file exists | Skip to Step 4 |
| Markdown file | Path ends with `.md`, file exists | Continue to Step 2 |
| Plain text | Not a file path, or file doesn't exist | Save to markdown, then Step 2 |
**Plain Text Handling**:
1. Generate slug from content (first 2-4 meaningful words, kebab-case)
2. Create directory and save file:
```bash
mkdir -p "$(pwd)/post-to-wechat/$(date +%Y-%m-%d)"
# Save content to: post-to-wechat/yyyy-MM-dd/[slug].md
```
3. Continue processing as markdown file
**Slug Examples**:
- "Understanding AI Models" → `understanding-ai-models`
- "人工智能的未来" → `ai-future` (translate to English for slug)
### Step 2: Check Markdown-to-HTML Skill
**Skip if**: Input is `.html` file
**Skill Discovery**:
```bash
# Check if baoyu-markdown-to-html exists
test -f skills/baoyu-markdown-to-html/SKILL.md && echo "found"
```
| Result | Action |
|--------|--------|
| Found | Read its SKILL.md, continue to Step 3 |
| Multiple skills | AskUserQuestion to choose |
| Not found | Show installation suggestion |
**When Not Found**:
```
No markdown-to-html skill found.
Suggested installation:
https://github.com/JimLiu/baoyu-skills/blob/main/skills/baoyu-markdown-to-html/SKILL.md
Options:
A) Cancel - install the skill first
B) Continue - provide HTML file manually
```
### Step 3: Convert Markdown to HTML
**Skip if**: Input is `.html` file
1. **Ask theme preference** (unless specified in EXTEND.md or CLI):
| Theme | Description |
|-------|-------------|
| `default` | 经典主题 - 传统排版,标题居中带底边,二级标题白字彩底 |
| `grace` | 优雅主题 - 文字阴影,圆角卡片,精致引用块 |
| `simple` |专为软件开发工程师与综合办公文员打造。当你在等待任务执行、工作疲惫或需要鼓励时,使用此技能通过智谱AI自动生成温暖对话回应与场景配图,一键获取专属情绪价值与虚拟陪伴,让AI助手更懂你。
软件开发工程师与综合办公文员在长时间独自执行后台任务或处理繁琐工作时,当需要情绪陪伴与互动反馈,请使用此技能。小跃虚拟伴侣会在任务期间主动陪聊,智能生成专属生活照片并通过飞书发送温暖消息,为你提供全天候的情绪价值与贴心陪伴。
产品经理与项目管理专家在应对复杂项目时,使用此技能可动态组建包含“执行、指挥、评审”的专属AI团队。实时查看多智能体辩论与决策全过程,共享统一上下文记忆,一键完成从会议决策到系统构建的全流程高效协同!
电商运营与内容创作者在需要制作带货短视频时,用此技能一键生成9:16竖屏数字人成片。自动编排AI绘画、语音合成与视频生成,快速产出“小省导购员”专属形象与专业配音,让多模态视频制作省时省力。
内容创作者和自媒体创作者在撰写长文时,当需要“给文章配图”或“添加插图”时使用。自动分析文章结构,精准识别需要视觉辅助的位置,生成并插入契合语境的插画,将抽象概念具象化,一键完成高质量图文排版,大幅提升阅读体验。
内容创作者在需要哄睡3-12岁儿童或制作睡前音频内容时,可一键生成20个精选故事列表,或直接讲解指定寓言与成语。以0.6倍舒缓语速和亲切语气自动营造温馨哄睡氛围,轻松搞定高质量睡前陪伴。
网页开发工程师与运营专员在需要自动化现有 Chrome 浏览器时必用!通过 CDP 协议无缝接管当前浏览器,自动配置环境并实时可视化执行任务。完美保留登录状态,一键完成复杂网页自动化流程,让繁琐操作自动化。
内容创作者与自媒体创作者在需要将网页素材转化为多平台图文时,使用本技能可自动完成网页提取、Markdown排版美化、智能配图,并一键发布至微信公众号与X/Twitter,轻松实现从采集到发布的一站式自动化工作流。