← 提示词库 Anthropic/claude-code/skills/pptx/SKILL.md 原文 md
🌐 中英双语对照

name: pptx
description: "Use 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 as PowerPoint (.pptx) files; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email, summary, or creating a different type of slide deck); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user asks for a PowerPoint or .pptx file, or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. However, when the user asks for a deck, slides, a slide deck, or a presentation without naming a file format, default to using a dedicated slide-deck artifact type or a separate slides skill if this session offers one; otherwise, use this skill."
license: Proprietary. LICENSE.txt has complete terms

PPTX creation, editing, and analysis / PPTX 创建、编辑与分析

If this session offers a dedicated slide-deck artifact type or a separate slides skill, and the user has neither asked for a PowerPoint/.pptx file nor supplied a .pptx/.potx file to edit, fill in, or convert, build the deck with that type or skill instead. A .pptx/.potx file given only as source material or as an example for a new deck ("make another deck like this one") does not count as supplied: read it with this skill, then build the new deck with that type or skill. This skill remains the right tool for producing .pptx files and for reading, editing, templating, or converting existing .pptx/.potx files.

如果本次会话提供了专用的幻灯片组 artifact 类型或独立的 slides 技能,而用户既未要求 PowerPoint/.pptx 文件,也未提供需要编辑、填充或转换的 .pptx/.potx 文件,则应改用该类型或技能来构建幻灯片组。仅作为素材或新幻灯片组范例提供的 .pptx/.potx 文件("照这份再做一份")不算"已提供":先用本技能读取它,再用该类型或技能构建新幻灯片组。在生成 .pptx 文件,以及读取、编辑、套用模板或转换既有 .pptx/.potx 文件方面,本技能仍是正确的工具。

【评论】这是一条技能路由限定规则:把泛泛的"要一份幻灯片"请求让渡给会话中的专用幻灯片 artifact 类型或其他技能,避免本技能被过度触发。

A .pptx is a ZIP archive of XML files. Choose your approach by task:

.pptx 是一个由 XML 文件组成的 ZIP 归档。请根据任务选择处理方式:

Task Approach
Create a new deck Write a pptxgenjs script — see gotchas below
Edit an existing deck, or build from a template unzip → edit ppt/slides/slideN.xml → zip
Read content markitdown deck.pptx (one block per slide under <!-- Slide number: N --> markers); visual grid: python scripts/thumbnail.py deck.pptx
任务 方法
创建新幻灯片组 编写 pptxgenjs 脚本 — 见下文注意事项
编辑既有幻灯片组,或从模板构建 解压 → 编辑 ppt/slides/slideN.xml → 重新打包
读取内容 markitdown deck.pptx(每张幻灯片对应 <!-- Slide number: N --> 标记下的一个区块);可视化网格:python scripts/thumbnail.py deck.pptx

Scripts / 脚本

Paths are relative to this skill's directory. Everything else is plain Python, node, or shell.

路径相对于本技能所在目录。其余脚本均为普通 Python、node 或 shell。

Script What it does
scripts/thumbnail.py deck.pptx [prefix] Labeled grid of every slide, for picking template layouts. .pptx only. Pass prefix — it defaults to thumbnails, which overwrites the grids of any other deck done in the same directory
scripts/add_slide.py unpacked/ slide2.xml [--after slideN.xml] Duplicate a slide (or a slideLayoutN.xml) with all the package bookkeeping. Also takes a .pptx directly with -o out.pptx
scripts/clean.py unpacked/ Delete slides, media, and rels no longer referenced. Run after <p:sldIdLst> is final
scripts/office/validate.py deck.pptx [--original src.pptx] Schema, relationship, content-type, chart and slide checks; each failure names its fix. Pass --original for any template-derived deck — it baselines the schema checks against the template, so the template's own XSD errors don't read as yours
scripts/office/soffice.py --headless --convert-to pdf deck.pptx LibreOffice wrapper — bare soffice hangs in this sandbox
脚本 作用
scripts/thumbnail.py deck.pptx [prefix] 生成每张幻灯片的带标签网格图,用于挑选模板布局。仅支持 .pptx。可传 prefix — 默认为 thumbnails,会覆盖同目录中其他幻灯片组已生成的网格
scripts/add_slide.py unpacked/ slide2.xml [--after slideN.xml] 复制幻灯片(或 slideLayoutN.xml)并完成所有包级登记事项。也可通过 -o out.pptx 直接作用于 .pptx 文件
scripts/clean.py unpacked/ 删除不再被引用的幻灯片、媒体和 rels。请在 <p:sldIdLst> 定稿之后运行
scripts/office/validate.py deck.pptx [--original src.pptx] 架构、关系、内容类型、图表与幻灯片检查;每项失败都会注明修复方法。凡由模板派生的幻灯片组都请传 --original — 它以模板为基线执行架构检查,模板自身的 XSD 错误就不会被算到你头上
scripts/office/soffice.py --headless --convert-to pdf deck.pptx LibreOffice 封装 — 在本沙箱中直接运行 soffice 会挂起

