wxarticle_creator
SKILL.md
WX Article Creator
Use this skill when the user asks to draft or create a Weixin official account article (plain text or Markdown) and submit it as a draft.
Inputs
draft: User-provided draft text (plain or Markdown)title: Article titlethumb_media_id: Weixin thumbnail media id for draft (optional, see Workflow)thumb_image: Path to thumbnail image file (optional, used if thumb_media_id not provided)format: Optional enum (auto,markdown,plain)
Outputs
markdown: Final markdown sourcehtml: Rendered HTMLwxcli_result: Command output
Rules
- Do not invent wxcli commands; use README-documented format.
- Always ask for user confirmation before running
wxcli. - Render HTML using exactly:
npx markdown-to-html-cli --source <SOURCE.md> --style=./style.css - CSS must be loaded from
skills/wxarticle_creator/style.css. - Preserve meaning; no new facts. Keep length within +/-10% when polishing.
Workflow
-
Detect input format.
- If
format=auto, detect Markdown by headings (#), lists (-/1.), links, or code fences. - If Markdown is provided, keep it.
- If plain text, convert it to Markdown with clear hierarchy.
- If
-
Convert plain text to structured Markdown (if needed).
- Use the provided
titleas an H1. - Derive H2 sections from topic shifts or leading phrases.
- Use H3 for subtopics, and bullet/numbered lists for enumerations.
- Keep original ordering and meaning.
- Use the provided
-
Polish Markdown lightly.
- Fix typos and improve readability.
- Keep structure; do not add new facts.
-
Handle thumbnail (thumb_media_id):
- If
thumb_media_idis provided: Use it directly. - If
thumb_imageis provided (path to image file):- Upload the image:
wxcli material upload --type image --file "<thumb_image>" - Extract the returned
media_idfrom the output.
- Upload the image:
- If neither is provided:
- Get the latest image from materials:
wxcli material list --type image --offset 0 --count 1 --json - Extract the
media_idfrom the first item. - If no images exist, inform the user and proceed without thumb_media_id.
- Get the latest image from materials:
- If
-
Write Markdown source to a temporary file in a temp directory.
- Create a temp directory (e.g.,
/tmp/wxarticle_creator-<YYYYMMDD-HHMMSS>). - Save as
<TMP_DIR>/article-<YYYYMMDD-HHMMSS>.md(or another<SOURCE.md>). - Remove the temp directory after HTML is generated, unless the user requests it.
- Create a temp directory (e.g.,
-
Convert Markdown to HTML with the CLI.
- Copy
skills/wxarticle_creator/style.cssinto the temp directory asstyle.css. - Run the command from the temp directory so
./style.cssresolves. - Command:
npx markdown-to-html-cli --source <SOURCE.md> --style=./style.css - Capture stdout as HTML output.
- Ensure the content is wrapped in
<div id="nice">...</div>if it is not already, so the stylesheet applies.
- Copy
-
User confirmation.
- Show polished markdown and a rendered HTML snippet.
- If thumb_media_id was auto-fetched, mention which image is being used.
- Ask: "Proceed to create Weixin draft with wxcli?"
-
Submit via wxcli.
- Include
--thumb-media-id <thumb_media_id>only if available. - Direct content:
wxcli draft add --title "<title>" --content "<html>" --thumb-media-id <thumb_media_id> - From pipeline:
npx markdown-to-html-cli --source <SOURCE.md> --style=./style.css | wxcli draft add --title "<title>" --content - --thumb-media-id <thumb_media_id> - Return output to the user.
- Include
Failure Handling
- If thumbnail upload fails, show the error and ask to retry or proceed without thumbnail.
- If getting latest image fails, inform the user and proceed without thumb_media_id.
- If the CLI conversion fails, show the error and ask to retry.
- If
wxclifails, show the error output and ask whether to retry or adjust inputs.
Weekly Installs
6
Repository
inforix/wxcliFirst Seen
Feb 23, 2026
Installed on
openclaw6
gemini-cli6
claude-code6
github-copilot6
codex6
kimi-cli6