BA

baoyu-post-to-wechat

Baoyu-post-to-wechat converts markdown and HTML content into WeChat-compatible formats and manages the publishing workflow.

Install

mkdir -p .claude/skills/baoyu-post-to-wechat && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1101" && unzip -o skill.zip -d .claude/skills/baoyu-post-to-wechat && rm skill.zip

Installs to .claude/skills/baoyu-post-to-wechat

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Posts 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 into bottom citations for WeChat-friendly output. Use when user mentions "发布公众号", "post to wechat", "微信公众号", or "贴图/图文/文章".
403 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • Converts markdown and HTML to WeChat formats
  • Publishes multi-image posts and articles
  • Automates article posting via browser automation
  • Converts external links to bottom citations
  • Verifies environment and account permissions

How it works

It uses headless browser automation or API requests to programmatically format and upload content to the WeChat backend.

Inputs & outputs

You give it
Markdown/HTML content or image sets
You get back
Published article on WeChat platform

When to use baoyu-post-to-wechat

  • Publishing articles to WeChat Official Account
  • Automating content distribution to WeChat
  • Uploading images and text posts to WeChat

About this skill

Post to WeChat Official Account

User Input Tools

When this skill prompts the user, follow this tool-selection rule (priority order):

  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.
  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.
  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.

Concrete AskUserQuestion references below are examples — substitute the local equivalent in other runtimes.

Language

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.

Script Directory

{baseDir} = this SKILL.md's directory. Resolve ${BUN_X}: prefer bun; else npx -y bun; else suggest brew install oven-sh/bun/bun.

ScriptPurpose
scripts/wechat-browser.tsImage-text posts (图文)
scripts/wechat-article.tsArticle posting via browser (文章)
scripts/wechat-api.tsArticle posting via API (文章)
scripts/md-to-wechat.tsMarkdown → WeChat-ready HTML with image placeholders
scripts/check-permissions.tsVerify environment & permissions

Preferences (EXTEND.md)

Check these paths in order; first hit wins:

PathScope
.baoyu-skills/baoyu-post-to-wechat/EXTEND.mdProject
${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-post-to-wechat/EXTEND.mdXDG
$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.mdUser home

Found → read, parse, apply. Not found → run first-time setup (references/config/first-time-setup.md) before anything else.

Minimum keys (case-insensitive, accept 1/0 or true/false):

KeyDefaultMapping
default_authoremptyFallback for author when CLI/frontmatter not provided
need_open_comment1articles[].need_open_comment in draft/add
only_fans_can_comment0articles[].only_fans_can_comment in draft/add

Recommended EXTEND.md:

default_theme: default
default_color: blue
default_publish_method: browser
default_author: 宝玉
need_open_comment: 1
only_fans_can_comment: 0
chrome_profile_path: /path/to/chrome/profile

# Remote API publishing (optional) — only set if WeChat's IP allowlist
# excludes your local machine. See "Remote API Method" below.
# remote_publish_host: server.example.com
# remote_publish_user: deploy
# remote_publish_port: 22
# remote_publish_identity_file: ~/.ssh/id_ed25519
# remote_publish_known_hosts_file: ~/.ssh/known_hosts
# remote_publish_strict_host_key_checking: accept-new
# remote_publish_connect_timeout: 10
# remote_publish_proxy_jump: bastion.example.com

Raw ssh / scp options are intentionally not supported; only the typed keys above are honored. Authentication is SSH key only (no passwords).

Theme options: default, grace, simple, modern. Color presets: blue, green, vermilion, yellow, purple, sky, rose, olive, black, gray, pink, red, orange (or hex).

Value priority: CLI args → frontmatter → EXTEND.md (account-level → global) → skill defaults.

Multi-Account Support

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>).

Full details — compatibility rules, per-account keys, credential resolution, per-account Chrome profiles, CLI usage — in references/multi-account.md.

Pre-flight Check (Optional)

Before first use, suggest the environment check (user can skip):

