$npx -y skills add JimLiu/baoyu-skills --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. Markdown article workflows default to converting ordinary external links
| 1 | # Post to WeChat Official Account |
| 2 | |
| 3 | ## User Input Tools |
| 4 | |
| 5 | When this skill prompts the user, follow this tool-selection rule (priority order): |
| 6 | |
| 7 | 1. **Prefer built-in user-input tools** exposed by the current agent runtime — e.g., `AskUserQuestion`, `request_user_input`, `clarify`, `ask_user`, or any equivalent. |
| 8 | 2. **Fallback**: if no such tool exists, emit a numbered plain-text message and ask the user to reply with the chosen number/answer for each question. |
| 9 | 3. **Batching**: if the tool supports multiple questions per call, combine all applicable questions into a single call; if only single-question, ask them one at a time in priority order. |
| 10 | |
| 11 | Concrete `AskUserQuestion` references below are examples — substitute the local equivalent in other runtimes. |
| 12 | |
| 13 | ## Language |
| 14 | |
| 15 | Respond in the user's language. If they write in Chinese, reply in Chinese; if English, English. Keep technical tokens (paths, flags, field names) in English. |
| 16 | |
| 17 | ## Script Directory |
| 18 | |
| 19 | `{baseDir}` = this SKILL.md's directory. Resolve `${BUN_X}`: prefer `bun`; else `npx -y bun`; else suggest `brew install oven-sh/bun/bun`. |
| 20 | |
| 21 | | Script | Purpose | |
| 22 | |--------|---------| |
| 23 | | `scripts/wechat-browser.ts` | Image-text posts (图文) | |
| 24 | | `scripts/wechat-article.ts` | Article posting via browser (文章) | |
| 25 | | `scripts/wechat-api.ts` | Article posting via API (文章) | |
| 26 | | `scripts/md-to-wechat.ts` | Markdown → WeChat-ready HTML with image placeholders | |
| 27 | | `scripts/check-permissions.ts` | Verify environment & permissions | |
| 28 | |
| 29 | ## Preferences (EXTEND.md) |
| 30 | |
| 31 | Check these paths in order; first hit wins: |
| 32 | |
| 33 | | Path | Scope | |
| 34 | |------|-------| |
| 35 | | `.baoyu-skills/baoyu-post-to-wechat/EXTEND.md` | Project | |
| 36 | | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-post-to-wechat/EXTEND.md` | XDG | |
| 37 | | `$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md` | User home | |
| 38 | |
| 39 | Found → read, parse, apply. Not found → run first-time setup (`references/config/first-time-setup.md`) before anything else. |
| 40 | |
| 41 | **Minimum keys** (case-insensitive, accept `1/0` or `true/false`): |
| 42 | |
| 43 | | Key | Default | Mapping | |
| 44 | |-----|---------|---------| |
| 45 | | `default_author` | empty | Fallback for `author` when CLI/frontmatter not provided | |
| 46 | | `need_open_comment` | `1` | `articles[].need_open_comment` in `draft/add` | |
| 47 | | `only_fans_can_comment` | `0` | `articles[].only_fans_can_comment` in `draft/add` | |
| 48 | |
| 49 | **Recommended EXTEND.md**: |
| 50 | |
| 51 | ```md |
| 52 | default_theme: default |
| 53 | default_color: blue |
| 54 | default_publish_method: browser |
| 55 | default_author: 宝玉 |
| 56 | need_open_comment: 1 |
| 57 | only_fans_can_comment: 0 |
| 58 | chrome_profile_path: /path/to/chrome/profile |
| 59 | |
| 60 | # Remote API publishing (optional) — only set if WeChat's IP allowlist |
| 61 | # excludes your local machine. See "Remote API Method" below. |
| 62 | # remote_publish_host: server.example.com |
| 63 | # remote_publish_user: deploy |
| 64 | # remote_publish_port: 22 |
| 65 | # remote_publish_identity_file: ~/.ssh/id_ed25519 |
| 66 | # remote_publish_known_hosts_file: ~/.ssh/known_hosts |
| 67 | # remote_publish_strict_host_key_checking: accept-new |
| 68 | # remote_publish_connect_timeout: 10 |
| 69 | # remote_publish_proxy_jump: bastion.example.com |
| 70 | ``` |
| 71 | |
| 72 | Raw `ssh` / `scp` options are intentionally not supported; only the typed keys above are honored. Authentication is SSH key only (no passwords). |
| 73 | |
| 74 | **Theme options**: default, grace, simple, modern. **Color presets**: blue, green, vermilion, yellow, purple, sky, rose, olive, black, gray, pink, red, orange (or hex). |
| 75 | |
| 76 | **Value priority**: CLI args → frontmatter → EXTEND.md (account-level → global) → skill defaults. |
| 77 | |
| 78 | ## Multi-Account Support |
| 79 | |
| 80 | EXTEND.md supports an `accounts:` block for managing multiple Official Accounts. With 2+ entries, the workflow inserts a Step 0.5 to prompt for account selection (or auto-selects based on `default: true` or `--account <alias>`). |
| 81 | |
| 82 | Full details — compatibility rules, per-account keys, credential resolution, per-account Chrome profiles, CLI usage — in `references/multi-account.md`. |
| 83 | |
| 84 | ## Pre-flight Check (Optional) |
| 85 | |
| 86 | Before first use, suggest the environment check (user can skip): |
| 87 | |
| 88 | ```bash |
| 89 | ${BUN_X} {baseDir}/scripts/check-permissions.ts |
| 90 | ``` |
| 91 | |
| 92 | Checks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystroke, API credentials, Chrome conflicts. |
| 93 | |
| 94 | | Check fails | Fix | |
| 95 | |-------------|-----| |
| 96 | | Chrome | Install Chrome or set `WECHAT_BROWSER_CHROME_PATH` | |
| 97 | | Profile dir | Shared profile at `baoyu-skills/chrome-profile` | |
| 98 | | Bun runtime | `brew install oven-sh/bun/bun` or `npm install -g bun` | |
| 99 | | Accessibility (macOS) | |