SkillAtlasSkill 详情

md2wechat

面向 AI Agent 的微信公众号创作与发布 CLI

审核状态:已审核Quality 72Security 70

复制安装命令

用 Codex 或 Claude 安装复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它先审查 Skill 页面再帮你安装。

复制前请先查看来源、License 和安全提示。

项目 README

来源文件:README.md

抓取于 2026年8月4日

md2wechat logo md2wechat

md2wechat CLI demo

面向 AI Agent 的微信公众号创作与发布 CLI

写 Markdown,生成公众号排版,制作封面和文章配图,预览校验后推送草稿箱。

支持 Claude Code、Codex、WorkBuddy、Kimi Work、Hermes Agent、OpenClaw 等 Agent 通过 JSON discovery 稳定调用。

Go Version License GitHub Release Agent Ready API

geekjourneyx%2Fmd2wechat-skill | Trendshift geekjourneyx%2Fmd2wechat-skill | Trendshift

快速开始 · 专业 API · Agent 工作流 · 高级排版 · 文档


这个项目解决什么问题

md2wechat 把公众号发布流程拆成一组可验证的 CLI 命令:

场景md2wechat 提供
Markdown 转微信 HTMLconvert,支持预览、上传图片、创建草稿
发布前检查inspect --json 输出标题、摘要、图片、cover、draft readiness
稳定排版API 模式成功时返回最终 HTML,覆盖 68 个主推高级排版场景条目和 53 个主推 ::: 语法名
Agent 自动化capabilities、doctor、themes、layout、providers 等 discovery 命令
内容生产write、humanize、title suggest、generate_cover、generate_infographic
多账号发布命名公众号账号,本地只读发现,不输出 Secret
微信白名单高级 API 服务可提供微信接口固定出口能力

快速开始

npm install -g @geekjourneyx/md2wechat
md2wechat version --json
md2wechat config init --json
md2wechat config validate --json

API 模式预览和转换需要 md2wechat API Key;完成详细凭证配置后,先检查文章,再把 HTML 明确写入本地文件:

md2wechat inspect article.md --json
md2wechat preview article.md --output preview.html
md2wechat convert article.md --output article.html

以上命令不会上传图片或创建草稿。需要创建微信草稿时,先按同一目标检查,再显式执行副作用:

md2wechat inspect article.md --draft --cover cover.jpg --json
md2wechat convert article.md --draft --cover cover.jpg

如果使用可选的 --wechat-account,必须在 inspect 和 convert 两条命令中传入同一个账号名。

安装方式、微信凭证和 IP 白名单配置见:


专业 API

API 模式适合需要稳定输出、多人协作、批量发布或 Agent 自动化的场景。

能力免费 AI 模式专业 API 模式
输出方式生成 prompt,由外部 LLM 继续处理直接返回微信 HTML
主题3 个基础主题48 个专业主题
高级排版模块不解析,:::module 作为普通段落输出API renderer 解析 53 个推荐 :::module 语法
转换结果需要外部 LLM 完成 HTMLconverter 成功时返回最终 HTML
发布自动化适合实验适合团队、客户号、矩阵号

专业能力包括:

申请 API 服务:关注公众号「极客杰尼」,备注「API咨询」。

公众号:极客杰尼


Agent 工作流

md2wechat 给 Agent 提供可机读接口,减少猜测和误操作。

md2wechat capabilities --json
md2wechat doctor --json
md2wechat inspect article.md --json
md2wechat themes list --json
md2wechat layout list --json
md2wechat title suggest article.md --json
md2wechat title suggest article.md --json --hook-level 2
md2wechat skills list --json
md2wechat skills read md2wechat --json

按任务选择 discovery:用 capabilities 获取聚合路由事实,用资源的 list 做选择,用 show 查看单个资源的完整定义,仅在该资源支持时使用 render。JSON stdout 是单行紧凑对象并以换行结束;人类阅读时可在命令后加 | jq,不要要求 CLI 改成缩进输出。

文章命令边界固定为:inspect 返回结构化 metadata、checks、readiness targets 和 blockers;preview 只把成功的 API converter 最终 HTML 原样写入文件;convert 执行转换,并且只在用户明确请求时执行 upload/draft 副作用。AI preview 返回 PREVIEW_ACTION_REQUIRED 且不创建输出文件,需要 readiness 时使用 inspect --json。

