md2wechat
Use md2wechat when the user wants to:
- - convert Markdown into WeChat Official Account HTML
- inspect resolved article metadata, readiness, and publish risks before conversion
- generate a local preview artifact or upload drafts
- inspect live capabilities, providers, themes, and prompts
- generate covers, infographics, or other article images
- create image posts
- write in creator styles or remove AI writing traces
Intent Routing
Choose the command family before doing any publish action:
- - Use
convert / inspect / preview when the user wants a standard WeChat article draft (news), HTML conversion, article metadata, article preview, or a draft that needs --cover. - Use
create_image_post when the user says 小绿书, 图文笔记, 图片消息, newspic, 多图帖子, or asks to publish an image-first post rather than an article HTML draft. - Do not route
小绿书 / 图文笔记 requests to convert --draft just because the user also has a Markdown article. A Markdown file can still be the image source for create_image_post -m article.md. - Treat
convert --draft and create_image_post as different publish targets, not interchangeable command variants.
Defaults And Config
- - Use this skill only when
md2wechat is already available on PATH. - Draft upload and publish-related actions require
WECHAT_APPID and WECHAT_SECRET. - Image generation may require additional image-service configuration in
~/.config/md2wechat/config.yaml. - INLINECODE23 defaults to
api mode unless the user explicitly asks for --mode ai. - Check configuration in this order:
1.
~/.config/md2wechat/config.yaml
2. environment variables such as
MD2WECHAT_BASE_URL
3. project-local
md2wechat.yaml,
md2wechat.yml, or
md2wechat.json
- - If the user asks to switch API domain, update
api.md2wechat_base_url or MD2WECHAT_BASE_URL. - Treat live CLI discovery output as the source of truth. Do not guess provider names, theme names, or prompt names from repository files alone.
Discovery First
Run these before selecting a provider, theme, or prompt:
- - INLINECODE33
- INLINECODE34
- INLINECODE35
- INLINECODE36
- INLINECODE37
- INLINECODE38
- INLINECODE39
Inspect a specific resource before using it:
- - INLINECODE40
- INLINECODE41
- INLINECODE42
- INLINECODE43
- INLINECODE44
- INLINECODE45
- INLINECODE46
When choosing image presets, prefer the prompt metadata returned by prompts show --json, especially primary_use_case, compatible_use_cases, recommended_aspect_ratios, and default_aspect_ratio.
When choosing an image model, prefer providers show <name> --json and read supported_models before hard-coding --model.
Core Commands
Configuration:
- - INLINECODE55
- INLINECODE56
- INLINECODE57
Conversion:
- - INLINECODE58
- INLINECODE59
- INLINECODE60
- INLINECODE61
- INLINECODE62
- INLINECODE63
- INLINECODE64
Image handling:
- - INLINECODE65
- INLINECODE66
- INLINECODE67
- INLINECODE68
- INLINECODE69
- INLINECODE70
- INLINECODE71
- INLINECODE72
Drafts and image posts:
- - INLINECODE73
- INLINECODE74
- INLINECODE75
- INLINECODE76
- INLINECODE77
- INLINECODE78
- INLINECODE79
Writing and humanizing:
- - INLINECODE80
- INLINECODE81
- INLINECODE82
- INLINECODE83
- INLINECODE84
- INLINECODE85
- INLINECODE86
- INLINECODE87
- INLINECODE88
- INLINECODE89
Article Metadata Rules
For convert, metadata resolution is:
- - Title:
--title -> frontmatter.title -> first Markdown heading -> INLINECODE93 - Author:
--author -> INLINECODE95 - Digest:
--digest -> frontmatter.digest -> frontmatter.summary -> INLINECODE99
Limits enforced by the CLI:
- -
--title: max 32 characters - INLINECODE101 : max 16 characters
- INLINECODE102 : max 128 characters
Draft behavior:
- - If digest is still empty when creating a draft, the draft layer generates one from article HTML content with a 120-character fallback.
- Creating a draft requires either
--cover or --cover-media-id. - INLINECODE105 is a local image path contract for article drafts.
--cover-media-id is for an existing WeChat permanent cover asset. Do not assume a WeChat URL or mmbiz.qpic.cn URL can be reused as thumb_media_id. - INLINECODE109 is the source-of-truth command for resolved metadata, readiness, and checks.
- INLINECODE110 v1 writes a standalone local HTML preview file. It does not start a workbench, write back to Markdown, upload images, or create drafts.
- INLINECODE111 is still the convert-path preview flag; it is not the same thing as the standalone
preview command. - INLINECODE113 is degraded confirmation only; it must not be treated as final AI-generated layout.
- INLINECODE114 /
--author / --digest affect draft metadata, not necessarily visible body HTML. - Markdown images are only uploaded/replaced during
--upload or --draft, not during plain convert --preview.
Agent Rules
- - Start with discovery commands before committing to a provider, theme, or prompt.
- Route by publish target first: article draft =>
convert; image post / 小绿书 / newspic => create_image_post. - Prefer the confirm-first flow for article work:
inspect -> preview -> convert / --draft. - If the user says
小绿书, 图文笔记, 图片消息, newspic, or asks for a multi-image post, prefer create_image_post even when the source content lives in Markdown. - Prefer
generate_cover or generate_infographic over a raw generate_image "prompt" call when a bundled preset fits the task. - Validate config before any draft, publish, or image-post action.
- If draft creation returns
45004, check digest/summary/description before assuming the body content is too long. - If the user asks for AI conversion or style writing, be explicit that the CLI may return an AI request/prompt rather than final HTML or prose unless the workflow completes the external model step.
- Do not perform draft creation, publishing, or remote image generation unless the user asked for it.
Safety And Transparency
- - Reads local Markdown files and local images.
- May download remote images when asked.
- May call external image-generation services when configured.
- May upload HTML, images, drafts, and image posts to WeChat when the user explicitly requests those actions.
md2wechat
当用户希望执行以下操作时,使用 md2wechat:
- - 将 Markdown 转换为微信公众号 HTML
- 在转换前检查已解析的文章元数据、就绪状态和发布风险
- 生成本地预览产物或上传草稿
- 检查实时能力、提供商、主题和提示词
- 生成封面、信息图或其他文章图片
- 创建图文消息
- 以创作者风格写作或去除 AI 写作痕迹
意图路由
在执行任何发布操作前,先选择命令族:
- - 当用户需要标准微信文章草稿(news)、HTML 转换、文章元数据、文章预览或需要 --cover 的草稿时,使用 convert / inspect / preview。
- 当用户提到 小绿书、图文笔记、图片消息、newspic、多图帖子,或要求发布以图片为主的帖子而非文章 HTML 草稿时,使用 createimagepost。
- 不要仅仅因为用户也有 Markdown 文章,就将 小绿书 / 图文笔记 请求路由到 convert --draft。Markdown 文件仍然可以作为 createimagepost -m article.md 的图片来源。
- 将 convert --draft 和 createimagepost 视为不同的发布目标,而不是可互换的命令变体。
默认值与配置
- - 仅当 md2wechat 已存在于 PATH 中时,才使用此技能。
- 草稿上传和发布相关操作需要 WECHATAPPID 和 WECHATSECRET。
- 图片生成可能需要 ~/.config/md2wechat/config.yaml 中的额外图片服务配置。
- convert 默认使用 api 模式,除非用户明确要求 --mode ai。
- 按以下顺序检查配置:
1. ~/.config/md2wechat/config.yaml
2. 环境变量,如 MD2WECHAT
BASEURL
3. 项目本地文件 md2wechat.yaml、md2wechat.yml 或 md2wechat.json
- - 如果用户要求切换 API 域名,更新 api.md2wechatbaseurl 或 MD2WECHATBASEURL。
- 将实时 CLI 发现输出视为事实来源。不要仅凭仓库文件猜测提供商名称、主题名称或提示词名称。
先发现再使用
在选择提供商、主题或提示词之前,先运行以下命令:
- - md2wechat version --json
- md2wechat capabilities --json
- md2wechat providers list --json
- md2wechat themes list --json
- md2wechat prompts list --json
- md2wechat prompts list --kind image --json
- md2wechat prompts list --kind image --archetype cover --json
在使用特定资源前先检查:
- - md2wechat providers show openrouter --json
- md2wechat providers show volcengine --json
- md2wechat themes show autumn-warm --json
- md2wechat prompts show cover-default --kind image --json
- md2wechat prompts show cover-hero --kind image --archetype cover --tag hero --json
- md2wechat prompts show infographic-victorian-engraving-banner --kind image --archetype infographic --tag victorian --json
- md2wechat prompts render cover-default --kind image --var article_title=Example --json
选择图片预设时,优先使用 prompts show --json 返回的提示词元数据,特别是 primaryusecase、compatibleusecases、recommendedaspectratios 和 defaultaspectratio。
选择图片模型时,优先使用 providers show --json 并阅读 supported_models,然后再硬编码 --model。
核心命令
配置:
- - md2wechat config init
- md2wechat config show --format json
- md2wechat config validate
转换:
- - md2wechat inspect article.md
- md2wechat preview article.md
- md2wechat convert article.md --preview
- md2wechat convert article.md -o output.html
- md2wechat convert article.md --draft --cover cover.jpg
- md2wechat convert article.md --mode ai --theme autumn-warm --preview
- md2wechat convert article.md --title 新标题 --author 作者名 --digest 摘要
图片处理:
- - md2wechat uploadimage photo.jpg
- md2wechat downloadandupload https://example.com/image.jpg
- md2wechat generateimage 一只坐在窗台上的可爱猫咪
- md2wechat generateimage --preset cover-hero --article article.md --size 2560x1440
- md2wechat generatecover --article article.md
- md2wechat generateinfographic --article article.md --preset infographic-comparison
- md2wechat generateinfographic --article article.md --preset infographic-dark-ticket-cn --aspect 21:9
- md2wechat generate_infographic --article article.md --preset infographic-handdrawn-sketchnote
草稿与图文消息:
- - md2wechat createdraft draft.json
- md2wechat test-draft article.html cover.jpg
- md2wechat createimagepost --help
- md2wechat createimagepost -t 周末旅行 --images photo1.jpg,photo2.jpg
- md2wechat createimagepost -t 旅行日记 -m article.md
- echo 每日签到 | md2wechat createimagepost -t 每日 --images pic.jpg
- md2wechat createimage_post -t 测试 --images a.jpg,b.jpg --dry-run
写作与人性化:
- - md2wechat write --list
- md2wechat write --style dan-koe
- md2wechat write --style dan-koe --input-type fragment article.md
- md2wechat write --style dan-koe --cover-only
- md2wechat write --style dan-koe --cover
- md2wechat write --style dan-koe --humanize --humanize-intensity aggressive
- md2wechat humanize article.md
- md2wechat humanize article.md --intensity aggressive
- md2wechat humanize article.md --show-changes
- md2wechat humanize article.md -o output.md
文章元数据规则
对于 convert,元数据解析顺序为:
- - 标题:--title -> frontmatter.title -> 第一个 Markdown 标题 -> 未命名文章
- 作者:--author -> frontmatter.author
- 摘要:--digest -> frontmatter.digest -> frontmatter.summary -> frontmatter.description
CLI 强制限制:
- - --title:最多 32 个字符
- --author:最多 16 个字符
- --digest:最多 128 个字符
草稿行为:
- - 如果创建草稿时摘要仍为空,草稿层会根据文章 HTML 内容生成一个摘要,回退长度为 120 个字符。
- 创建草稿需要 --cover 或 --cover-media-id。
- --cover 是文章草稿的本地图片路径约定。--cover-media-id 用于已有的微信永久封面素材。不要假设微信 URL 或 mmbiz.qpic.cn URL 可以复用为 thumbmediaid。
- inspect 是获取已解析元数据、就绪状态和检查结果的事实来源命令。
- preview v1 会写入一个独立的本地 HTML 预览文件。它不会启动工作台、写回 Markdown、上传图片或创建草稿。
- convert --preview 仍然是转换路径的预览标志;它不等同于独立的 preview 命令。
- preview --mode ai 仅为降级确认;不得将其视为最终的 AI 生成布局。
- --title / --author / --digest 影响草稿元数据,不一定会影响可见的正文 HTML。
- Markdown 图片仅在 --upload 或 --draft 期间上传/替换,不会在普通的 convert --preview 期间进行。
代理规则
- - 在确定提供商、主题或提示词之前,先执行发现命令。
- 首先按发布目标路由:文章草稿 => convert;图片帖子 / 小绿书 / newspic => createimagepost。
- 对于文章