$npx -y skills add jhwreal/wechat-article-pipeline-skill --skill wechat-article-pipelineUse when a user wants a publish-ready Chinese WeChat/公众号 article package, editable article HTML workbench, article formatting, image-job planning, missing visual jobs, official WeChat draft-box delivery, synchronized 今日头条 draft/publishing through Chrome, or explicitly says "打开秘书模
| 1 | # WeChat Article Pipeline |
| 2 | |
| 3 | Produce a complete local article package from the user's topic, draft, notes, or markdown. Call delivery stages only when requested. |
| 4 | |
| 5 | ## Core Decisions |
| 6 | |
| 7 | - If the user asks to write, make, package, format, or polish a WeChat/公众号 article, proceed with this skill. |
| 8 | - If the user says "打开秘书模式", enable it for this request only and read its section in [style-guide.md](references/style-guide.md). Do not infer or mention it unless asked. |
| 9 | - If the user gives only a rough idea, infer the brief and write. Ask only when ambiguity would change the article conclusion, audience, legal risk, account selection, or delivery target. |
| 10 | - If the user asks for "不配图", "只排版", "直接格式化", or similar, use the no-image path. |
| 11 | - If the user asks to补图, continue, or fix missing assets, use the missing-image path and do not rebuild finished images. |
| 12 | - If the user asks to导入草稿箱, create a WeChat draft through official APIs only. Never use browser automation or private `mp.weixin.qq.com` endpoints for delivery. |
| 13 | - For explicitly requested Toutiao sync or publishing, use Chrome and read [publishing-toutiao.md](references/publishing-toutiao.md). This does not change the WeChat API-only rule. |
| 14 | |
| 15 | ## Workspace Contract |
| 16 | |
| 17 | Keep final artifacts in the current workspace unless the user names another location: |
| 18 | |
| 19 | - markdown: `<workspace>/files/<slug>.md` |
| 20 | - focused markdown: `<workspace>/files/<slug>.focused.md` |
| 21 | - image jobs: `<workspace>/files/<slug>.image-jobs.json` |
| 22 | - HTML workbench: `<workspace>/files/<slug>.html` |
| 23 | - job: `<workspace>/files/<slug>.job.json` |
| 24 | - optional publish manifest: `<workspace>/files/<slug>.publish-manifest.json` |
| 25 | - images: `<workspace>/image/<slug>/cover.png`, `body-*.png`, `closing.png` |
| 26 | |
| 27 | Keep final assets out of temp directories and `$CODEX_HOME/generated_images`. |
| 28 | |
| 29 | ## Default Article Path |
| 30 | |
| 31 | 1. Inspect `files/` and `image/` before choosing a slug. |
| 32 | 2. Draft in markdown first. Use [workflow.md](references/workflow.md) and [style-guide.md](references/style-guide.md). |
| 33 | 3. Place visual placeholders in the markdown only when images are desired: `cover`, `body-1`, `body-2`, ..., `closing`. |
| 34 | 4. Run the orchestration script once for planning: |
| 35 | |
| 36 | ```bash |
| 37 | python3 <skill>/scripts/postprocess_wechat_article.py \ |
| 38 | <workspace>/files/<slug>.md \ |
| 39 | <workspace>/files/<slug>.html \ |
| 40 | --workspace <workspace> \ |
| 41 | --article-slug <slug> \ |
| 42 | --jobs-out <workspace>/files/<slug>.image-jobs.json \ |
| 43 | --focused-article-out <workspace>/files/<slug>.focused.md \ |
| 44 | --support-dir <workspace>/files/wechat-article-pipeline/<slug> \ |
| 45 | --plan-only |
| 46 | ``` |
| 47 | |
| 48 | 5. Read [image-production.md](references/image-production.md), then generate `generation_queue[]` once. Use at most `min(queue length, currently available worker slots)` workers, refilling freed slots. Save each result to its `output`. Do not inspect generated images; continue to packaging and verification. |
| 49 | 6. Run the same script again without `--plan-only` to build the HTML, job JSON, crop previews, and support files. Add `--publish-manifest` only when the user requested API draft-box handoff. |
| 50 | 7. Run `verify_wechat_article_package.py <workspace>/files/<slug>.html` and fix any failures before delivery. |
| 51 | 8. After every verified HTML workbench build, start the local persistence server before delivery. This is the default for any task that produces an HTML workbench, even when the user did not explicitly ask to open it: |
| 52 | |
| 53 | ```bash |
| 54 | python3 <skill>/scripts/serve_wechat_workbench.py \ |
| 55 | <workspace>/files/<slug>.html \ |
| 56 | --workspace <workspace> |
| 57 | ``` |
| 58 | |
| 59 | Keep it running. Deliver `WORKBENCH_URL` first and `HTML_PATH` second. Direct-file mode is preview/copy-only; use the loopback URL for editing and lock editing if persistence disconnects. |
| 60 | |
| 61 | ## Fast Paths |
| 62 | |
| 63 | No-image formatting: |
| 64 | |
| 65 | ```bash |
| 66 | python3 <skill>/scripts/postprocess_wechat_article.py \ |
| 67 | <workspace>/files/<slug>.md \ |
| 68 | <workspace>/files/<slug>.html \ |
| 69 | --no-images \ |
| 70 | --support-dir <workspace>/files/wechat-article-pipeline/<slug> |
| 71 | ``` |
| 72 | |
| 73 | Use this when the user wants a formatted article without generated visuals. Existing `{{visual:*}}` image placeholders are removed from the packaged copy, so an illustrated source can safely use this path without manual cleanup. This path skips publish-manifest creation by default; add `--publish-manifest` only for API handoff. Draft creation may still need a cover asset; state that clearly. |
| 74 | |
| 75 | No body images, but draft-box delivery: |
| 76 | |
| 77 | ```bash |
| 78 | python3 <skill>/scripts/postprocess_wechat_article.py \ |
| 79 | <workspace>/files/<slug>.md \ |
| 80 | <workspace>/files/<slug>.html \ |
| 81 | --no-images \ |
| 82 | --publish-manifest \ |
| 83 | --cover-image <workspace>/image/<slug>/cover.png |
| 84 | ``` |
| 85 | |
| 86 | Use this w |