这些命令适合 Claude Code、Codex、WorkBuddy、Kimi Work、Hermes Agent、OpenClaw 以及其他能调用本地 CLI 的 Agent 使用。

Agent 可以据此判断:

  • 当前 CLI 支持哪些命令
  • API、草稿、上传是否具备执行条件
  • 某篇文章能不能发草稿
  • 当前主题和排版模块是否可用
  • 标题建议是否应交给宿主 Agent / 外部模型完成
  • 当前二进制内置的 Agent SOP 是什么

Brand Profile 支持把长期风格偏好写入 ~/.config/md2wechat/brand.md,由 Agent 在写作和排版时读取。详见 docs/BRAND-PROFILE.md。


图片生成

md2wechat 支持两条图片路径。

先从当前二进制发现可用 preset,再调用图片 provider:

md2wechat prompts list --kind image --archetype cover --json
md2wechat prompts list --kind image --archetype infographic --json

md2wechat generate_cover --article article.md
md2wechat generate_cover --article article.md --preset cover-semantic-concept
md2wechat generate_infographic --article article.md --preset infographic-claude-warm

完整 preset 清单、用途和默认画幅以 prompts list/show --json 为准,文档只保留代表性示例。

支持 Volcengine、ModelScope、OpenRouter、OpenAI、Gemini 等服务。配置见 docs/IMAGE_PROVISIONERS.md。

使用宿主 Agent 的 Image Gen:

md2wechat generate_cover --article article.md --plan --json
md2wechat generate_infographic --article article.md --plan --json

计划模式返回 IMAGE_PLAN_READY,不请求图片 provider,不要求 IMAGE_API_KEY,也不会上传到微信。仅当当前宿主运行时实际暴露 Image Gen 工具时,Agent 才能继续执行图片生成。详见 docs/AGENT_IMAGE_GEN.md。


高级排版

API 模式支持 :::module 语法,用 Markdown 写结构化公众号排版。

:::hero
eyebrow: 深度观察
title: AI 时代的公众号写作
subtitle: 为什么读者愿意继续读下去
:::

:::callout
高级排版模块只在 API 模式渲染。
:::

查看和验证模块:

md2wechat layout list --json
md2wechat layout show hero --json
md2wechat layout validate --file article.md --json

本地 layout validate 只验证语法,不能证明远端 renderer 已部署;需要通过 API preview 或 convert 验证实际渲染。

default 主题效果 bytedance 主题效果 elegant-gold 主题效果

完整教程见 docs/LAYOUT.md。

这里的计数不是同一维度:68 是上游使用场景条目,一个语法名可以覆盖多个结构变体;53 是 layout list --json 默认返回的推荐语法名。兼容模块默认不混入推荐列表。


常用命令

命令用途
inspect返回结构化 metadata、checks、readiness targets 和 blockers
advise为已有文章推荐可选的最小增强动作
preview只写入成功 API 转换的最终 HTML;失败或 AI handoff 不新建或覆盖
convert转换 Markdown,并按显式请求执行 upload/draft 副作用
write从想法生成文章
humanize重写 AI 文章,支持 authentic 强度
title suggest生成公众号标题建议的 AI 请求
generate_cover生成封面图或图片计划
generate_infographic生成信息图或图片计划
upload_image上传图片到微信素材库
create_image_post创建微信图片消息(小绿书/newspic)
config wechat-accounts查看本地多公众号账号配置
doctor本地配置体检

文档

文档内容
QUICKSTART新手主路径
USAGE命令完整说明
DISCOVERYAgent discovery 契约
WORKBUDDYWorkBuddy 安装、检查、预览与草稿确认流程
ADVISE已有文章的可选增强建议
LAYOUT高级排版模块教程与 discovery 用法
HUMANIZEAI 去痕与 authentic 写作
AGENT_IMAGE_GEN宿主 Agent Image Gen 工作流
CONFIG配置字段和环境变量
FAQ常见问题
TROUBLESHOOTING故障排查

许可与商业使用

本项目采用 Source Available License。个人使用、学习、评估、非营利使用免费。商业使用、SaaS、客户交付、白标、再分发和训练数据用途需要商业授权。

商业授权和 API 服务:关注公众号「极客杰尼」备注「API咨询」,或联系 skrphper@gmail.com。


其他

中风险

  • 来源需自行核对维护者身份。
  • 包含脚本或命令调用,安装前请复核。
  • 可能需要外部 token、网络权限或第三方服务。
  • 未检测到高风险命令。
  • 扫描发现:1 条。

