WeWrite 是一个面向微信公众号(公众号)文章生产的全流程 AI 技能,覆盖从热点抓取到草稿箱发布的完整链路:热点抓取 → 选题 → 写作 → SEO → AI 配图 → 排版 → 草稿箱发布。它以 Claude Code 技能(通过 SKILL.md)形式运行,但每个组件也都可以独立使用。
一、用途 用于端到端地生产微信公众号文章,并可按不同客户(client)的风格配置进行定制化写作与发布。
二、主要能力
- 热点抓取:从微博、头条、百度抓取实时热点话题,支持限制数量与 JSON 输出。
- SEO 关键词分析:查询百度与 360 搜索建议并对关键词评分,支持命令行与 Python 调用。
- 选题:Claude 读取 references/topic-selection.md,生成 10 个候选选题,并按热度、契合度、差异化三个维度评分。
- 框架与写作:Claude 读取 references/frameworks.md(5 种框架)与 references/writing-guide.md(去 AI 化风格规则),按客户语气撰写文章。
- AI 配图:支持封面图(推荐 900×383)与正文内嵌图,提供方可选 doubao 或 openai。
- 排版:将 Markdown 转换为微信公众号所需的带内联样式 HTML,内置多套主题。
- 发布到草稿箱:上传封面并创建草稿,支持标题、作者、摘要等参数。
- 数据回填:抓取文章统计数据。
- 从人工修改中学习:对比原文与修改稿,提取风格规则并追加到客户 playbook。
三、使用方式 安装为 Claude Code 技能:
Clone the repo
git clone https://github.com/oaker-io/wewrite.git ~/.claude/skills/wewrite
Or copy into an existing project
cp -r wewrite ~/.claude/skills/wewrite
Python 依赖: cd wewrite pip install -r requirements.txt
配置: cp config.example.yaml config.yaml
编辑 config.yaml: wechat: appid: "${WECHAT_APPID}" # WeChat Official Account App ID secret: "${WECHAT_SECRET}" # WeChat Official Account Secret
image_gen: provider: "doubao" # "doubao" or "openai" doubao_api_key: "${DOUBAO_API_KEY}" openai_api_key: "${OPENAI_API_KEY}"
output_dir: "./output"
建议使用环境变量而非硬编码密钥: export WECHAT_APPID="wx1234567890abcdef" export WECHAT_SECRET="your_secret_here" export DOUBAO_API_KEY="your_doubao_key" export OPENAI_API_KEY="sk-..."
触发全流程(安装为 Claude Code 技能后): 用 demo 的配置写一篇公众号文章
也可指定客户: 用 clients/tech-blog 的风格,围绕今日热点写一篇公众号文章,发布到草稿箱
各步骤脚本示例:
-
抓取热点 python3 scripts/fetch_hotspots.py --limit 20 python3 scripts/fetch_hotspots.py --limit 10 --json # JSON output
-
SEO 关键词分析 python3 scripts/seo_keywords.py "AI大模型" "科技股" python3 scripts/seo_keywords.py --json "ChatGPT" "人工智能"
Python 用法: from scripts.seo_keywords import analyze_keywords
results = analyze_keywords(["AI大模型", "大语言模型", "GPT-5"]) for kw in results: print(f"{kw['keyword']}: score={kw['score']}, volume={kw['estimated_volume']}")
- AI 配图
Cover image (recommended 900×383)
python3 toolkit/image_gen.py
--prompt "科技感封面,蓝色光线,未来感"
--output output/cover.png
--size cover
Inline content image
python3 toolkit/image_gen.py
--prompt "程序员在办公室工作,现代风格插画"
--output output/img1.png
--provider openai
- 排版(Markdown → 微信 HTML)
Preview in browser
python3 toolkit/cli.py preview article.md --theme professional-clean
Available themes
python3 toolkit/cli.py themes
-
发布到草稿箱 python3 toolkit/cli.py publish article.md
--cover output/cover.png
--title "2026年AI大模型最新进展"
--author "科技观察" -
抓取文章数据 python3 scripts/fetch_stats.py --article-id "your_article_id"
-
从人工修改中学习 python3 scripts/learn_edits.py
--original output/draft.md
--edited output/final.md
--client demo
客户配置位于 clients/{name}/style.yaml,示例:
clients/my-tech-blog/style.yaml
name: "我的科技博客" industry: "科技/AI" topics:
- "人工智能"
- "大模型应用"
- "编程技术" tone: "专业严谨,偶尔幽默,面向中级开发者" theme: "tech-modern" avoid:
- "过度营销语言"
- "绝对化表述" wechat: appid: "${WECHAT_APPID}" secret: "${WECHAT_SECRET}"
新建客户: mkdir clients/my-client cp clients/demo/style.yaml clients/my-client/style.yaml
Edit style.yaml for your client
主题: professional-clean:简洁专业(默认) tech-modern:科技感蓝紫渐变 warm-editorial:温暖编辑风格 minimal:极简黑白
python3 toolkit/cli.py themes # list all themes with previews python3 toolkit/cli.py preview article.md --theme warm-editorial
自定义主题(YAML):
toolkit/themes/my-theme.yaml
name: my-theme body: font-family: "'PingFang SC', sans-serif" font-size: "16px" color: "#333" line-height: "1.8" h2: color: "#1a73e8" font-weight: "bold" border-left: "4px solid #1a73e8" padding-left: "10px" blockquote: background: "#f0f4ff" border-left: "3px solid #4285f4" padding: "12px 16px" color: "#555"
四、适用场景 适合需要批量、按客户风格生产微信公众号文章的场景,包括热点跟进型内容、科技/AI 类内容创作、需要 SEO 优化与统一排版的公众号运营,以及希望从历史文章与人工修改中沉淀写作风格规则的团队。
五、限制与注意事项
- 微信公众号 API 的 access token 每 2 小时过期,API 封装会自动刷新,但需确认 appid/secret 正确。
- 图像生成失败时可测试提供方连通性,若 doubao 失败可在 config.yaml 中切换为 openai。
- 热点抓取返回为空时,平台 API 可能发生变化,可用 --verbose 查看失败来源;脚本独立支持 weibo/baidu/toutiao。
- 文章未出现在草稿箱时,需确认微信账号已开通服务号或订阅号 API 权限、IP 已在微信公众平台设置中加白名单,且草稿箱需要 draft.add API 权限。
- 排版依赖主题正确加载,发布前可用 preview 预览渲染结果。
六、参考资料(Claude 在执行技能时自动读取) references/topic-selection.md:10 个选题评分规则(热度 × 契合度 × 差异化) references/frameworks.md:5 种文章结构模板 references/writing-guide.md:风格规则、去 AI 化技巧 references/seo-rules.md:微信 SEO:标题长度、关键词密度、标签 references/visual-prompts.md:图像生成提示词模板 references/wechat-constraints.md:微信 HTML/CSS 技术限制 references/style-template.md:客户 style.yaml 模式文档
七、快速参考
Full standalone workflow
python3 scripts/fetch_hotspots.py --limit 20 --json > hotspots.json python3 scripts/seo_keywords.py --json "关键词1" "关键词2" python3 toolkit/image_gen.py --prompt "封面描述" --output cover.png --size cover python3 toolkit/cli.py preview article.md --theme tech-modern python3 toolkit/cli.py publish article.md --cover cover.png --title "标题"
Build playbook from historical articles
python3 scripts/build_playbook.py --client demo
Learn from edits
python3 scripts/learn_edits.py --original draft.md --edited final.md --client demo
Fetch article performance data
python3 scripts/fetch_stats.py --article-id "msgid_here"