baoyu-post-to-wechat – skill Viết lách & Nội dung cho agent AI
Đăng nội dung lên Tài khoản Công khai WeChat (微信公众号) qua API hoặc Chrome CDP. Hỗ trợ đăng bài viết (文章) với đầu vào HTML, markdown hoặc văn bản thuần, và đăng dạng ảnh-chữ (贴图, trước đây là 图文) với nhiều ảnh. Quy trình bài viết markdown mặc định chuyển các liên kết ngoài thông thường thành trích dẫn cuối bài để thân thiện với WeChat
Cài skill baoyu-post-to-wechat bằng một lệnh
Chọn công cụ bạn đang dùng, copy lệnh và dán vào terminal. Skill sẽ nằm trong thư mục skills của công cụ đó và sẵn sàng dùng ở phiên làm việc tiếp theo.
Claude Code
mkdir -p ~/.claude/skills && curl -fsSL https://skill.dn1nguoi.com/z/baoyu-post-to-wechat-7bcd7.tgz | tar xz -C ~/.claude/skills
Gọi trong Claude Code: /baoyu-post-to-wechat – rồi mô tả công việc bạn muốn làm.
Codex
mkdir -p ~/.codex/skills && curl -fsSL https://skill.dn1nguoi.com/z/baoyu-post-to-wechat-7bcd7.tgz | tar xz -C ~/.codex/skills
Gọi trong Codex: $baoyu-post-to-wechat – rồi mô tả công việc bạn muốn làm.
Hermes Agent
mkdir -p ~/.hermes/skills && curl -fsSL https://skill.dn1nguoi.com/z/baoyu-post-to-wechat-7bcd7.tgz | tar xz -C ~/.hermes/skills
Gọi trong Hermes Agent: /baoyu-post-to-wechat – rồi mô tả công việc bạn muốn làm.
DeepSeek
mkdir -p ~/.deepcode/skills && curl -fsSL https://skill.dn1nguoi.com/z/baoyu-post-to-wechat-7bcd7.tgz | tar xz -C ~/.deepcode/skills
Gọi trong DeepSeek: /baoyu-post-to-wechat – rồi mô tả công việc bạn muốn làm.
Nội dung SKILL.md
Nội dung SKILL.md gốc bằng tiếng Anh.
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.
| 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:
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.comRaw 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.tsChecks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystroke, API credentials, Chrome conflicts.
| 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):
${BUN_X} {baseDir}/scripts/wechat-browser.ts --markdown article.md --images ./images/
${BUN_X} {baseDir}/scripts/wechat-browser.ts --title "标题" --content "内容" --image img.png --submitDetails: 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 completionStep 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:
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:
| 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
1. Theme: CLI --theme → EXTEND.md default_theme → default (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):
| 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.
4. 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 inpu
… (nội dung đầy đủ có trong gói tải về)
Skill liên quan
- x-article-publisher – 自媒体创作者与内容创作者在需要将 Markdown 长文发布到 X (Twitter) Articles 编辑器时使用。技能自动将 Markdown…
- blogwatcher – Theo dõi blog và feed RSS/Atom qua công cụ blogwatcher-cli.
- content-strategy – Khi người dùng muốn lập kế hoạch chiến lược nội dung, quyết định nên tạo nội dung gì…
- ai-storyboard-generator – Cài đặt và sử dụng gói AI Storyboard Generator chính thức, ghim theo digest, cho công…
- board – Đọc, ghi và duyệt message board AgentHub để phối hợp giữa các agent. Dùng khi người dùng…
- baoyu-post-to-weibo – Đăng nội dung lên Weibo (微博). Hỗ trợ bài đăng thường với văn bản, hình ảnh và video, và…
- x-article-publisher – Dành cho người sáng tạo nội dung khi cần đăng bài Markdown dài lên X (Twitter). Dùng…
- incremental-implementation – Triển khai thay đổi theo từng lát mỏng, có thể kiểm chứng. Dùng khi triển khai tính năng…