${BUN_X} {baseDir}/scripts/check-permissions.ts

Checks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystroke, API credentials, Chrome conflicts.

Check failsFix
ChromeInstall Chrome or set WECHAT_BROWSER_CHROME_PATH
Profile dirShared profile at baoyu-skills/chrome-profile
Bun runtimebrew install oven-sh/bun/bun or npm install -g bun
Accessibility (macOS)System Settings → Privacy & Security → Accessibility → enable terminal app
Clipboard copyEnsure Swift/AppKit (macOS: xcode-select --install)
Paste keystroke (Linux)Install xdotool (X11) or ydotool (Wayland)
API credentialsFollow guided setup in Step 2, or set in .baoyu-skills/.env

Image-Text Posting (图文)

Short posts with multiple images (up to 9):

${BUN_X} {baseDir}/scripts/wechat-browser.ts --markdown article.md --images ./images/
${BUN_X} {baseDir}/scripts/wechat-browser.ts --title "标题" --content "内容" --image img.png --submit

Details: references/image-text-posting.md.

Article Posting Workflow (文章)

- [ ] Step 0: Load preferences (EXTEND.md)
- [ ] Step 0.5: Resolve account (multi-account only — see references/multi-account.md)
- [ ] Step 1: Determine input type
- [ ] Step 2: Select method and configure credentials
- [ ] Step 3: Resolve theme/color and validate metadata
- [ ] Step 4: Publish to WeChat
- [ ] Step 5: Report completion

Step 0: Load Preferences

Check and load EXTEND.md (see "Preferences" above). If not found, complete first-time setup before any other questions. Resolve and cache for later steps: default_theme, default_color, default_author, need_open_comment, only_fans_can_comment.

Step 1: Determine Input Type

InputDetectionNext
HTML filePath ends .html, file existsSkip to Step 3
Markdown filePath ends .md, file existsStep 2
Plain textNot a file path, or file doesn't existSave to markdown, then Step 2

Plain-text handling:

  1. Generate slug (first 2-4 meaningful words, kebab-case; translate Chinese to English for the slug).
  2. Save to post-to-wechat/YYYY-MM-DD/<slug>.md (create directory if needed).
  3. Continue as a markdown file.

Step 2: Select Publishing Method and Configure

Ask method unless specified in EXTEND.md or CLI:

MethodSpeedRequires
api (Recommended)FastAPI credentials (local IP allowlisted)
browserSlowChrome + logged-in session
remote-apiFastAPI credentials + an SSH-reachable server whose IP is on the WeChat allowlist

API selected + missing credentials → run guided setup per references/api-setup.md (writes to .baoyu-skills/.env).

remote-api method: WeChat's "公众号设置 → IP 白名单" often limits API access to one or two fixed IPs. If your local machine's IP is not on that list but a cloud server's is, use remote-api: all markdown rendering, image processing, draft assembly, and HTML rewriting still happen locally, and only the outbound HTTPS calls to api.weixin.qq.com (token, uploadimg, add_material, draft/add) are tunneled through an SSH SOCKS5 dynamic port forward (ssh -N -D) so that WeChat sees the remote server as the source IP. No files are written to the remote host; AppSecret never leaves the local process. Requires only sshd and outbound network on the remote host — no Python, no agent process. See "Remote API Method" below.

Step 3: Resolve Theme/Color and Validate Metadata

  1. Theme: CLI --theme → EXTEND.md default_themedefault (first match wins; do NOT ask if resolved).
  2. Color: CLI --color → EXTEND.md default_color → omit (theme default applies).
  3. Validate metadata (frontmatter for markdown, meta tags for HTML):
FieldMissing →
TitleAsk, or press Enter to auto-generate from content
SummaryFrontmatter descriptionsummary → ask or auto-generate
AuthorCLI --author → frontmatter author → EXTEND.md default_author
Source URLCLI --source-url → frontmatter sourceUrl/contentSourceUrl/content_source_url

