$npx -y skills add szsip239/teamclaw --skill baoyu-post-to-wechatPosts content to WeChat Official Account (微信公众号) via API or Chrome CDP. Supports article posting (文章) with HTML, markdown, or plain text input, and image-text posting (贴图, formerly 图文) with multiple images. Use when user mentions "发布公众号", "post to wechat", "微信公众号", or "贴图/图文/文章".
| 1 | # Post to WeChat Official Account |
| 2 | |
| 3 | ## Language |
| 4 | |
| 5 | **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. |
| 6 | |
| 7 | ## Script Directory |
| 8 | |
| 9 | **Agent Execution**: Determine this SKILL.md directory as `SKILL_DIR`, then use `${SKILL_DIR}/scripts/<name>.ts`. |
| 10 | |
| 11 | | Script | Purpose | |
| 12 | |--------|---------| |
| 13 | | `scripts/wechat-browser.ts` | Image-text posts (图文) | |
| 14 | | `scripts/wechat-article.ts` | Article posting via browser (文章) | |
| 15 | | `scripts/wechat-api.ts` | Article posting via API (文章) | |
| 16 | | `scripts/md-to-wechat.ts` | Markdown → WeChat-ready HTML with image placeholders | |
| 17 | | `scripts/check-permissions.ts` | Verify environment & permissions | |
| 18 | |
| 19 | ## Preferences (EXTEND.md) |
| 20 | |
| 21 | Use Bash to check EXTEND.md existence (priority order): |
| 22 | |
| 23 | ```bash |
| 24 | # Check project-level first |
| 25 | test -f .baoyu-skills/baoyu-post-to-wechat/EXTEND.md && echo "project" |
| 26 | |
| 27 | # Then user-level (cross-platform: $HOME works on macOS/Linux/WSL) |
| 28 | test -f "$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md" && echo "user" |
| 29 | ``` |
| 30 | |
| 31 | ┌────────────────────────────────────────────────────────┬───────────────────┐ |
| 32 | │ Path │ Location │ |
| 33 | ├────────────────────────────────────────────────────────┼───────────────────┤ |
| 34 | │ .baoyu-skills/baoyu-post-to-wechat/EXTEND.md │ Project directory │ |
| 35 | ├────────────────────────────────────────────────────────┼───────────────────┤ |
| 36 | │ $HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md │ User home │ |
| 37 | └────────────────────────────────────────────────────────┴───────────────────┘ |
| 38 | |
| 39 | ┌───────────┬───────────────────────────────────────────────────────────────────────────┐ |
| 40 | │ Result │ Action │ |
| 41 | ├───────────┼───────────────────────────────────────────────────────────────────────────┤ |
| 42 | │ Found │ Read, parse, apply settings │ |
| 43 | ├───────────┼───────────────────────────────────────────────────────────────────────────┤ |
| 44 | │ Not found │ Run first-time setup ([references/config/first-time-setup.md](references/config/first-time-setup.md)) → Save → Continue │ |
| 45 | └───────────┴───────────────────────────────────────────────────────────────────────────┘ |
| 46 | |
| 47 | **EXTEND.md Supports**: Default theme | Default color | Default publishing method (api/browser) | Default author | Default open-comment switch | Default fans-only-comment switch | Chrome profile path |
| 48 | |
| 49 | First-time setup: [references/config/first-time-setup.md](references/config/first-time-setup.md) |
| 50 | |
| 51 | **Minimum supported keys** (case-insensitive, accept `1/0` or `true/false`): |
| 52 | |
| 53 | | Key | Default | Mapping | |
| 54 | |-----|---------|---------| |
| 55 | | `default_author` | empty | Fallback for `author` when CLI/frontmatter not provided | |
| 56 | | `need_open_comment` | `1` | `articles[].need_open_comment` in `draft/add` request | |
| 57 | | `only_fans_can_comment` | `0` | `articles[].only_fans_can_comment` in `draft/add` request | |
| 58 | |
| 59 | **Recommended EXTEND.md example**: |
| 60 | |
| 61 | ```md |
| 62 | default_theme: default |
| 63 | default_color: blue |
| 64 | default_publish_method: api |
| 65 | default_author: 宝玉 |
| 66 | need_open_comment: 1 |
| 67 | only_fans_can_comment: 0 |
| 68 | chrome_profile_path: /path/to/chrome/profile |
| 69 | ``` |
| 70 | |
| 71 | **Theme options**: default, grace, simple, modern |
| 72 | |
| 73 | **Color presets**: blue, green, vermilion, yellow, purple, sky, rose, olive, black, gray, pink, red, orange (or hex value) |
| 74 | |
| 75 | **Value priority**: |
| 76 | 1. CLI arguments |
| 77 | 2. Frontmatter |
| 78 | 3. EXTEND.md |
| 79 | 4. Skill defaults |
| 80 | |
| 81 | ## Pre-flight Check (Optional) |
| 82 | |
| 83 | Before first use, suggest running the environment check. User can skip if they prefer. |
| 84 | |
| 85 | ```bash |
| 86 | npx -y bun ${SKILL_DIR}/scripts/check-permissions.ts |
| 87 | ``` |
| 88 | |
| 89 | Checks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystroke, API credentials, Chrome conflicts. |
| 90 | |
| 91 | **If any check fails**, provide fix guidance per item: |
| 92 | |
| 93 | | Check | Fix | |
| 94 | |-------|-----| |
| 95 | | Chrome | Install Chrome or set `WECHAT_BROWSER_CHROME_PATH` env var | |
| 96 | | Profile dir | Ensure `~/.local/share/wechat-browser-profile` is writable | |
| 97 | | Bun runtime | `curl -fsSL https://bun.sh/install \| bash` | |
| 98 | | Accessibility (macOS) | System Settings → Privacy & Security → Accessibility → enable terminal app | |
| 99 | | Clipboard copy | Ensure Swift/AppKit available (macOS Xcode CLI tools: `xcode-select --install`) | |
| 100 | | Paste keystroke (macOS) | Same as Accessibility fix above | |
| 101 | | Paste keystroke (Linux) | Install `xdotool` (X11) or `ydotool` (Wayland) | |
| 102 | | API credentials | Follow guided setup in Step 2, or manually set in `.baoyu-skills/.env` | |
| 103 | |
| 104 | ## Image-Text Posting (图文) |
| 105 | |
| 106 | For short posts with multiple images (up to 9): |
| 107 | |
| 108 | ```bash |
| 109 | npx -y bun ${SKILL_DIR}/scripts/wechat-browser.ts --ma |