Skip to content

isjiamu/gzh-design-skill

gzh-design

Verified

微信公众号文章排版引擎,将 Markdown 转换为可直接粘贴到公众号编辑器的 HTML。主题风格从 references/theme-index.md 注册的自定义主题库中选取,自动章节编号、关键词下划线标记、引言卡片、目录导航、代码块、图片/GIF、作者签名。支持 Markdown / Word(.docx) / PDF / 纯文本输入(非 Markdown 先自动归一化),也支持"一键自动排版"(自动推断结构+选主题),还支持根据用户描述/参考图生成自定义主题组件库并保存本地复用。触发场景:(1) 用户提到"公众号排版""公众号文章""微信排版""gzh",(2) 用户想把文章(md/docx/pdf/纯文本)转成公众号 HTML,(3) 用户说"自动排版""一键排版"公众号内容,(4) 用户想为公众号排版"生成新主题/自定义风格/按这张图做一套组件库"。不用于生成普通网页/落地页/PPT(用前端或 PPT 类 skill)。

references/eval-cases.md

View on GitHub
# 触发与主题选择 · 回归用例

维护本 skill(改 description、加主题、调路由)后用这组用例核对,确保该触发时触发、不该触发时不触发、主题推荐合理。

## 正例(应触发 gzh-design)

- "帮我把这篇 Markdown 做成公众号排版"
- "微信公众号文章排版"
- "gzh,这篇用 XX 主题"(XX 为 theme-index 中已注册主题)
- "把下面这篇文章转成能直接粘进公众号编辑器的 HTML"
- "这篇文章帮我排个版,发公众号用"
- "给公众号排版生成一套新主题 / 自定义风格"(→ 自定义主题生成流程)
- "按这张参考图帮我做一套公众号排版组件库"(→ 自定义主题生成流程)

## 反例(不应触发,应转其它能力)

- "帮我做一个网页落地页" → 前端/web skill
- "把内容做成 PPT" → PPT skill
- "帮我排版这个 Word 文档" → 排版对象不是公众号
- "写一篇公众号文章" → 这是写作,不是排版(先有 Markdown 才用本 skill)

## 主题选择行为(自动推荐制)

- 用户指定了 theme-index 中已注册的主题 → 直接执行不提问
- 题材有明确契合 → 单问确认「建议用 XX(理由),确认还是换一套?」,选项给推荐项 + 1~2 备选 + "看全部",不擅自定死
- 题材无明显倾向 → 默认把 theme-index 第一行(摸鱼绿)作推荐项放第一位,让用户在几套里选
- 用户明说"直接排/一键/不用问" → 全自动例外:自动选题材最契合主题,交付时说明理由
- 用户选定主题后 → 在该主题内部按"文章类型 → 组件组合配方"匹配组件
- theme-index 为空(无已注册主题)→ 不排版,告知用户先添加主题风格,不要凭记忆编造主题

## 关键行为核对(用 assets/sample-article.md 或含代码块/图片的文跑一遍)

- [ ] 选主题默认把 theme-index 第一行主题放第一位
- [ ] 解析结构后判定了文章类型,并按主题库「文章类型 → 组件组合配方」表选组件组合(不是逐段随机选)
- [ ] 点缀组件种类不超过配方表规定的上限
- [ ] 目录/导航组件位置符合主题骨架(摸鱼绿:toc-scroll 紧跟封面之下,在引言和前言之前)
- [ ] 正文引号生成时即为全角弯引号,无需事后替换
- [ ] 代码块走代码块组件,不塞进段落
- [ ] 图片用图片组件、GIF 加动图角标
- [ ] 正文半角标点被改成中文全角(代码块内不动)
- [ ] 开头引言卡署名按文章作者/主题定,不固定"甲木"
- [ ] 尾部签名区默认用 `{{作者名}}` 占位(不写死人名);用户给了署名才填入,原文已有签名则沿用原文
- [ ] 原文已有签名段时合并进唯一签名区,不重复
- [ ] 强调/小标题用小标签或左竖条,无虚线框
- [ ] 代码块紧凑:每行一个 `<p style="margin:0">`,无 `white-space:pre`,无大段空白
- [ ] `【插入…】` 类待补占位用 2c 居中板块,不是左对齐提示块
- [ ] 骨架按所选主题库的"完整文章模板骨架"装配,不套用其它主题骨架
- [ ] 生成后跑 scripts/validate_gzh_html.py,ERROR 与半角 WARNING 清零

## 自定义主题生成行为

- 用户说"生成新主题"但只给一句风格描述 → 一次性问全偏好字段(不逐字段追问),空缺项按 theme-generator.md 规则自动补全
- 用户上传参考图 → 先 Read 提取视觉特征,只做风格转译,不复刻图中文字/Logo/构图
- 生成的区块库 HTML 保存到 `assets/theme-previews/{theme-id}.html`,全部区块在一页内连续排布,用户**整页一次浏览**确认风格(不逐块展示、不逐块确认),再转标准主题库
- 转换 `theme-{标识}.md` 时:补 `<span leaf="">`、去掉预览用 `id`、补齐五章节(变量表/组件/骨架/配方表/映射表)
- 新主题登记进 theme-index.md 且 `component_lint.py` 0 ERROR 后才算交付;之后"列全部主题让用户选"必须包含它
- 主题 ID 与已有主题冲突 → 提示换名或确认覆盖,不静默覆盖

## 格式兼容用例

- 给 `.docx` → 先跑 `scripts/extract_docx.py` 转 md,再结构确认,不直接读二进制
- 给 `.pdf` → Read 分页读取,删页眉页脚页码、合并硬断行,图位留居中占位
- 给无标记 `.txt`(含"一、二、"式标题)→ 正确推断为 `##`,结构确认后再排
- 给完全无标题的纯文本 + "直接排" → 全自动:语义分章 + 自拟标题 + 自选主题,交付附决策说明
- 给 `.doc` 老格式 → 提示另存为 .docx,不硬解析

## 维护 · 可验证循环

改了组件库或 SKILL 后,按这个闭环验证,确保不引入排版反模式(大空白、左对齐占位、正文虚线框、平台禁用项):

1. **改** 组件库 / SKILL / 脚本
2. **源头关**:`python3 scripts/component_lint.py .`
   扫所有组件库的 ```html 块,检测 `white-space:pre`(大空白)、四周虚线框 `border:…dashed`(正文,居中占位块豁免)、平台禁用项(div/class/id/style/grid/position/var/@media)。须 **0 ERROR**。
3. **生成** 用改后的 skill 排版 `assets/sample-article.md`(或真实文章)
4. **产物关**:`python3 scripts/validate_gzh_html.py <产物.html>`
   检测禁用标签、`<span leaf>` 包裹、半角标点。须 **0 ERROR、半角 0 WARN**。
5. 任一关不过 → 回第 1 步,直到两关全绿。

两脚本分工:`component_lint` 管「组件库源头不含反模式」,`validate_gzh_html` 管「最终产物合规」。源头干净 → 产物必然跟着干净,这是循环成立的依据。
canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall