Communitygithub.com

AidenXu-1/wechat-layout-publisher

公众号排版发布 Skill:四路语义配图、2.35:1 封面、可复制 HTML 与草稿箱发布

wechat-layout-publisher 是什么?

wechat-layout-publisher is a Claude Code agent skill that 公众号排版发布 Skill:四路语义配图、2.35:1 封面、可复制 HTML 与草稿箱发布.

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add AidenXu-1/wechat-layout-publisher

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

WeChat Official Account Publishing

Convert readable materials or articles into a master template for WeChat Official Account articles, then modify, save drafts, and archive from the same master. After finalizing, only the last replicable HTML from this skill and the final Markdown draft written directly by this skill are retained.

Entry Boundaries

Supports direct conversation entry and chaining from any upstream skill. The following conditions must be met before entry:

  1. destination is confirmed as wechat_official_account.
  2. The current task has entered the stage of finalizing, image placement, layout, replicable version, or draft box creation for the WeChat Official Account.
  3. The source material or article can be read.

When the user just needs the body text, a first draft, platform not yet decided, or a different platform, continue the original workflow. When chaining from a skill, read references/upstream-handoff.md; do not show the internal handoff template to the user, nor let the upstream guess the choice for the user.

Initial Confirmation

Before starting production, only confirm the content processing mode:

Before starting, please confirm the content processing mode:

A. Messy materials: Organize and produce finalized copy for the WeChat Official Account, then place images and layout
B. Draft copy: Review and optimize content details to produce finalized copy, then place images and layout
C. Publish final copy: Keep the copy unchanged, only perform image placement, layout, and format standardization

Do not ask again if the user request or traceable handoff has already clarified the content mode. Before determining the content mode, do not rewrite, plan images, generate images, create previews, or call WeChat APIs. Do not ask the user to decide on draft box or archiving before the first officially replicable version is complete.

Write the choice as-is into image-plan.json:

  • Content A: input_stage: messy_materials, content_mode: rewrite.
  • Content B: input_stage: draft_copy, content_mode: rewrite.
  • Content C: input_stage: final_copy, content_mode: preserve.
  • Before the first delivery, permanently record interaction_contract_version: 3, review_choice: pending, delivery_mode: copy_ready, draft_authorization: none, archive_authorization: none, approved_body_sha256: "" and body_image_upload_authorization: copy_ready_request.
  • Also record content_choice, choice_source: direct_user | upstream_user_confirmation, destination: wechat_official_account and entry_mode: direct | skill_handoff; for chaining entry, additionally record handoff_version: 1 and source_skill.
  • From the creation of the first file or directory, maintain artifact_ownership.skill_created_files, skill_created_directories and protected_external_files. The first two lists only include files and directories actually created by this skill during this session; the latter includes user files, upstream documents, and external assets. The lists must not overlap.

Default Delivery Loop

After the first officially replicable version is complete and passes the quality gate, provide the HTML and proactively ask:

The current replicable version is complete. Would you like to approve it and add it to the WeChat draft box? If you need modifications, please let me know directly.
  • User requests modifications: Follow references/publishing.md to fully revert to the modification state and clear old approvals; after modification and re-validation, re-deliver the complete HTML.
  • User confirms adding to draft box: Write the body hash from the latest visual QA receipt into approved_body_sha256, update to review_choice: draft, delivery_mode: draft and grant post_preview_confirmation authorization. The draft entry must verify that the current body exactly matches this hash; if there are any changes to the body, stop and reconfirm.
  • Draft success: Return media_id, remind that "entering the draft box does not mean public publication", record archive_authorization: post_draft_success, then automatically write the same final HTML to the official target location provided by the calling project according to references/archive.md; do not ask about finalizing again.

Only skip the draft API if the user explicitly says "I only want a manually copied version"; if the user explicitly requests "directly add to draft box", you may skip the user preview cycle but still complete all internal quality checks. Do not proactively show these internal routes or state names to the user.

Five Hard Contracts

  1. Content Boundaries
    • messy_materials: Save traceable source materials; separate facts, opinions, experiences, data, repetitions, conflicts, and items to be verified, then write them into an article following the reader's logical understanding.
    • draft_copy: Use the draft as the master; protect facts, positions, evidence boundaries, and authentic voice; revise in the order of structure and dynamics, evidence connections, paragraph flow, and word accuracy.
    • final_copy: Only change HTML structure and visual rhythm. Characters, punctuation, and order of the body text must not change; if headings are missing, first ask the user to supplement or obtain separate authorization for addition. Use subtitles as needed for the article; if the user explicitly does not need one, record subtitle_policy: omitted_by_user, do not force an addition to pass validation.
  2. Editorial and Image Plan
    • Create image-plan.json before searching, generating, or drawing. New or redo rewrite tasks must use editorial_contract_version: 1 and a verifiable editorial_plan; draft_copy additionally includes voice_fingerprint and revision_priorities.
    • Old article packages can only take the compatibility path with explicit use of the --allow-legacy-editorial validator switch; new tasks must not use this switch.
  3. Authentic Visual Sources
    • Each visual uses only one route among user_asset, evidence_screenshot, generated_image, coded_visual. Evidence must come from authentic sources; coded visuals only explain structure.
    • The first image after title and subtitle must be generated by a real generation tool, with the accurate H1 naturally integrated into a 2.35:1 composition, and the final file at least 900x383. Pure images, user images, screenshots, coded visuals, or script-stamped text cannot replace it.
    • When the current agent cannot generate images, inform the user and stop at a local work preview; retain the full prompt; do not formally deliver before the first image is returned.
  4. Single Body Master
    • Use ARTICLE HTML START and ARTICLE HTML END markers for the body, containing only WeChat-safe inline HTML. Preview buttons, status bars, and scripts can only be outside the markers.
    • Use unique data-wlp-visual-id for visuals in the body according to the plan sequence; uniformly count all strong visuals into density. Between adjacent strong visuals, there must be body text that carries new information.
  5. Authorization and Security
    • copy_ready can prepare body images but never create drafts. The normal route only records the body hash and updates draft authorization after the user confirms the current HTML; the draft-direct route only accepts the user's explicit current instruction.
    • draft/add can only be called when delivery_mode: draft, draft authorization, and the body hash contract are simultaneously valid. The ARTICLE HTML body sent by the normal route must be byte-identical to the latest user-confirmed version. Credentials are only read from environment variables, local .env, or this skill's standard system credential location; do not search old chats, random files, shell history, or unrelated keychains.
    • IP whitelist is based on the invalid ip from WeChat API error 40164. General public IP detection is for reference only; when a proxy, TUN, or traffic diversion is present, do not guide the user with detection results that differ from the actual WeChat test.
    • Finalization only deletes files registered one by one in artifact_ownership.skill_created_files and removes directories in skill_created_directories that have become empty; wildcards, directory scanning, and recursive whole-directory deletion are prohibited. User files, user directories, upstream documents, external assets, and paths of unknown origin are never moved, overwritten, or deleted.
    • Do not create folders named WeChat or wechat. Use ordinary subdirectories within the current article's working directory for temporary assets; after finalization, delete only registered files belonging to this skill.

