Weixin_Writer 是一个面向微信公众号文章生产的 Codex Skill,专注于 选题写作、风格排版、配图规划、微信安全 HTML 渲染、素材上传与草稿箱创建。
这个项目只服务一个清晰场景:把一篇内容做成适合微信公众号阅读、排版和发布后台使用的文章包。它不包含通用 UI、App 或工程流程参考。
- 从选题、提纲或初稿生成公众号文章。
- 根据内容类型选择合适的排版风格。
- 应用移动端优先的文章结构:短段落、清晰标题、摘要、引用、表格、FAQ 和 CTA。
- 规划封面图与正文配图。
- 将 Markdown 转换为微信可用的 inline-style HTML。
- 通过微信公众号接口上传正文图片和封面素材。
- 默认创建微信公众号草稿箱内容。
- 发布动作有明确保护,不会自动发布。
从 dev 分支安装:
python3 ~/.codex/skills/.system/skill-installer/scripts/install-skill-from-github.py \
--repo KevinKE93/Wexin_Writter \
--ref dev \
--path . \
--name Weixin_Writer安装后重启 Codex,让新的 Skill 生效。
说明:当前 GitHub 仓库名仍是
KevinKE93/Wexin_Writter,Skill 名称与本地安装目录统一为Weixin_Writer。
在 Codex 中按名称调用:
Use $Weixin_Writer to write a WeChat Official Account article about ...
典型输出包括:
- 3-8 个标题候选
- 推荐标题
- 120 个中文字符以内的摘要
- 选定排版风格与理由
- 文章 Markdown
- 封面图方案
- 正文配图方案
- 微信渲染注意事项
- 草稿创建前检查清单
项目内置微信公众号文章排版参考库:
article_layout
可选风格:
| 内容类型 | 排版风格 |
|---|---|
| 科普、方法论、专业解读 | 极简知识科普风 |
| 行业分析、人物报道、深度评论 | 商业媒体深度风 |
| 故事、观点、情感共鸣 | 情绪故事治愈风 |
| 教程、运营、职场、技能分享 | 教程干货效率风 |
| 活动推文、上新、宣传物料 | 品牌营销活动风 |
| 商业复盘、报告摘要、趋势洞察 | 财经专业报告风 |
Skill 会先读取共性排版原则,再根据用户请求、文章类型或账号默认定位选择一个具体风格文件。
发布辅助脚本只从命令参数或环境变量读取凭据:
export WECHAT_MP_APPID="your-appid"
export WECHAT_MP_SECRET="your-app-secret"
export WECHAT_MP_AUTHOR="optional-author-name"脚本不会把 AppID、AppSecret、access token 或接口返回 token 写入仓库文件。
如果微信公众号接口返回 40164,需要在这里加入当前出口 IP:
微信公众号后台 > 开发 > 基本配置 > IP 白名单
校验内置排版目录:
python3 scripts/layout_catalog.py validate列出可用风格:
python3 scripts/layout_catalog.py list-styles将 Markdown 渲染为微信可用 HTML:
python3 scripts/wechat_mp.py render \
--input article.md \
--output article.html无网络调用生成草稿 payload:
python3 scripts/wechat_mp.py create-draft \
--input article.md \
--title "标题" \
--digest "摘要" \
--thumb-media-id THUMB_MEDIA_ID \
--dry-run \
--output draft_payload.json创建真实微信公众号草稿:
python3 scripts/wechat_mp.py create-draft \
--input article.md \
--title "标题" \
--digest "摘要" \
--cover cover.png发布需要精确确认字符串:
python3 scripts/wechat_mp.py publish \
--media-id MEDIA_ID \
--confirm-publish "I understand this will publish to WeChat".
├── README.md
├── SKILL.md
├── agents/
│ └── openai.yaml
├── article_layout/
│ ├── README.md
│ ├── style_index.json
│ ├── images/
│ └── markdown规范/
├── references/
│ ├── article-workflow.md
│ ├── profile.md
│ └── wechat-api.md
└── scripts/
├── layout_catalog.py
└── wechat_mp.py
提交前建议运行:
python3 scripts/layout_catalog.py validate
python3 scripts/wechat_mp.py self-test
python3 -m py_compile \
scripts/wechat_mp.py \
scripts/layout_catalog.py临时安装验证:
python3 ~/.codex/skills/.system/skill-installer/scripts/install-skill-from-github.py \
--repo KevinKE93/Wexin_Writter \
--ref dev \
--path . \
--name Weixin_Writer \
--dest /private/tmp/weixin-writer-install-test- 默认目标是微信公众号草稿箱。
- “准备”“推送”“发送”“更新”等表达不会被理解为发布。
- 真实发布必须有同一轮对话里的明确确认。
- API 凭据和 token 不应提交、记录到日志、截图或写入最终回复。
- 涉及实时事实、市场、政策、产品或价格的信息,写作前应先核验。
Weixin_Writer is a Codex Skill for producing polished WeChat Official Account articles. It helps with drafting, rewriting, layout style routing, image planning, WeChat-safe HTML rendering, media upload, and draft creation.
The project is intentionally focused on one workflow: WeChat article writing and layout.
- Draft or rewrite WeChat Official Account articles from topics, outlines, or raw drafts.
- Select a layout style from a structured WeChat formatting catalog.
- Apply mobile-first article structure with concise paragraphs, clear headings, summaries, quotes, tables, FAQ, and CTA.
- Plan cover images and body images.
- Convert Markdown into WeChat-safe inline-styled HTML.
- Upload body images and cover materials through the WeChat Official Account API.
- Create WeChat MP drafts by default.
- Protect publishing behind an explicit confirmation step.
python3 ~/.codex/skills/.system/skill-installer/scripts/install-skill-from-github.py \
--repo KevinKE93/Wexin_Writter \
--ref dev \
--path . \
--name Weixin_WriterRestart Codex after installation.
Use $Weixin_Writer to write a WeChat Official Account article about ...
- Draft-box delivery is the default.
- Publishing is never inferred from casual wording.
- A real publish action requires fresh explicit confirmation.
- API credentials and tokens must never be committed, logged, screenshotted, or pasted into final answers.