Codex — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/geekjourneyx/md2wechat-skill.git
  3. 将 "skills/md2wechat" 文件夹复制到 Codex 的 skills 目录中。
  4. 重启 Codex 让新的 skill 生效。

Codex — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Codex 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Codex 让新的 skill 生效。

Claude Code — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/geekjourneyx/md2wechat-skill.git
  3. 将 "skills/md2wechat" 文件夹复制到 Claude Code 的 skills 目录中。
  4. 重启 Claude Code 让新的 skill 生效。

Claude Code — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Claude Code 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Claude Code 让新的 skill 生效。

Cursor — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/geekjourneyx/md2wechat-skill.git
  3. 将 "skills/md2wechat" 文件夹复制到 Cursor 的 skills 目录中。
  4. 重启 Cursor 让新的 skill 生效。

Cursor — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Cursor 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Cursor 让新的 skill 生效。

GitHub Copilot — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/geekjourneyx/md2wechat-skill.git
  3. 将 "skills/md2wechat" 文件夹复制到 GitHub Copilot 的 skills 目录中。
  4. 重启 GitHub Copilot 让新的 skill 生效。

GitHub Copilot — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 GitHub Copilot 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 GitHub Copilot 让新的 skill 生效。

Windsurf — Git Clone 安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 克隆仓库:git clone https://github.com/geekjourneyx/md2wechat-skill.git
  3. 将 "skills/md2wechat" 文件夹复制到 Windsurf 的 skills 目录中。
  4. 重启 Windsurf 让新的 skill 生效。

Windsurf — 手动复制安装

  1. 安装前请先查看来源仓库和风险报告。
  2. 从源仓库下载 SKILL.md 及相关文件。
  3. 在 Windsurf 的 skills 目录中创建新文件夹。
  4. 将所有 skill 文件复制到新文件夹中。
  5. 重启 Windsurf 让新的 skill 生效。
查看 SKILL.md 原文
name: md2wechat
description: Convert Markdown to WeChat Official Account HTML. Use this whenever the user wants WeChat article formatting, article preview, WeChat draft upload, image generation for articles, cover or infographic generation, image-post creation, writer-style drafting, title suggestions, AI trace removal, or current discovery of supported providers, themes, prompts, and layout modules.

md2wechat

Use this skill to operate the md2wechat CLI. Keep the skill focused on execution decisions. For full command tutorials, installation details, and FAQ-level explanations, refer users to the project docs instead of expanding this runtime protocol.

Intent Routing

Choose the command family before taking any publish or generation action:

  • Standard article HTML, article preview, metadata inspection, or WeChat article draft: use inspect, preview, and convert.
  • Image-first post, image note, image-text note, newspic, or multi-image post: use create_image_post, not convert --draft.
  • Article cover or article infographic: prefer generate_cover or generate_infographic over raw generate_image when a bundled preset fits.
  • Host-agent image generation request with no provider configured: use image plan mode (--plan --json) to get prompt intent, then hand it to the host image-generation tool if one is available outside md2wechat.
  • WeChat title candidates for an existing article: use title suggest <article.md> --json; it emits a host-Agent AI request and does not choose or write the final title.
  • Existing article or draft, user asks what to improve next: run md2wechat advise <article.md> --json; treat it as recommendation-only and keep inspect --json data.readiness.targets/blockers as the publish gate.
  • Writing in a creator style or removing AI traces: use write or humanize.
  • Provider, theme, prompt, or layout uncertainty: run discovery first. Do not guess from memory or repository files.

Treat convert --draft and create_image_post as different publish targets, not interchangeable variants.

Discovery First

Use CLI discovery as the source of truth, but keep it scoped to the next decision. Do not run the full catalog for tasks that do not need provider, theme, prompt, or layout selection.

Use capabilities for aggregate routing facts, resource list for lightweight selection fields, show for one full resource definition, and render for materialized prompt/layout output. JSON stdout is compact; use jq only when a human needs formatted output.