On-Demand Reading

Load only when entering the corresponding stage to avoid cluttering the context with infrequent publishing details:

StageRead
Skill chainingreferences/upstream-handoff.md
Content planningreferences/content-planning.md; for rewrite also read references/editorial-writing.md
Image planningreferences/image-placement.md, starting from assets/image-plan.template.json
Visual productionreferences/visual-quality.md, references/cover-system.md
HTML layoutreferences/style-guide.md, references/components.md
Final checksreferences/qa-checklist.md
Upload body images or draftreferences/publishing.md
Draft success or user explicitly finalizes manual copyreferences/archive.md

final_copy does not load rewriting rules. When only local preview is needed, do not load publishing credentials or draft API details.

Execution Sequence

  1. Collect and Verify: Confirm source article, title, optional subtitle, author or column name, and all user images and videos. First inventory user provided assets; extract timestamped frames from relevant videos. When relying on time sensitive facts, verify against primary sources online.
  2. Complete Content Planning: Record content type, confidence, basis, core thesis, reader promise, and chapter map. For rewrite, complete editorial planning and finalize copy; for entry_mode: direct with rewrite, also write the skill's own WeChat Official Account Final Copy.md, register it, and retain it upon finalization. For preserve and skill_handoff, do not create a separate Markdown by default; register the original copy only as a protected external file.
  3. Complete Image Plan: Fill in interaction contract, editorial contract, asset decisions, first section visual anchor, and each visual's source, location, semantics, status, and traceable information. Run the planning stage validation first.
  4. Produce Visuals: Prioritize user provided assets and authentic evidence; generation images handle metaphor or atmosphere; coded visuals handle process, relationships, timelines, comparisons, data, or mechanisms. Continue only after generating the first image and performing a manual check.
  5. Produce HTML and Local Preview: Use consistent components, mobile rhythm, and inline styles. Local paths are used for internal preview only; cannot be claimed as directly copyable to WeChat.
  6. Complete Pre-Delivery Gate: Sequentially verify the final image plan, body safety, copy quality, and unified layout; internal local previews serve production only, not for user review, and do not prevent generation of the official replicable version due to screenshot tool limitations.
  7. Deliver and Confirm: Upload or reuse body images via the formal preparations mode in publish.ts; the first handover to the user is the complete replicable HTML. After user review, iterate modifications based on feedback; when explicit confirmation is given, generate a visual receipt binding the current body and image plan hash, lock the body hash, and create a draft according to references/publishing.md; after success, write to the official target location provided by the project according to references/archive.md and perform safe cleanup.

Run validation commands from the scripts/ directory:

npm run verify-image-plan -- --stage plan --article <source-article> <image-plan.json>
npm run verify-image-plan -- --stage final --article <source-article> --check-files <image-plan.json>
npm run verify-article -- --complete-package --content-mode <rewrite|preserve> --source-article <source-article> <article.html>
npm run verify-copy -- <article.html>
npm run verify-layout -- --article <article.html> --image-plan <image-plan.json>

Copy warnings for rewrite must be fixed; for preserve, only report. Formal delivery must also complete image source checks, mobile screenshots, verify-copy-ready, and visual receipt checks according to qa-checklist.md.

Completion Report

Only report information related to this branch:

  • Content mode, delivery mode, body master template, and preview path; clearly indicate whether it's a local preview or an official replicable version.
  • For rewrite, the main changes; for preserve, the original copy verification and approved new nodes.
  • Path to the first image/cover, image plan path, number of visual sources, and evidence URLs or failure reasons.
  • Usage positions of user assets and reasons for skipping; current image generation capabilities and real tools.
  • User review status of the official replicable version, unresolved visual or source risks.
  • When creating a draft, return media_id and remind that "entering the draft box does not mean public publication".
  • After the first completion and each round of modification, provide the complete replicable HTML and proactively ask if it is approved and can be added to the draft box.
  • When finalizing, report only the final HTML, retained skill Markdown draft (if any), and the number of untouched external files.

相关技能