Configuration File
Always use the workspace wechat-article.config.json:
{
"appid": "",
"appsecret": "",
"author": "AI技术观察者",
"writing": {
"perspective": "第一人称",
"tone": "专业口语化",
"length": "3000-5000字",
"direction": "AI/技术/开发工具",
"keywords_style": "中短句为主,一行不超过50字"
},
"publish": {
"need_open_comment": 1,
"only_fans_can_comment": 0
},
"cover": {
"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": "确认发布"
}
}
First Use
If the configuration does not exist, ask all questions first and then write:
appid/appsecret- Default author
- Writing style (perspective, tone, length, direction)
- Comment toggle (default: comments open=1, followers only=0)
- Prefer to use the built-in preview image (
assets/cover-style-palette-preview-grid.jpg) to show styles × color schemes, and let the user choose the default style - Write the cover strategy (default
palette=auto,rotate=sequential,seed=title)
If the built-in preview image does not exist or needs updating, then run:
python3 scripts/create_cover_preview_grid.py
After sending the preview image to the user, you must useChinese + numberingto ask (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 scheme strategy (choose 1 of 2)
- B1 Automatic color rotation (palette=auto, recommended)
- B2 Fixed single color scheme (choose 1 more set from section C)
-
C. Color schemes (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 gray (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 of cover field.
Subsequent Use
When the configuration exists: the user only needs to provide a topic, and execute the process "creation → formatting → cover → preview confirmation → draft publishing".
Workflow (must be in order)
Copy and check off:
WeChat Article Progress:
- [ ] Step 0: 读取/初始化配置
- [ ] Step 1: 生成文章内容
- [ ] Step 2: 产出 HTML(内联样式)
- [ ] Step 3: 校验元数据(标题/摘要/作者)
- [ ] Step 4: 生成或解析封面图(style × palette)
- [ ] Step 5: 发送预览(文本 + 封面图)并等待确认
- [ ] Step 6: 发布前预检(凭证/依赖/文件)
- [ ] Step 7: 推送草稿
- [ ] Step 8: 返回结果与下一步
Step 0: Read/initialize configuration
- Read
wechat-article.config.json - If it does not exist, enter first-time configuration and write it
- If the configuration exists but lacks fields: only fill in the missing fields, do not overwrite the user's existing preferences
- If
cover.default_styleis missing:- Prefer to use
assets/cover-style-palette-preview-grid.jpgas the preview image - If that image does not exist, then run
python3 scripts/create_cover_preview_grid.pyto generate - Show the image to the user and let them choose the default style
- Write the selection back to
cover.default_style
- Prefer to use
Step 1: Generate article content
According to the writing.* in the configuration, produce the main text.
Constraints:
- Title suggestion ≤ 20 Chinese characters (spread-friendly)
- Main text suggestion ≤ 1000~2500 characters (according to user configuration)
- Structure priority: opening, 3-5 sections, closing action suggestions
Step 2: Produce HTML (inline styles)
Strictly follow references/article-style.md:
- Outer layer
<section> - Main text
<p>(16px, line-height 2) - Key points
<strong style="color:#1a73e8;"> - Between sections
<hr> - Do not output markdown, do not rely on external CSS
Step 3: Validate metadata
Before publishing, you must have:
title(cannot be empty)digest(recommended ≤ 120 characters)author(prefer configuring author)
Backfill order:
- Explicitly given by the user
- Configuration default value
- Auto-generated (title takes the main title, summary takes the compressed first paragraph)
Step 4: Generate or parse the cover image (style × palette)
Priority:
- cover path provided by the user
- Project directory
imgs/cover.png(if it exists) - Run
scripts/create_cover.pyto generatecover.jpg
Style:
minimal-gridcard-editorialdiagonal-motionsoft-gradient
Color scheme:
blue-techpurple-insightgreen-growthorange-energyrose-storyslate-proauto(according to therotatecolor selection strategy)
Generation command (default)
python3 scripts/create_cover.py \
--title "主标题" \
--subtitle "副标题" \
--style "minimal-grid" \
--palette "auto" \
--rotate "sequential" \
--seed "主标题" \
--output cover.jpg
Command parameter priority:
- Explicitly specified by the user this time
- Configuration
cover.* - Script default value
Step 5: Send a 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 copy must be in Chinese and include clear action prompts:
确认发布(continue)修改封面(redo cover only)修改正文(return to body editing)
Confirmation strategy (default):
preview.require_confirm_before_publish = 1, before receivingpreview.confirm_keyword(default确认发布), publishing must not be executed- If the user replies
修改封面, keep the body, re-execute Step 4, and preview again - If the user replies
修改正文, return to Step 1/2, adjust, and preview again
Step 6: Pre-publish precheck
Before publishing, you must check:
python3is availablecurlis available (the publishing script depends on it)Pillowis installed (if a cover needs to be generated)appid/appsecretis not emptyarticle.htmland the cover file exist
If anything is missing, fix it first; do not publish directly.
Step 7: Push the draft
Use:
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
Comment parameter priority:
- Explicitly requested by the user this time
- Configuration
publish.* - Default value (1 / 0)
Step 8: Return the result
Fixed return:
- Title, summary, author
- Cover file + style/color scheme used
- Comment toggle status
- Draft
media_id - Next step: go to the WeChat Official Account backend "Content Management → Draft Box" to preview and publish
Security and boundaries
- Only push to the draft box, do not send directly to everyone
- Credentials are stored only in local configuration, not written into skill files
- Any outbound action (automatic publishing/mass sending) must separately seek user confirmation