Run the smallest useful discovery set:

  • Article formatting with no theme or modules chosen:

    md2wechat themes list --json
    md2wechat layout list --json
    
  • A named theme, provider, prompt, or layout module:

    md2wechat themes show <name> --json
    md2wechat providers show <name> --json
    md2wechat prompts show <name> --kind <kind> --json
    md2wechat layout show <name> --json
    
  • Image generation or image-preset selection:

    md2wechat providers list --json
    md2wechat prompts list --kind image --json
    
  • Title suggestion prompt selection:

    md2wechat prompts list --kind title --json
    md2wechat prompts show wechat-title-expert --kind title --json
    
  • Draft, upload, API local-readiness, or configuration troubleshooting:

    md2wechat doctor --json
    md2wechat config show --format json
    md2wechat config wechat-accounts --json
    

    doctor readiness is local configuration attemptability. config wechat-accounts is local-only and never prints WeChat secrets. Use inspect --json for article-specific target readiness.

  • Unknown CLI version, changed behavior, or capability uncertainty:

    md2wechat version --json
    md2wechat capabilities --json
    md2wechat skills list --json
    md2wechat skills read md2wechat --json
    

md2wechat skills read md2wechat --json reads the SOP embedded in the current CLI binary. Prefer it when the installed external skill, README, or repository checkout may be stale relative to the executable on PATH.

For simple local actions such as preview, humanize, or a user-specified command with explicit flags, do not run unrelated provider, theme, prompt, or layout discovery.

Inspect specific resources only when the task needs them:

md2wechat providers show <name> --json
md2wechat themes show <name> --json
md2wechat prompts show <name> --kind <kind> --json
md2wechat layout show <name> --json

Use CLI output as the source of truth for currently available modes, providers, themes, prompts, and layout modules.

Configuration Boundaries

  • Assume md2wechat is already available on PATH.
  • convert defaults to API mode unless the user explicitly asks for --mode ai.
  • API-mode preview and conversion require a valid MD2WECHAT_API_KEY.
  • WeChat upload, article draft creation, and create_image_post require WeChat credentials whenever the user explicitly requests those side effects.
  • Read-only discovery, inspect, preview, and plain conversion are free of any global WeChat publishing credential requirement; API-mode preview and conversion still require a valid MD2WECHAT_API_KEY.
  • Named WeChat account execution requires a valid MD2WECHAT_API_KEY; the CLI validates it before upload, draft, or create_image_post effects.
  • Direct image generation requires image-provider credentials; image plan mode (--plan --json) only emits prompt intent for a host Agent or external tool and does not require image-provider credentials.
  • title suggest --json only emits a title-generation prompt request for the host Agent or external model. It does not call a model, upload, create drafts, or write back to Markdown.
  • For stronger factual title hooks, pass --hook-level 2 or 3; do not treat generated titles as confirmed publishing intent.
  • doctor --json is local-only: it checks local readiness and does not perform live authentication, upload images, or create drafts.
  • Use config show --format json when the user asks what configuration is currently effective.
  • Use config wechat-accounts --json when the user asks which local WeChat accounts are configured.

Article Workflow

Prefer a confirm-first workflow for article work:

  1. md2wechat inspect <article.md> --json
  2. md2wechat preview <article.md>
  3. md2wechat convert <article.md> ...
  4. Add --upload, --draft, --cover, or --cover-media-id only when the user explicitly asks for upload or draft creation.

inspect is the source-of-truth command for structured metadata, checks, readiness targets, and blockers. In --json output, read data.readiness.targets and data.readiness.blockers before deciding whether convert, upload, or draft is blocked. If the requested target is blocked, stop and report the matching blockers; do not continue by guessing from legacy booleans or checks alone. Do not invent data.agent_readiness, data.target_readiness, ArticleState, state files, or a second readiness/state object. preview writes only byte-identical final API HTML from a successful converter result; with --json, inspect diagnostics are returned in data.inspect and are never wrapped into that file. It does not upload images, create drafts, or write back to Markdown. convert performs conversion and only the explicitly requested upload/draft effects. convert --preview is the convert-path preview flag and is not the same as the standalone preview command. On PREVIEW_ACTION_REQUIRED or PREVIEW_FAILED, this invocation does not create or overwrite preview HTML. With --json, PREVIEW_ACTION_REQUIRED returns an empty data.output_file. Any pre-existing explicit output path is stale and must not be treated as this invocation's result; use the returned prompt for host-Agent work or report the failure. When the intended execution path is convert --mode ai --custom-prompt ..., run inspect with the same --mode ai --custom-prompt ... before trusting readiness.

Formatting Protocol