Creating with pptxgenjs — gotchas / 使用 pptxgenjs 创建 — 注意事项

pptxgenjs is preinstalled — do not run npm install first; write the script and require('pptxgenjs') directly. Only if that require fails: npm install pptxgenjs. The model knows the API; these are the footguns:

pptxgenjs 已预装 — 不要先运行 npm install;直接编写脚本并 require('pptxgenjs')。仅当 require 失败时才执行:npm install pptxgenjs。模型了解该 API;以下是需要提防的坑:

【评论】这份"坑清单"以命令式断言罗列第三方库的具体缺陷行为,本质是用人工经验补足模型对库版本细节的知识缺口,属于典型的技能层知识外置设计。

Editing existing decks and templates / 编辑既有幻灯片组与模板

Pick layouts first: python scripts/thumbnail.py template.pptx template-thumbs writes a labeled grid of every slide and prints the file(s) it created — template-thumbs.jpg, split into template-thumbs-N.jpg past 12 slides. Always pass that second argument, named after the deck. It defaults to thumbnails, so two decks thumbnailed in one directory silently overwrite each other's grids — the first deck's are simply gone (template analysis only — visual QA needs the full-resolution renders from Converting to Images; it only accepts .pptx, so copy a .potx to a .pptx name first). Use it with markitdown to map each content section onto a template slide, and vary the layouts — don't put every section on the same title-and-bullets slide.

先挑选布局:python scripts/thumbnail.py template.pptx template-thumbs 会生成每张幻灯片的带标签网格图,并打印其创建的文件 — template-thumbs.jpg,超过 12 张幻灯片时拆分为 template-thumbs-N.jpg。务必传第二个参数,并以幻灯片组命名。 其默认值为 thumbnails,因此同一目录下对两个幻灯片组截图时,二者的网格会互相静默覆盖 — 第一份的直接丢失(仅限模板分析 — 视觉 QA 需用 Converting to Images 中的全分辨率渲染图;该命令只接受 .pptx,故需先把 .potx 复制为 .pptx 文件名)。将其与 markitdown 配合使用,把每个内容小节映射到模板幻灯片上,并变换布局 — 不要把每个小节都放在同一张"标题+要点"幻灯片上。

python3 -c "import sys,zipfile; zipfile.ZipFile(sys.argv[1]).extractall('unpacked')" deck.pptx
python scripts/add_slide.py unpacked/ slide2.xml --after slide2.xml   # duplicate a slide (or slideLayoutN.xml); prints the new slide's path
# reorder / delete slides = edit <p:sldIdLst> in ppt/presentation.xml
python scripts/clean.py unpacked/                                     # after deletions: removes orphaned slides, media, rels
# edit slide content in ppt/slides/slideN.xml
(cd unpacked && rm -f ../out.pptx && zip -Xr ../out.pptx .)           # zip from INSIDE the dir; rm first or deleted parts survive
python scripts/office/validate.py out.pptx --original deck.pptx

When filling in a template:

填充模板时:

Design Ideas / 设计思路

Don't create boring slides. Plain bullets on a white background won't impress anyone. Consider ideas from this list for each slide.

不要做出乏味的幻灯片。 白底上的普通要点列表打动不了任何人。每张幻灯片都请从本列表中借鉴点子。

Before Starting / 开始之前

Color Palettes / 配色方案

Choose colors that match your topic — don't default to generic blue. Use these palettes as inspiration:

选择与主题匹配的颜色 — 不要默认用千篇一律的蓝色。以下调色板可供参考:

