Configuration File
Uniformly use workspace wechat-article.config.json:
{
"appid": "公众号 AppID",
"appsecret": "公众号 AppSecret",
"author": "默认作者名",
"account_name": "公众号名称",
"slogan": "公众号 Slogan",
"writing": {
"perspective": "第一人称",
"tone": "口语化",
"length": "1500-2500字",
"direction": "科技/AI/产品思考",
"keywords_style": "短句为主,一行不超过30字",
"article_style": "default",
"style_profile": "auto",
"reference_articles": []
},
"publish": {
"need_open_comment": 1,
"only_fans_can_comment": 0
},
"cover": {
"html_template": null,
"default_style": "minimal-grid",
"palette": "auto",
"rotate": "sequential",
"seed": "title",
"allowed_styles": ["minimal-grid", "card-editorial", "diagonal-motion", "soft-gradient"],
"allowed_palettes": ["blue-tech", "purple-insight", "green-growth", "orange-energy", "rose-story", "slate-pro"]
},
"preview": {
"send_cover_preview": 1,
"require_confirm_before_publish": 1,
"confirm_keyword": "确认发布"
},
"branding": {
"header_html": "",
"footer_html": ""
},
"article_reader": {
"method": "auto",
"methods_priority": ["camoufox", "jina_reader", "browser_snapshot"],
"camoufox": {
"enabled": true,
"path": "~/.agent-reach/tools/wechat-article-for-ai/main.py"
},
"jina_reader": {
"enabled": true
},
"browser_snapshot": {
"enabled": true
}
}
}
First Use
If the configuration does not exist, ask all questions first and then write:
appid/appsecretaccount_name/slogan(required)- Default author
- Writing style (perspective, tone, length, direction)
- Layout style (default
default, optionalgougestyle) - Comment switch (default: open comments=1, followers only=0)
- Cover strategy (HTML template or PIL solution)
- Writing Style DNA Initialization:
- Ask the user whether they have WeChat Official Account articles they like (3-5 articles is best)
- If yes, have the user provide links, and the system will automatically scrape and analyze them
- If no, use the default style and gradually learn during subsequent creation interactions
- Article reading capability detection:
- Detect whether Camoufox is available (
~/.agent-reach/tools/wechat-article-for-ai/main.py) - If unavailable, prompt installation or fall back to another solution
- Detect whether Camoufox is available (
If the built-in preview image does not exist or needs updating, then execute:
python3 scripts/create_cover_preview_grid.py
After sending the preview image to the user, you must useChinese + numberingAsk (do not expose English terminology to the user):
-
A. Default style (choose 1 of 4)
- A1 Minimal Grid (minimal-grid)
- A2 Editorial Card (card-editorial)
- A3 Diagonal Motion (diagonal-motion)
- A4 Soft Gradient (soft-gradient)
-
B. Color strategy (choose 1 of 2)
- B1 Automatic palette rotation (palette=auto, recommended)
- B2 Fixed single palette (choose 1 more set from section C)
-
C. Color scheme (choose 1 of 6, required only for B2)
- C1 Tech Blue (blue-tech)
- C2 Insight Purple (purple-insight)
- C3 Growth Green (green-growth)
- C4 Energy Orange (orange-energy)
- C5 Story Rose (rose-story)
- C6 Professional Slate (slate-pro)
-
D. Rotation method (choose 1 of 2, required only for B1)
- D1 Sequential rotation (sequential, recommended)
- D2 Random rotation (random)
User reply format:A2 B1 D1 or A1 B2 C3。
Then persist the selection result to wechat-article.config.json in the cover field.
Subsequent Use
When the configuration exists: the user only needs to provide a topic, and execute the process "creation → layout → cover → preview confirmation → draft publishing".
Writing Style DNA System
Core Concept
Each user's writing style comes from their own reference articles, not from a public template. This ensures that even if 100 people use the same skill, everyone's output is different.
DNA Files
- Template:
references/style-dna-template.md(blank template, copied on first use) - User DNA:
references/style-dna.md(system-generated + continuously updated) - Reference articles:
references/my-articles/(reference articles provided by the user)
DNA Initialization Process
用户提供 3-5 篇喜欢的公众号文章链接
↓
系统通过 article_reader 抓取文章内容
↓
保存到 references/my-articles/
↓
分析所有参考文章,提取风格特征:
- 句子平均长度
- 常用句式(反问?排比?短句连击?)
- 金句结构(比喻型?数字型?对比型?)
- 开头偏好(故事?数据?场景?)
- 结尾偏好(号召?金句?悬念?)
- 高频词汇和禁用词
- 段落结构和节奏
↓
生成 references/style-dna.md
↓
展示给用户确认/调整
Continuous DNA Evolution
In each creation interaction, the system automatically updates the DNA based on user feedback:
| User behavior | DNA update |
|---|---|
| "This opening is too flat" | Record: avoid flat, straightforward openings |
| "This punchy line is good" | Record: preferred this sentence pattern |
| User manually revised a certain paragraph | Compare before and after the revision, extract preference changes |
| User chose title B instead of A | Record title preference |
| "Don't use this expression" | Add to avoid_phrases |
| "I like this feeling" | Extract features and add to preferred |
Update rules (confirmation mode recommended):
- After each creation session, check whether there are new preference signals
- If there are,first show the user the suggested DNA update content, and write it in only after the user confirms
- By default, do not overwrite automatically, to prevent "DNA drift" (mistaking an incidental preference for a fixed style)
- Fields that the user has manually adjusted have the highest priority and will not be overwritten by automatic suggestions
Anti-templating detection
After generating an article, automatically check:
- ❌ Whether any expression from the
avoid_phraseslist in the DNA appears - ❌ Whether the repetition rate with the punchy lines in
recent_golden_phrasesis > 30% - ❌ Whether the same opening/ending structure as the last 3 articles is used
- ❌ Whether the paragraph structure is completely identical to the most recent article
If detected, automatically regenerate that part using a different expression.
WeChat Official Account article reading
Reading scheme (multi-layer fallback)
When the user provides a WeChat Official Account article link, read it in the following priority order:
1. Camoufox (first choice, most stable)
cd ~/.agent-reach/tools/wechat-article-for-ai && python3 main.py "https://mp.weixin.qq.com/s/xxx"
- Can bypass WeChat's anti-scraping mechanisms
- Outputs markdown format, including title, author, date, and body text
- Requires pre-installation
2. Jina Reader (alternative)
curl -s "https://r.jina.ai/https://mp.weixin.qq.com/s/xxx"
- Some articles may be blocked
3. Browser Snapshot (last resort)
- Use OpenClaw's browser tool to open the link
- Extract the page text content
4. Manual paste (final fallback)
- Prompt the user to manually copy the article content
Reading capability detection
Automatically detect on first use:
# 检测 Camoufox
python3 ~/.agent-reach/tools/wechat-article-for-ai/main.py --help 2>/dev/null
If unavailable, prompt the user:
- Install the agent-reach skill to get the best article reading capability
- Or degrade to using other schemes
Workflow (must be followed in order)
Copy and check off:
WeChat Article Progress:
- [ ] Step 0: 读取/初始化配置 + 加载风格DNA
- [ ] Step 1: 生成文章内容(基于风格DNA)
- [ ] Step 2: 产出 HTML(内联样式 + 页头页脚)
- [ ] Step 3: 校验元数据(标题/摘要/作者)
- [ ] Step 4: 生成封面图
- [ ] Step 4.5: 生成正文配图(可选)
- [ ] Step 5: 发送预览(文本 + 封面图)并等待确认
- [ ] Step 6: 发布前预检(凭证/依赖/文件)
- [ ] Step 7: 推送草稿
- [ ] Step 8: 返回结果 + 更新风格DNA
Step 0: Read/initialize configuration + load style DNA
- Read
wechat-article.config.json - If it does not exist, enter first-time configuration and write it
- If the configuration exists but is missing fields: only fill in the missing fields, do not overwrite the user's existing preferences
- Read
references/style-dna.md- If it does not exist and the user provided reference articles, first execute DNA initialization
- If it does not exist and there are no reference articles, use the
writing.*configuration as the base style
Step 1: Generate article content (based on style DNA)
1a. Choose the article structure
Do not default to "opening → 3-5 sections → ending". According to references/structures.md selection rules, choose the structural archetype by topic type:
- Money-making/monetization → timeline narrative
- Technology/tools → standard sections or listicle
- Opinions/insights → Q&A dialogue format
- Experience/retrospective → timeline narrative
- Recommendations/roundups → listicle
Anti-repetition rule: Check the most recent 2 structures of recent_articles in the DNA; if they are the same, force a switch.
1b. Load style DNA and personal material
If references/style-dna.md:
- Generate content strictly according to the style characteristics defined in the DNA
- Imitate the sentence patterns, rhythm, and expression habits recorded in the DNA
- Avoid the expressions listed in
avoid_phrasesandavoid_patternsin the DNA - Check
recent_golden_phrasesto ensure punchy lines are not reused - According to the topic type, refer to
主题风格映射in the DNA to adjust the language style
If references/story-bank.md:
- Prioritize selecting material related to the topic from the user's real experience library
- Replace AI-fabricated opinions with real opinions
- Use the user's catchphrases and language habits
- Refer to the user's emotional palette to adjust the article's emotional tone
If no DNA exists:
- Produce the body text according to
writing.*in the configuration
1c. Content safety awareness
During generation, proactively comply with the rules in references/content-safety.md :
- Identify whether the current topic is a high/medium risk topic
- High-risk topics are automatically switched to a safe writing approach ("information organization" mode, no subjective advice)
- When specific data is involved, distinguish between "hard facts" and "soft opinions":
- Hard facts (specific numbers, rankings, statistics): sources must be cited; if there is no source, change to vague wording
- Soft opinions (personal judgments, experience sharing): can be expressed directly, but qualified with "personal experience"
- Prohibited use of
content-safety.mdprohibited statements listed in
1d. Reduce template feel
- Paragraph length should vary: short paragraphs (1-2 sentences) and long paragraphs (5-8 sentences) should alternate
- Do not "deliver value" in every paragraph; leave appropriate blank space and transitions
- Set a "small hook" (rhetorical question, suspense, twist) every 400-600 characters to maintain reading momentum
- If there is a personal material library, insert real details in appropriate places to add a "human touch"
Constraints:
- Title suggestion ≤ 20 Chinese characters (spread-friendly)
- Body text suggestion ≤ 1000~2500 characters (according to user configuration)
Step 2: Produce HTML (inline styles + header and footer)
Strictly follow the typography specifications defined in references/styles/{article_style}.md .
- Outer
<section> - Body
<p> - Emphasis
<strong> - Between sections
<hr> - Do not output markdown, do not rely on external CSS
- If
branding.header_htmlorbranding.footer_htmlis configured, insert it into the corresponding position in the article content HTML.
Step 3: Validate metadata
Before publishing, there must be:
title(cannot be empty)digest(suggested ≤ 120 characters)author(prefer configuring author)
Backfill order:
- Explicitly given by the user
- Default configuration values
- Auto-generated (title from main title, summary from first paragraph compressed)
Step 4: Generate cover image
Core principle: Each article's cover must be designed based on the topic; the same visual style must not be reused.
Priority:
- User-provided
cover_path - Use the HTML template specified by
cover.html_templatecombined with Playwright screenshot (recommended)- Available templates:
akai-cover(A Kai cover template),gouge-cover(Gou Ge cover template)
- Available templates:
- Fall back to the PIL approach, using
cover.default_styleandcover.palette
HTML + Playwright screenshot approach (recommended)
According to cover.html_template configuration, render /templates/covers/{template_name}.html, and take a screenshot using Playwright.
- Parameters:
--html-template,--title,--subtitle,--account-name,--slogan,--tag
PIL fallback approach
If cover.html_templateis not specified, use scripts/create_cover.py for PIL image generation.
- Parameters:
--title,--subtitle,--style,--palette,--rotate,--seed
Command parameter priority:
- Explicitly specified by the user this time
- Configuration
cover.* - Script default values
Step 4.5: Generate body illustrations (optional)
Based on the article content, illustrations can be generated to enhance readability.
- Use the scripts in the
scripts/illustrations/directory to generate images (for example:generate_concept.py,generate_flow.py,generate_table.py)。 - Generated images must be uploaded via
publish_draft.py's--content-img KEY=PATHparameter. - In
article.html, use the<!-- IMAGE_KEY -->placeholder; the script will automatically replace it with the uploaded image URL.
Step 5: Send preview (text + cover image) and wait for confirmation
Before pushing the draft, you must first show the user a preview:
The preview content must include at least:
- Title
- Summary
- Author
- Cover image (the cover file generated this time)
- Body preview (first 2-3 paragraphs or first 200-300 characters)
Sending rules:
- If the current channel supports images, send "text + cover image"
- The preview text must be in Chinese and include clear action prompts:
确认发布(Continue)修改封面(Redo cover only)修改正文(Return to body editing)
Confirmation policy (default):
preview.require_confirm_before_publish = 1Whenpreview.confirm_keyword(default确认发布) is not received, publishing must not be executed- If the user replies
修改封面, keep the body and re-execute Step 4, then preview again - If the user replies
修改正文, return to Step 1/2, adjust, and preview again
Step 6: Pre-publish check
Before publishing, you must check:
python3availablePillowinstalled (if a cover or illustrations need to be generated)Playwrightand its browser driver installed (if using an HTML template cover)appid/appsecretnon-emptyarticle.htmland the cover file exist- Content safety validation(must be executed):
python3 scripts/validate_article.py --content-file article.html
Validation result handling:
risk_score = 0,can_publish = true→ go directly to Step 7needs_review = true(has warnings) → show the validation report to the user, mark the data to be verified and medium-risk content, and continue only after the user confirmscan_publish = false(has errors) → Block publishing, show the specific issue and require the user to re-validate after making changes
If items are missing, fix them first; do not publish directly.
Step 7: Push draft
Use scripts/publish_draft.py。
python3 scripts/publish_draft.py \
--title "文章标题" \
--author "作者名" \
--digest "摘要(120字内)" \
--content-file article.html \
--cover cover.jpg \
--appid <appid> \
--appsecret <appsecret> \
--need-open-comment 1 \
--only-fans-can-comment 0 \
--header-img <页眉图片路径> \
--content-img <KEY1=PATH1> --content-img <KEY2=PATH2>
Comment parameter priority:
- The user explicitly requested this time
- Configure
publish.* - Default value (1 / 0)
Step 8: Return results + update style DNA
Fixed return:
- Title, summary, author
- Cover file + style/color scheme used
- Comment toggle status
- Draft
media_id - List of uploaded body image URLs
- Next step: Go to the WeChat Official Account backend "Content Management → Draft Box" to preview and publish
DNA update (if style-dna.md exists):
- Add this article's title to
recent_articles - Add the opening/closing type used this time to the history
- Add the golden quote used this time to
recent_golden_phrases - If the user provides feedback during the creation process (modifications, selections, evaluations), update the corresponding preference fields
- Record this change in the update log
Security and boundaries
- Only push to the draft box, do not mass-send directly
- Credentials are stored only in local configuration, not written into skill files
- Any outbound action (automatic publishing/mass sending) must separately seek user confirmation
Project structure
wechat-article-skill/
├── SKILL.md
├── README.md
├── assets/
│ ├── NotoSansCJKsc-Bold.otf
│ └── cover-style-palette-preview-grid.jpg
├── references/
│ ├── article-style.md (排版风格索引)
│ ├── structures.md (文章结构原型库)
│ ├── content-safety.md (内容安全与合规指南)
│ ├── style-dna-template.md (风格DNA空白模板)
│ ├── story-bank-template.md (个人素材库模板)
│ ├── style-dna.md (用户风格DNA,系统生成)
│ ├── story-bank.md (用户个人素材库)
│ ├── my-articles/ (用户参考文章)
│ │ └── README.md
│ └── styles/
│ ├── default.md (默认排版风格)
│ └── gougestyle.md (狗哥排版风格)
├── templates/
│ └── covers/
│ ├── akai-cover.html (阿凯封面模板)
│ └── gouge-cover.html (狗哥封面模板)
└── scripts/
├── font_utils.py (跨平台字体工具)
├── create_cover.py (封面生成脚本)
├── create_cover_preview_grid.py
├── publish_draft.py (草稿发布脚本)
├── validate_article.py (发布前内容校验)
└── illustrations/
├── generate_concept.py (概念示意图生成)
├── generate_flow.py (流程图生成)
├── generate_header.py (页眉图片生成)
└── generate_table.py (数据表格图生成)