When the user asks to format an article and has not chosen a theme or modules:

  1. Read the article and optional Brand Profile.
  2. Use discovery output as facts.
  3. Choose a compatible theme and a small set of modules from the article's content goal.
  4. Keep the source Markdown read-only.
  5. Create a temporary formatted Markdown artifact, for example /tmp/md2wechat-format/<run-id>/article.formatted.md.
  6. Insert only layout modules whose required fields can be filled correctly.
  7. Run md2wechat layout validate --file <formatted.md> --json.
  8. Pass the formatted Markdown artifact to convert.

Saving generated Markdown next to the source file requires explicit user confirmation and must not overwrite the source.

Theme Selection

  • Read type and selectable from themes list --json.
  • API mode can use only type: api and selectable: true themes.
  • AI mode can use only type: ai and selectable: true themes.
  • Do not use collection descriptors such as non-selectable theme groups as concrete themes.
  • If Brand Profile names a theme, verify it through CLI discovery before using it.
  • If a requested theme is invalid or mode-incompatible, stop that path and choose a valid theme or ask the user.

Layout Modules

Advanced layout modules render only in API mode. AI mode (--mode ai) does not parse :::module syntax, so advanced layout cards will not render there.

Use this decision frame:

  • attention: help readers decide whether the article is worth reading.
  • readability: make mobile reading easier.
  • memorability: make one judgment, quote, metric, or brand anchor stick.
  • conversion: help readers save, follow, inquire, share, or buy.

Use CLI discovery as the source of truth for layout syntax instead of memorizing or guessing body_format values:

  • Inspect the opener, body schema, canonical executable example, and structurally distinct variants with layout show <name> --json. Reuse the canonical witness.
  • Use layout render for structured fields and --body-file (or --body-file - for stdin) for complex bodies, then validate the generated Markdown.
  • Default discovery returns recommended modules. Use layout list --lifecycle compatibility --json only for old-content migration. Local validation proves syntax acceptance only; production support is a release-conformance fact.

Default module discipline:

  • Do not pile on modules.
  • Use at most one hero, one verdict, and one cta unless the user explicitly asks for more.
  • Skip modules when the article does not provide enough content to fill them honestly.

API And AI Mode

  • API mode is the default and is required for advanced layout modules.
  • AI mode is a lighter path and does not render advanced layout modules.
  • Do not silently switch from API mode to AI mode after an API failure. That changes the output capability.
  • Use AI mode only when the user asks for it or accepts losing advanced layout rendering.
  • If an AI-mode conversion completes, it is acceptable to briefly mention that API mode supports advanced layout modules and stronger visual structure.

Brand Profile

Brand Profile lives at ~/.config/md2wechat/brand.md.

  • It is free-form Markdown, not YAML and not a fixed schema.
  • The CLI does not parse it.
  • Read it as context for voice, theme preferences, module preferences, CTA preferences, and forbidden expressions.
  • Treat quantity preferences as soft constraints.
  • Verify any named theme or module through CLI discovery.
  • If Brand Profile does not exist, do not block the task. You may mention once that system defaults will be used.
  • Create or edit Brand Profile only when the user explicitly asks.

Publishing Side Effects

Do not create drafts, upload images, publish, or call remote image generation unless the user asks for that action.

Before every explicit WeChat side effect—image upload, article draft creation, or create_image_post—require configured WeChat credentials and use the target-matched readiness/preflight path. Discovery and inspection remain non-publishing paths; preview and plain conversion are free of any global WeChat publishing credential requirement, while API mode still requires a valid MD2WECHAT_API_KEY.

Before draft creation:

  • Use inspect --json and check data.readiness.targets.draft; when blocked, read matching data.readiness.blockers.
  • Draft creation requires a cover via --cover or --cover-media-id.
  • Do not assume a WeChat URL or mmbiz.qpic.cn URL can be reused as thumb_media_id.
  • If draft creation returns 45004, check digest, summary, and description before assuming the body is too long.

Markdown images are uploaded or replaced only during --upload or --draft, not during plain conversion or preview.

Failure Handling

  • Missing or invalid config: run doctor --json and config show --format json; report data.overall plus the blocking data.readiness.* item.
  • Invalid layout syntax: run layout validate, inspect the failing module with layout show, fix the generated artifact, then validate again.
  • Unknown layout modules warn for forward compatibility; verify typos against layout list --json.
  • Theme rejection: check type and selectable, then choose a compatible theme or ask the user.
  • AI request or style-writing flows may return a prompt/request rather than final prose or HTML unless the external model step is completed.

发现问题?提交给管理员复核

评分:

评论 (0)

暂无评论,成为第一个评论者吧!