Theme Primary Secondary Accent
Midnight Executive 1E2761 (navy) CADCFC (ice blue) FFFFFF (white)
Forest & Moss 2C5F2D (forest) 97BC62 (moss) F5F5F5 (cream)
Coral Energy F96167 (coral) F9E795 (gold) 2F3C7E (navy)
Warm Terracotta B85042 (terracotta) E7E8D1 (sand) A7BEAE (sage)
Ocean Gradient 065A82 (deep blue) 1C7293 (teal) 21295C (midnight)
Charcoal Minimal 36454F (charcoal) F2F2F2 (off-white) 212121 (black)
Teal Trust 028090 (teal) 00A896 (seafoam) 02C39A (mint)
Berry & Cream 6D2E46 (berry) A26769 (dusty rose) ECE2D0 (cream)
Sage Calm 84B59F (sage) 69A297 (eucalyptus) 50808E (slate)
Cherry Bold 990011 (cherry) FCF6F5 (off-white) 2F3C7E (navy)
主题 主色 次色 点缀色
Midnight Executive(午夜行政) 1E2761(海军蓝) CADCFC(冰蓝) FFFFFF(白)
Forest & Moss(森林与苔藓) 2C5F2D(森林绿) 97BC62(苔藓绿) F5F5F5(奶油白)
Coral Energy(珊瑚活力) F96167(珊瑚红) F9E795(金黄) 2F3C7E(海军蓝)
Warm Terracotta(暖陶土) B85042(陶土红) E7E8D1(沙色) A7BEAE(鼠尾草绿)
Ocean Gradient(海洋渐变) 065A82(深海蓝) 1C7293(青绿) 21295C(午夜蓝)
Charcoal Minimal(炭黑极简) 36454F(炭灰) F2F2F2(灰白) 212121(黑)
Teal Trust(青绿信赖) 028090(青绿) 00A896(海泡绿) 02C39A(薄荷绿)
Berry & Cream(浆果奶油) 6D2E46(浆果紫红) A26769(灰玫瑰) ECE2D0(奶油白)
Sage Calm(鼠尾草宁静) 84B59F(鼠尾草绿) 69A297(桉叶绿) 50808E(岩板灰)
Cherry Bold(樱桃浓烈) 990011(樱桃红) FCF6F5(灰白) 2F3C7E(海军蓝)

For Each Slide / 每张幻灯片

Every slide needs a visual element — image, chart, icon, or shape. Text-only slides are forgettable.

每张幻灯片都需要一个视觉元素 — 图片、图表、图标或形状。纯文字的幻灯片让人过目即忘。

Layout options:

布局选项:

Data display:

数据展示:

Visual polish:

视觉打磨:

Typography / 字体排印

Font names you write into the .pptx are rendered by the user's PowerPoint, not by this environment. Your visual QA renders via LibreOffice, which substitutes fonts it doesn't have — and for some fonts the substitute has different widths, so your QA preview can show text overflow (or fit) that the real deck won't have. To keep your QA trustworthy:

你写进 .pptx 的字体名称由用户的 PowerPoint 渲染,而不是由本环境渲染。 你的视觉 QA 通过 LibreOffice 渲染,它会对没有的字体做替换 — 而某些字体的替换字体宽度不同,因此 QA 预览可能显示出真实幻灯片中并不存在(或相反情形)的文字溢出。为了让 QA 可信:

Element Size
Slide title 36-44pt bold
Section header 20-24pt bold
Body text 14-16pt
Captions 10-12pt muted
元素 字号
幻灯片标题 36-44pt 加粗
小节标题 20-24pt 加粗
正文 14-16pt
说明文字 10-12pt 弱化色

Spacing / 间距

Avoid (Common Mistakes) / 避免事项(常见错误)

【评论】把"标题下加线"视为 AI 生成痕迹并明令禁止,是针对 AI 产物审美同质化的反向设计考量,说明该技能同时承担"生成"与"去 AI 味"两个目标。

QA (Required) / QA(必需)

Your first render usually has a few real issues — overlaps, overflow, misalignment. Find and fix those, re-render only the slides you changed, and stop.

首次渲染通常都会有几个真实问题 — 重叠、溢出、错位。找出并修复它们,只重新渲染你改过的幻灯片,然后停止。

Content QA / 内容 QA

markitdown output.pptx

Check for missing content, typos, wrong order.

检查内容缺失、错别字和顺序错误。

