This skill is responsible for exactly one thing: sending the already-finished blog master draft through @wechatsync/cli to the draft boxes of multiple platforms.
The boundaries are very clear:
- Responsible for: pre-check, platform selection, dry-run, actual sync, result reporting
- Not responsible for: rewriting the body text
- Not responsible for: mainland China compliance sanitization
- Not responsible for: generating platform-specific titles, summaries, or cover images
- Not responsible for: replacing external links in the master draft
- Not responsible for: deleting or modifying source files
One-sentence principle: this layer only does the part of "delivering the existing md to each platform's draft box"; rewriting is another skill's job.
Working Scope
Applicable scenarios:
- The user says "publish this to Zhihu and Juejin"
- The user says "sync to the WeChat Official Account draft box"
- The user says "this master draft is finished, help me publish it"
- The user says "do a dry-run first to see where it can be published"
Not applicable scenarios:
- The user says "help me rewrite it in WeChat Official Account style"
- The user says "run a compliance check"
- The user says "help me add a summary/cover/title"
- The user says "scrape the body text from a URL"
Any of the above is outside the boundaries of this skill. Stop and tell the user "the publishing skill does not do rewriting; that is another process".
Required Inputs
Before each execution, at minimum obtain:
- Source file path: a finished
.mdfile path (for example,path/to/your-article.md) - Target platform list: comma-separated platform names (for example,
zhihu,juejin,csdn)
Optional supplements:
--title: explicitly override the title (by default extracted from frontmatter or the first#extracted)--cover: cover image URL or local path (required for Zhihu/WeChat Official Account/Xiaohongshu)
Preconditions
Before starting, these 3 things must be confirmed:
- CLI is installed
- Running
which wechatsynccan obtain the path - Running
wechatsync --versiondoes not report an error - If it is not installed, tell the user to run
npm install -g @wechatsync/cliand come back
- Running
- Chrome extension is connected
- The user needs to install the Wechatsync Chrome extension and enable "Sync Bridge / MCP Connection"
- The extension will display a Token
- The user writes the Token into an environment variable:
export WECHATSYNC_TOKEN="xxx" - The port defaults to 9527; if it is occupied, use
SYNC_WS_PORTto override
- Target platforms are logged in
- The user needs to first log in to the web versions of the target platforms (Zhihu, Juejin, CSDN, etc.) in Chrome
- The extension uses the current browser's Cookies; if not logged in, it cannot publish
- Use
wechatsync platforms -ato check the login status of each platform
If any of the above is not satisfied, stop and report an error; do not try to bypass it.
Output Contract
This skill's standard output:
- Pre-check report (CLI version, whether Token is configured, target platform login status)
- dry-run preview (which platforms it will be published to, file paths, titles)
- Actual sync results after user confirmation (whether each platform succeeded, draft links or ids)
- A one-sentence summary telling the user which platform backends to go to next for review
Do not generate any intermediate files. Do not modify source files. Do not write to any location in the repository.
Workflow
Step 1: Receive input and self-check
First do these things:
- Read
CLAUDE.md/AGENTS.md, confirm the current repository process allows publishing - Confirm the file the user wants to publish actually exists
- Run
which wechatsync, confirm the CLI is available - Run
echo $WECHATSYNC_TOKEN | wc -c, confirm the Token is not empty
If any one fails, stop. Do not continue.
Step 1.5: Normalize image paths (preprocessing)
By default, markdown written by Obsidian URL-encodes image paths (spaces become %20, and Chinese characters are also encoded). The wechatsync CLI does not automatically decode, so publishing directly will cause all images to be skipped.
Before every publishmustrun preprocessing first:
python3 scripts/normalize_image_paths.py "<md 文件路径>" --dry-run
To see the preview:
- If
找不到: 0, run the version with--dry-runremoved once, fix in place - If
找不到is greater than 0, stop and first investigate where the image files actually are. Do not publish with broken images - If
已修复: 0, it means this article does not need preprocessing; go directly to the next step
What the script does:
- URL decode all markdown image links
- Resolve to the actual file (first by relative path, then by repository root)
- Rewrite as a relative path to the directory where the markdown file is located
- External links (http/https/data) are left unchanged
Preprocessing is fully compatible with Obsidian — Obsidian accepts both encoded and unencoded paths, so after the changes it still displays fine in Obsidian.
Step 2: List and confirm target platforms
If the user did not specify platforms, by default only publish to zhihu,juejin two technical platforms:
- Zhihu and Juejin have the lowest compliance threshold
- CSDN requires manual review, can be added
- WeChat Official Accounts require preparing a cover image and summary in advance, and need separate confirmation
- Xiaohongshu and Toutiao have stricter requirements for titles and covers, confirm separately
Recommended groups:
tech-min:zhihu,juejin— default, lowest compliance costtech-full:zhihu,juejin,csdn,segmentfault,oschina— full technical platform setwith-wechat: addwechaton top of the above, but at the same time pass--coverand confirm the titlesocial:xiaohongshu,weibo,toutiao— social-oriented, note that platforms are sensitive to style differences
Run wechatsync platforms -a once to bring up the current login status. Do not just assume.
Step 3: Run dry-run first
You must dry-run first. Running for real directly is not allowed.
wechatsync sync "path/to/your-article.md" -p zhihu,juejin --dry-run
Paste the complete dry-run output to the user and have the user confirm:
- Whether the resolved title is correct
- Whether the target platform list is correct
- The file path is not wrong
If the user says "wrong", stop. Do not fix it and then run directly. First ask clearly where the problem is.
Step 4: Run for real after user confirmation
After the user explicitly says "okay" or "publish", remove --dry-run and run the same command again:
wechatsync sync "path/to/your-article.md" -p zhihu,juejin
If you need to pass a cover or custom title:
wechatsync sync "path/to/your-article.md" \
-p zhihu,juejin,wechat \
-t "可能改过的标题" \
--cover "path/to/cover.png"
Step 5: Report results
After synchronization is complete, list one line of results per platform:
- ✓ Success: platform name + draft id or link
- ✗ Failure: platform name + error reason
The most common types of errors:
未登录: have the user log in to that platform's web version and retry超时:Chrome extension disconnected, restart the extension or reopen the browser图片上传失败:There are external image links in the body, some platforms cannot fetch them内容超长/过短:The platform has a character limit
Step 6: Closing prompt
Give the user a closing line:
- Tell the user where the draft box for each platform is for manual review
- Remind them this is a draft, and they need to preview in the platform backend → set a cover → manually click publish
- Do not click the "Publish" button on the user's behalf
Hard Constraints
- ProhibitedRunning non-dry-run without user confirmation
- ProhibitedSkipping the image path preprocessing in Step 1.5
- ProhibitedRewriting the body before publishing (that is another skill's job)
- Note: preprocessing only changes image paths, it does not count as rewriting the body
- ProhibitedAutomatically adding compliance redaction
- ProhibitedClicking "Publish" in the platform backend on the user's behalf
- ProhibitedSkipping
wechatsync platforms -aand assuming the platform is already logged in - ProhibitedSilently swallowing failure results, errors must be passed through completely
Reference Commands
# 安装
npm install -g @wechatsync/cli
# 版本检查
wechatsync --version
# 平台列表(带登录状态)
wechatsync platforms -a
# 查某个平台登录状态
wechatsync auth zhihu
# 预览(dry-run,不实跑)
wechatsync sync article.md -p zhihu,juejin --dry-run
# 实跑
wechatsync sync article.md -p zhihu,juejin
# 带标题和封面
wechatsync sync article.md -p zhihu,juejin,wechat -t "自定义标题" --cover ./cover.png
# 从当前浏览器页面反向抽取(不常用)
wechatsync extract -o out.md
Environment Variables
WECHATSYNC_TOKEN:Keep it consistent with the Token in the Chrome extension,requiredSYNC_WS_PORT:WebSocket port, default 9527, only change it when there is a port conflict
Troubleshooting
| Error | Cause | Solution |
|---|---|---|
已有实例正在运行但 Chrome Extension 未连接 |
The extension has not enabled sync bridging | Open the extension → enable MCP Connection → confirm the Token |
连接超时 |
The extension is down / Token mismatch | Restart the extension, re-export the Token, and re- export |
未登录 zhihu |
The current Chrome is not logged in | Go to zhihu.com and log in, then run wechatsync auth zhihu -r to refresh |
图片上传失败 |
External image links in the body cannot be fetched | Localize the images to assets/first, then rerun |
Workflow Position
- Upstream: a finished, revised, and confirmed publishable
.mdmaster draft (any writing tool) - This layer: only syncs, does not rewrite
- Downstream: the user manually clicks "Preview → Publish" in each platform backend
One-sentence positioning:This is the endpoint of the creation pipeline, not the polishing layer for the final draft。