{"skill":{"slug":"research-to-wechat","displayName":"Research To Wechat","summary":"A native research-first pipeline that turns a topic, notes, article, URL, or transcript into a sourced article with an evidence ledger, polished Markdown, in...","description":"---\nname: \"research-to-wechat\"\ndescription: \"A native research-first pipeline that turns a topic, notes, article, URL, or transcript into a sourced article with an evidence ledger, polished Markdown, inline visuals, cover image, WeChat-ready HTML, browser/API-ready draft assets, and optional multi-platform distribution. Use when the user wants 深度研究、改写成公众号、写作、排版、配图、HTML 转换、公众号草稿生成、多平台分发.\"\nlicense: \"MIT\"\nmetadata: {\"openclaw\":{\"emoji\":\"🔬\",\"homepage\":\"https://github.com/Fei2-Labs/skill-genie\",\"requires\":{\"anyBins\":[\"python3\"]},\"primaryEnv\":\"WECHAT_APPID\"},\"version\":\"0.5.6\",\"category\":\"content-generation\",\"author\":\"Skill Genie\",\"license\":\"MIT\",\"tags\":[\"wechat\",\"research\",\"content-generation\",\"publishing\"],\"hermes\":{\"tags\":[\"wechat\",\"research\",\"content-generation\",\"publishing\"]}}\n---\n\n# Research to WeChat\n<!-- // TODO: split SKILL.md into smaller modules/components -->\n\nUse this skill as a native, research-first article system. It does not route execution to external skills.\n\n## Core Rules\n\n- Match the user's language.\n- Ask one question at a time.\n- Ask only when the answer changes source interpretation, structure frame, style fidelity, or draft delivery behavior.\n- Keep Markdown as the canonical article asset until the HTML handoff.\n- Save a draft only. Never publish live.\n- Separate verified fact, working inference, and open question.\n- Every major claim must be traceable to a source.\n- Every article must end with a \"## 参考链接\" or \"## References\" section listing all sources.\n- Apply the full normalization checklist before HTML rendering.\n- Every inline image must pass a two-tier evaluation: eliminate defects first, then verify content match.\n- the renderer converts `[text](url)` into `text (url)` because WeChat forbids clickable links.\n- Never pretend the workflow did interviews, long field research, team debate, or hands-on testing when it did not.\n- Prefer visible disclosure of AI assistance and source scope.\n- Treat source capture as a runtime boundary: preserve title, author, description, body text, and image list before rewriting.\n\n## Operating Paths\n\n- `Path A: research-first article`\n  use for: topic, keyword, question, notes, transcript, subtitle file\n  goal: build the article from a research brief and evidence ledger\n\n- `Path B: source-to-WeChat edition`\n  use for: article text, markdown file, article URL, WeChat URL\n  goal: preserve the useful source core, then rebuild it for WeChat reading and distribution\n\nDefault routing:\n- procedural or tool-teaching material -> `tutorial`\n- thesis, trend, strategy, critique, case material -> `deep-analysis`\n- multi-topic roundup -> `newsletter`\n\n## Accepted Inputs\n\n- keyword, topic phrase, or question\n- notes, outline, or raw material dump\n- article text\n- markdown file\n- PDF paper, report, or whitepaper\n- article URL\n- WeChat article URL\n- video URL\n- full transcript\n- subtitle file that can be expanded into a full transcript\n\nPDF policy:\n- extract all figures, charts, tables, and diagrams as image assets\n- save extracted figures to `imgs/source-fig-*.png`\n- record captions and page numbers in `source.md`\n- prefer source figures over generated visuals when they support the claim\n\nVideo policy:\n- a video source is valid only when the workflow can obtain the full spoken transcript\n- first attempt transcript recovery from the page, captions, or subtitle assets\n- if no full transcript is obtainable, ask for the transcript or subtitle file and wait\n\n## Output\n\nCreate one workspace per article:\n`research-to-wechat/YYYY-MM-DD-<slug>/`\n\nRequired assets:\n- `source.md`\n- `brief.md`\n- `research.md`\n- `article.md`\n- `article-formatted.md`\n- `article.html`\n- `manifest.json`\n- `imgs/cover.png`\n- inline illustration files referenced by the markdown body\n\nRequired frontmatter in final markdown:\n- `title`\n- `author`\n- `description`\n- `digest`\n- `coverImage`\n- `styleMode`\n- `sourceType`\n- `structureFrame`\n- `disclosure`\n\n`manifest.json` must capture:\n- `pathMode`\n- `styleMode`\n- `structureFrame`\n- `sourceType`\n- `confidence`\n- `draftStatus`\n- output paths\n\n`manifest.json.outputs.wechat` must include:\n- `markdown`\n- `html`\n- `cover_image`\n- `title`\n- `author`\n- `digest`\n- `images`\n\n## Script Directory\n\nDetermine this SKILL.md directory as `SKILL_DIR`, then use `${SKILL_DIR}/scripts/<name>`.\n\n| Script | Purpose |\n|--------|---------|\n| `scripts/fetch_wechat_article.py` | WeChat article fetch (mobile UA) |\n| `scripts/wechat_delivery.py` | Native WeChat delivery entrypoint (`check`, `design-catalog`, `render`, `upload-images`, `save-draft`) |\n| `scripts/install-openclaw.sh` | OpenClaw skill installer |\n\n## Native Capability Contract\n\nThis skill executes every stage itself:\n- source ingest via bundled fetch script, browser tools, and PDF inspection\n- markdown polish via normalization rules in this skill\n- inline visual planning and cover direction via native article analysis\n- design catalog compile via `python3 \"${SKILL_DIR}/scripts/wechat_delivery.py\" design-catalog`\n- WeChat HTML rendering via `python3 \"${SKILL_DIR}/scripts/wechat_delivery.py\" render`\n- image upload via `python3 \"${SKILL_DIR}/scripts/wechat_delivery.py\" upload-images`\n- draft save via `python3 \"${SKILL_DIR}/scripts/wechat_delivery.py\" save-draft`\n- multi-platform distribution via native browser/API steps when Phase 8 is requested\n\nUse the internal contract in [capability-map.md](references/capability-map.md).\n\n## Delivery Ladder\n\nResolve WeChat draft delivery in this order:\n1. `L0 official-http`: `WECHAT_APPID` and `WECHAT_SECRET` are ready, so bundled scripts call the official media and draft APIs directly\n2. `L1 assisted-browser`: only use a browser when the account setup or draft inspection needs human help\n3. `L2 manual-handoff`: stop with exact file paths and required API fields when official delivery cannot proceed\n\n\n## Author Config (EXTEND.md)\n\nThe renderer reads an optional `EXTEND.md` for author-specific CTA content and preferences. This keeps the skill generic — CTA text, QR codes, and blog URLs belong to the author, not the skill.\n\nLookup order: project dir → `~/.config/research-to-wechat/` → `~/.research-to-wechat/`\n\nSee [author-config.md](references/author-config.md) for the full format and field reference.\n\nWhen `EXTEND.md` is present with a `cta` section, the renderer appends a styled CTA block after the article body. When absent, no CTA is rendered.\n\n## Style Resolution\n\nResolve style in this order:\n1. explicit user instruction\n2. preset mode\n3. author mode\n4. custom brief\n\nUse the full style system in [style-engine.md](references/style-engine.md).\n\nVisual rendering is decided by:\n- `styleMode`\n- `structureFrame`\n- `light` or `dark` output mode\n\n## Execution\n\nRun the article through these phases:\n1. intake and route selection\n2. source packet, brief, and strategic clarification\n3. research architecture with structured question lattice\n4. research merge and evidence ledger\n5. frame-routed master draft with normalization checklist, writing self-check, and **machine-verified Chinese de-AI scan** (Phase 5 must not proceed without running these):\n   ```bash\n   # negation-contrast patterns (must be 0 hits)\n   grep -n '不是.*而是\\|不仅.*而且\\|不只.*更\\|不再.*而是\\|已经不是' article-formatted.md\n   # em-dash count (≤5 in body)\n   grep -c '——' article-formatted.md\n   # exclamation marks (must be 0)\n   grep -c '！' article-formatted.md\n   ```\n6. **微信敏感词合规检查**（⛔ 必须通过才能继续）：用 `wechat-compliance-check` 扫描 `article-formatted.md`，有命中则改写后重新扫描，直到零违规。\n7. refinement, visual strategy, and image evaluation\n\n   **⛔ Pre-delivery compliance gate (BLOCKING — must execute before Phase 8):**\n   Long sessions cause attention decay on early-loaded rules. Before proceeding to HTML rendering and draft save, you MUST:\n   1. **Re-read the project's AGENTS file** (`cat` the file, do not rely on memory). For WeChat projects this is `../AGENTS-wechat.md` or the path specified in `AGENTS.md`.\n   2. **Walk every rule in the AGENTS file line by line** and verify the current article/HTML against it. Check file location, typography, HTML constraints, CTA, image rules — every single one.\n   3. Output a checklist to the terminal with ✅/❌ per rule. Any ❌ must be fixed before continuing.\n   This step exists because context-window attention decay will cause you to forget rules loaded at session start. Do not skip it. Do not check from memory.\n\n8. native WeChat HTML rendering via `wechat_delivery.py render`, image upload, draft save, and manifest.\n\n   **Image upload rules:**\n   - If `imgs/cdn-urls.json` already exists from a previous upload, **skip re-uploading unchanged images**. Only upload new or modified files (compare filename + file size/mtime).\n   - `wechatqr.png` (CTA QR code) must reuse the existing CDN URL from project-level `images/wechatqr.png` or a previous `cdn-urls.json`. Never re-upload the same QR code per article.\n   - After upload, always merge new CDN URLs into the existing `cdn-urls.json` (not overwrite).\n\n   **Draft save rules:**\n   - If `manifest.json` already contains a `media_id`, pass `--media-id` to `save-draft` to **update the existing draft**. Never create a duplicate.\n   - If a duplicate draft was accidentally created, delete it via API (`draft/delete`) immediately and keep only the original `media_id`.\n   - `manifest.json` is the single source of truth for `media_id`.\n\n   **Before draft save, run HTML compliance check** (must all pass):\n   ```bash\n   grep -c 'class=' article.html          # must be 0\n   grep -c '<style' article.html          # must be 0\n   grep -c '<a href' article.html         # must be 0\n   # outermost <section> must have background\n   python3 -c \"import re;h=open('article.html').read();m=re.search(r'<section[^>]*>',h);print('OK' if m and 'background' in m.group() else 'FAIL')\"\n   ```\n\n   **Known issue: `render` collapses newlines inside `<code>` blocks.**\n   The renderer converts markdown fenced code blocks into single-line `<code>` content, stripping all `\\n` characters. Multi-line code will display as one long line.\n   Detection: `python3 -c \"import re;h=open('article.html').read();codes=[c for c in re.findall(r'<code>(.*?)</code>',h,re.DOTALL) if len(c)>80 and '<br' not in c];print(f'{len(codes)} collapsed code blocks' if codes else 'OK')\"` \n   Fix: extract code blocks from the source markdown (which preserves newlines), HTML-escape them, replace `\\n` with `<br/>`, and substitute back into the rendered HTML. **WeChat ignores literal `\\n` in HTML — only `<br/>` produces visible line breaks.** When HTML-escaping code content, only escape `&`, `<`, `>`, and `\"`. **Do NOT escape single quotes** (`'` → `&#x27;`) — WeChat renders the entity literally as `&#x27;` instead of `'`. This must run after `render` and before `save-draft`.\n\n   **Known issue: `render` outputs `<thead>` without dark background.**\n   In dark mode, table headers render with browser-default white/transparent background, making header text invisible. Fix: add `background:#1E293B` (or the design's surface color) to `<tr>` and `<th>` inside `<thead>`. Also ensure `<td>` has explicit `background` matching the page background.\n\n   **Known issue: `render` duplicates ordered list numbering.**\n   Markdown `1. 2. 3.` becomes `<ol><li>1. text</li>` — the `<ol>` auto-numbers AND the literal `1.` prefix remains. Fix: strip the leading `N. ` from each `<li>` content.\n\n   **Known issue: `render` keeps the H1/H2 title in the HTML body.**\n   WeChat article titles are set via the draft API `title` field, not in the HTML body. The renderer copies the markdown `# title` into an `<h2>`. Per WeChat typography rules, this must be removed. Fix: delete the `<section>` containing the `<h2>` that matches the draft title.\n\n   **Known issue: `--upload-map` may not replace all image paths.**\n   After rendering with `--upload-map`, verify that zero `src=\"imgs/\"` local paths remain. If any survive, do a string replace pass in post-processing. Detection: `grep -c 'src=\"imgs/' article.html` must be 0.\n\n   **Known issue: reference link section has oversized letter-spacing on mobile.**\n   The body `line-height:1.9` and `font-size:15px` cause long URLs in the reference section to spread out on mobile. Fix: override the reference section `<p>` tags with `font-size:13px;line-height:1.6;word-break:break-all;text-align:left`.\n\n   **File path rule: always follow the project's AGENTS file for output directory.**\n   This skill defaults to `research-to-wechat/YYYY-MM-DD-<slug>/`. If the project AGENTS specifies a different convention (e.g. `YYYY-MM-DD-<slug>/` at project root), the project rule overrides this skill's default. Check the project AGENTS before creating the workspace directory.\n\n9. optional multi-platform content generation and distribution\n\nPhase 9 only executes when the user explicitly requests it.\n\nUse the execution contract in [execution-contract.md](references/execution-contract.md).\nUse the platform copy specs in [platform-copy.md](references/platform-copy.md) for Phase 8.\n\n## Done Condition\n\nThe skill is complete only when all of these hold:\n- the article reads as researched before it reads as polished\n- the route choice and structure frame fit the source instead of forcing one house style\n- the chosen style is visible without collapsing into imitation\n- the writing framework self-check for the chosen frame has been applied\n- the evidence ledger clearly separates fact from interpretation\n- every visual adds narrative or explanatory value\n- the normalization checklist has been applied: no citation artifacts, no LaTeX, no broken tables, no scraped UI remnants\n- every image placeholder was evaluated against placement criteria before generation\n- every generated or selected image passed the two-tier quality check\n- markdown and HTML agree on title, summary, cover, and image paths\n- HTML contains zero `class=` attributes, zero `<style>` tags, zero `<a href>` links, and outermost `<section>` has explicit `background`\n- `manifest.json` agrees with the actual output set and draft state\n- the article does not overclaim research effort or authorship\n- `wechat-compliance-check` returned zero violations on the final markdown\n- the workflow can stop safely at the highest-quality completed artifact if a later handoff fails\n- if Phase 8 was triggered, platform copies follow [platform-copy.md](references/platform-copy.md) and manifest includes their output entries\n","topics":["WeChat","Browser"],"tags":{"content-generation":"0.5.6","latest":"0.5.6","publishing":"0.5.6","research":"0.5.6","wechat":"0.5.6","article-generation":"0.4.2","content-pipeline":"0.4.2","markdown":"0.4.1","pdf":"0.4.2"},"stats":{"comments":0,"downloads":974,"installsAllTime":36,"installsCurrent":3,"stars":2,"versions":12},"createdAt":1772499635861,"updatedAt":1781011318454},"latestVersion":{"version":"0.5.6","createdAt":1781011318454,"changelog":"Add OpenCode, Kiro, Devin, Codex, Cursor, and Windsurf skill compatibility","license":"MIT-0"},"metadata":{"setup":[],"os":null,"systems":null},"owner":{"handle":"clarezoe","userId":"s178sk484g47vwcbvvfcjpftfx8461fz","displayName":"clarezoe","image":"https://avatars.githubusercontent.com/u/460084?v=4"},"moderation":{"isSuspicious":false,"isMalwareBlocked":false,"verdict":"clean","reasonCodes":["review.llm_review"],"summary":"Review: review.llm_review","engineVersion":"v2.4.24","updatedAt":1781013163644}}