qihangzhang-272/agent-skill-library/baoyu-post-to-wechat
Claude Code and agent skill by qihangzhang-272/agent-skill-library
- community
Checking that the SKILL.md file is still in the repository.
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 "贴图/图文/文章".
Install
npx vskill@latest install qihangzhang-272/agent-skill-library/baoyu-post-to-wechatSKILL.md
The same SKILL.md was published earlier as qihangzhang-272/agent-skill-library/baoyu-post-to-wechat.
Post to WeChat Official Account
User Input Tools
When this skill prompts the user, follow this tool-selection rule (priority order):
- Prefer built-in user-input tools exposed by the current agent runtime — e.g.,
AskUserQuestion,request_user_input,clarify,ask_user, or any equivalent. - 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.
- 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.
| 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 (文章) | |
scripts/md-to-wechat.ts | Markdown → WeChat-ready HTML with image placeholders | |
scripts/check-permissions.ts | Verify environment & permissions |
Preferences (EXTEND.md)
Check these paths in order; first hit wins:
| Path | Scope | |
|---|---|---|
.baoyu-skills/baoyu-post-to-wechat/EXTEND.md | Project | |
${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-post-to-wechat/EXTEND.md | XDG | |
$HOME/.baoyu-skills/baoyu-post-to-wechat/EXTEND.md | User 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):
| 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 | |
only_fans_can_comment | 0 | articles[].only_fans_can_comment in draft/add |
Recommended EXTEND.md:
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, qihang-editorial. Color presets: blue, green, vermilion, yellow, purple, sky, rose, olive, black, gray, pink, red, orange (or hex).
qihang-editorial 由 qihang-wechat-layout 维护;Markdown 预览、API 发布和浏览器发布共用同一主题实现,不在本技能另存 CSS。
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):
Checks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystroke, API credentials, Chrome conflicts.
此处 Optional 仅指环境诊断。下述内容质量门禁和发布授权不可据此跳过。
ContentAny 发布前质量门禁(必须)
本 Environment 的公众号发布准备必须读取并完成 references/contentany-gate.md:对拟发布的标题与正文取得 ContentAny 真实报告,逐项做有依据的编辑判断,保存最终版本对应的报告与复核结论。用户 2026-09-06 明确要求它作为硬性参考,并澄清不要求逐条照改。不能以模拟报告、工具首页演示数据、自己的评分或其他检测工具代替。
该门禁适用于 API、远程 API、浏览器文章和贴图方式,在向公众号上传素材、保存/更新草稿或执行公开发布前完成。缺报告或存在尚未解决的实质质量问题时,继续本地准备并报告缺口,不调用外部写入;常规“直接推送”授权不等于取消门禁。此规则不追溯改动已完成的历史发布。
用户指定最终整稿的 ContentAny AI 指数必须在 0%–20%(含 20%)内;超过 20% 或没有有效实测指数时禁止发布,不能用正文节选分数、手写身份或编辑判断豁免。其他合理质量问题修改,误报、题材不适用或与已确认表达冲突的建议记录理由后可不采纳;不得编造经历或破坏原意压分。排版预览、授权和平台规则检查仍独立执行。
| Check fails | Fix | |
|---|---|---|
| Chrome | Install Chrome or set WECHAT_BROWSER_CHROME_PATH | |
| Profile dir | Shared profile at baoyu-skills/chrome-profile | |
| Bun runtime | brew install oven-sh/bun/bun or npm install -g bun | |
| Accessibility (macOS) | System Settings → Privacy & Security → Accessibility → enable terminal app | |
| Clipboard copy | Ensure Swift/AppKit (macOS: xcode-select --install) | |
| Paste keystroke (Linux) | Install xdotool (X11) or ydotool (Wayland) | |
| API credentials | Follow guided setup in Step 2, or set in .baoyu-skills/.env |
Image-Text Posting (图文)
Short posts with multiple images (up to 9):
Details: references/image-text-posting.md.
Article Posting Workflow (文章)
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
| Input | Detection | Next | |
|---|---|---|---|
| HTML file | Path ends .html, file exists | Skip to Step 3 | |
| Markdown file | Path ends .md, file exists | Step 2 | |
| Plain text | Not a file path, or file doesn't exist | Save to markdown, then Step 2 |
Plain-text handling:
- Generate slug (first 2-4 meaningful words, kebab-case; translate Chinese to English for the slug).
- Save to
post-to-wechat/YYYY-MM-DD/<slug>.md(create directory if needed). - Continue as a markdown file.
Step 2: Select Publishing Method and Configure
Ask method unless specified in EXTEND.md or CLI:
| Method | Speed | Requires | |
|---|---|---|---|
api (Recommended) | Fast | API credentials (local IP allowlisted) | |
browser | Slow | Chrome + logged-in session | |
remote-api | Fast | API 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
- Theme: CLI
--theme→ EXTEND.mddefault_theme→default(first match wins; do NOT ask if resolved). - Color: CLI
--color→ EXTEND.mddefault_color→ omit (theme default applies). - Validate metadata (frontmatter for markdown, meta tags for HTML):
| Field | Missing → | |
|---|---|---|
| Title | Ask, or press Enter to auto-generate from content | |
| Summary | Frontmatter description → summary → ask or auto-generate | |
| Author | CLI --author → frontmatter author → EXTEND.md default_author | |
| Source URL | CLI --source-url → frontmatter sourceUrl/contentSourceUrl/content_source_url |
Auto-generation: title = first H1/H2 or first sentence; summary = first paragraph, truncated to 120 chars.
- 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
进入本步骤前核对 qa/contentany-review.md 及其原始报告,状态须为“已送检且编辑复核通过”,最终标题、正文和内容型图注应与送检版本一致。不要仅凭回执文字而不检查报告内容。改动内容后按门禁契约复检。
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):
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):
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.
`draft/add` payload rules:
- Endpoint:
POST https://api.weixin.qq.com/cgi-bin/draft/add?access_token=ACCESS_TOKEN article_type:news(default) ornewspic- For
news, includethumb_media_id(cover required) - Always include
need_open_comment(default1) andonly_fans_can_comment(default0) in the request body, even if the CLI doesn't expose them - For
news, optionally includecontent_source_url(original article URL, shown as "阅读原文" link, max 1KB). Provide via--source-urlCLI flag or frontmattersourceUrl/contentSourceUrl/content_source_url
Browser method (accepts --markdown or --html):
Step 5: Completion Report
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/baoyu-post-to-wechat/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/qihangzhang-272/agent-skill-library/baoyu-post-to-wechat)