When using templates, check for leftover placeholder text:

使用模板时,检查是否残留占位文本:

markitdown output.pptx | grep -iE "\bx{3,}\b|lorem|ipsum|\bTODO|\[insert|this.*(page|slide).*layout"

If grep returns results, fix them before declaring success.

如果 grep 有结果,先修复再宣布完成。

File QA (required) / 文件 QA(必需)

python scripts/office/validate.py output.pptx                      # built from scratch
python scripts/office/validate.py output.pptx --original src.pptx  # built from a template

If the deck came from a template, always pass --original. A template may itself
contain parts the XSD rejects, so a bare run can report failures you never caused — and
a genuine regression can hide among them. --original baselines
the schema and slide checks against the template, suppressing errors it already had.
The structural checks — relationships, content types, charts — ignore --original and
report template-inherited problems either way, so read those on their own merits.

如果幻灯片组来自模板,务必传 --original。 模板自身可能含有 XSD 拒绝的部分,因此不加参数运行时报告的失败可能并非你造成 — 而真正的回归问题也可能藏在其中。--original 以模板为基线执行架构与幻灯片检查,抑制模板本来就有的错误。结构检查(关系、内容类型、图表)不受 --original 影响,无论是否传参都会报告模板遗留的问题,因此需要单独审视这些报告。

pptxgenjs emits chart XML PowerPoint refuses to open, and every other tool
accepts: python-pptx opens those decks, LibreOffice renders them, the XSD
passes them. Every failure names its fix. Fix it in the generator and rebuild.

pptxgenjs 生成的图表 XML 会被 PowerPoint 拒绝打开,而其他所有工具都接受:python-pptx 能打开这类幻灯片组,LibreOffice 能渲染,XSD 校验也能通过。每项失败都会注明修复方法。请在生成器中修复并重新构建。

Visual QA / 视觉 QA

Convert the slides to images (see Converting to Images) and inspect every one. After staring at the generating code you tend to see what you expect rather than what rendered, so look at the images fresh (a subagent works well for this if you have one). User-visible defects to look for:

把幻灯片转换为图片(见 Converting to Images)并逐张检查。盯着生成代码看久了,你往往看到的是自己预期的东西而非实际渲染的结果,因此要以全新眼光查看图片(如果有子代理,用它来做这件事很合适)。需要查找的用户可见缺陷:

【评论】建议用子代理以"新眼光"检查渲染结果,是对抗自产自检确认偏差的一种机制设计。

Converting to Images / 转换为图片

Convert presentations to individual slide images for visual inspection:

将演示文稿转换为单张幻灯片图片以便进行视觉检查:

python scripts/office/soffice.py --headless --convert-to pdf output.pptx
rm -f slide-*.jpg
pdftoppm -jpeg -r 150 output.pdf slide
ls -1 "$PWD"/slide-*.jpg

Pass the absolute paths printed above directly to the view tool. The rm clears stale images from prior runs. pdftoppm zero-pads based on page count: slide-1.jpg for decks under 10 pages, slide-01.jpg for 10-99, slide-001.jpg for 100+.

把上面打印出的绝对路径直接传给查看工具。 rm 用于清除先前运行留下的旧图片。pdftoppm 按页数补零:10 页以下为 slide-1.jpg,10-99 页为 slide-01.jpg,100 页以上为 slide-001.jpg。

After fixes, rerun all four commands above — the PDF must be regenerated from the edited .pptx before pdftoppm can reflect your changes.

修复之后,重新运行上述全部四条命令 — 必须先从编辑后的 .pptx 重新生成 PDF,pdftoppm 才能反映你的修改。

Dependencies / 依赖

pptxgenjs (npm, preinstalled — install only if require('pptxgenjs') fails) · markitdown[pptx], Pillow, defusedxml, lxml (pip — text dump, thumbnail, clean, validate) · LibreOffice (soffice, auto-configured for sandboxed environments via scripts/office/soffice.py) · pdftoppm (Poppler)

pptxgenjs(npm,已预装 — 仅当 require('pptxgenjs') 失败时才安装)· markitdown[pptx]、Pillow、defusedxml、lxml(pip — 文本导出、缩略图、清理、校验)· LibreOffice(soffice,通过 scripts/office/soffice.py 为沙箱环境自动配置)· pdftoppm(Poppler)