Auto-generation: title = first H1/H2 or first sentence; summary = first paragraph, truncated to 120 chars.

  1. Cover image (required for API article_type=news): CLI --cover → frontmatter (coverImage / featureImage / cover / image) → imgs/cover.png → first inline image → stop and request one if still missing.

Step 4: Publish

Important — never pre-convert markdown to HTML. Publishing scripts handle the conversion internally and the two methods render images differently: API renders <img> tags for upload, browser uses placeholders for paste-and-replace. Passing a pre-converted HTML breaks one or the other.

Markdown citation default: for markdown input, ordinary external links are converted to bottom citations by default. Use --no-cite only if the user explicitly wants to keep inline links. Existing HTML input is left as-is.

API method (accepts .md or .html):

${BUN_X} {baseDir}/scripts/wechat-api.ts <file> --theme <theme> [--color <color>] [--title <title>] [--summary <summary>] [--author <author>] [--cover <cover_path>] [--source-url <url>] [--no-cite]

Always pass --theme even if it's default. Only pass --color when explicitly set by the user or EXTEND.md.

Remote API method (same script, adds --remote):

${BUN_X} {baseDir}/scripts/wechat-api.ts <file> --theme <theme> --remote [--remote-host <host>] [--remote-user <user>] [--remote-port <port>] [--remote-identity-file <path>] [--remote-known-hosts-file <path>] [--remote-strict-host-key-checking yes|no|accept-new] [--remote-connect-timeout <s>] [--remote-proxy-jump <spec>]

Any --remote-* flag implies --remote. CLI values override account-level then global remote_publish_* keys from EXTEND.md. Setting default_publish_method: remote-api also enables remote mode without --remote.

**`d


Content truncated.

When not to use it

  • Platforms other than WeChat Official Account
  • Without access to the publisher account

Prerequisites

Bun runtimeWeChat Official Account access

Limitations

  • Platform updates may break automation flows
  • Requires specific login session handling

How it compares

It automates the specific formatting and posting steps unique to WeChat's interface requirements.

Compared to similar skills

baoyu-post-to-wechat side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
baoyu-post-to-wechat (this skill)72moReviewIntermediate
voicemode82moReviewBeginner
campaign-orchestration610moNo flagsIntermediate
reddit-commenter66moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

baoyu-xhs-images

JimLiu

Generates Xiaohongshu (Little Red Book) infographic series with 10 visual styles and 8 layouts. Breaks content into 1-10 cartoon-style images optimized for XHS engagement. Use when user mentions "小红书图片", "XHS images", "RedNote infographics", "小红书种草", or wants social media infographics for Chinese platforms.

2051

baoyu-article-illustrator

JimLiu

Analyzes article structure, identifies positions requiring visual aids, generates illustrations with Type × Style two-dimension approach. Use when user asks to "illustrate article", "add images", "generate images for article", or "为文章配图".

1848

baoyu-comic

JimLiu

Knowledge comic creator supporting multiple art styles and tones. Creates original educational comics with detailed panel layouts and sequential image generation. Use when user asks to create "知识漫画", "教育漫画", "biography comic", "tutorial comic", or "Logicomix-style comic".

1329

baoyu-infographic

JimLiu

Generates professional infographics with 20 layout types and 17 visual styles. Analyzes content, recommends layout×style combinations, and generates publication-ready infographics. Use when user asks to create "infographic", "信息图", "visual summary", or "可视化".

1230

baoyu-compress-image

JimLiu

Compresses images to WebP (default) or PNG with automatic tool selection. Use when user asks to "compress image", "optimize image", "convert to webp", or reduce image file size.

1129

baoyu-cover-image

JimLiu

Generates article cover images with 5 dimensions (type, palette, rendering, text, mood) combining 9 color palettes and 6 rendering styles. Supports cinematic (2.35:1), widescreen (16:9), and square (1:1) aspects. Use when user asks to "generate cover image", "create article cover", or "make cover".

1020

Search skills

Search the agent skills registry