pptx
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; 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.
1How It Works & Mechanism
Shares the container philosophy with docx/xlsx: `.pptx` is also ZIP+XML. Route selection depends on the task—generate programmatically via pptxgenjs (npm) for new decks; edit existing/template decks via unzip → modify slideN.xml → zip; read files via markitdown.
A `.pptx` is a ZIP archive of XML files. Choose your approach by task:
Structural operations must rely on scripts rather than manual copying: add_slide.py clones slides/layouts and fixes package-internal registrations (rels/content-type/sldIdLst), while clean.py removes orphaned components—file-level consistency is guaranteed by tooling.
`add_slide.py` does every registration a new slide needs and reports what it made
Extensive list of gotchas on the creation side (pptxgenjs pitfalls): no '#' or 8-digit hex for colors, transparency uses 'transparency', shadow offset ≥ 0, list items need bullet:true, combo charts require dual-axis declarations (valAxes + catAxes), dataLabelPosition outEnd corrupts files, etc.—all safeguarded by validate.py for final checks.
It reports the two chart faults above and the slide-XML defects PowerPoint refuses, and names the fix for each.
Chart strategy: 'Never use an image when native is possible'—use addChart() where PowerPoint supports it natively; calculate series manually or post-process OOXML for unsupported features (trendlines/error bars); only fall back to rasterized images for charts PowerPoint cannot represent natively (Sankey/network/chord).
Use `addChart()` for everything PowerPoint can chart
XML security requirements for template editing: transformations must be parsed with defusedxml.minidom, strictly forbidding xml.etree (which rewrites namespace prefixes and corrupts files); template slots ≠ source items (e.g., delete the entire group rather than just clearing text when fitting 3 people into a 4-person template).
If you script an XML transform, parse with `defusedxml.minidom` — round-tripping OOXML through `xml.etree.ElementTree` rewrites namespace prefixes and corrupts the deck.
Three-tiered mandatory QA: Content QA (markitdown text verification + placeholder remnant grep), File QA (validate.py mandatory check, template derivatives must baseline against --original), and Visual QA (soffice conversion to PDF → pdftoppm visual rendering for per-slide inspection, ideally using a subagent for a fresh perspective).
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)
Design layer includes built-in 'anti-AI-slop' guidelines: theme palette first, 60-70% dominant color ratio, avoid colored accent stripes/underline motifs, ban default blue/cream backgrounds, and classify fonts into QA-trustworthy and untrustworthy tiers (LibreOffice font-width metric differences can mislead overflow checks).
**NEVER use accent lines under titles** — these are a hallmark of AI-generated slides
2Core Capabilities
3External Dependencies
| Kind | Dependency / Endpoint |
|---|---|
| package | pptxgenjs(npm,deck 生成) |
| package | markitdown[pptx] / Pillow / defusedxml / lxml(pip:文本转储/缩略图/clean/validate) |
| package | react-icons / react / react-dom / sharp(npm,图标管线,条件安装) |
| cli | LibreOffice soffice(视觉 QA 渲染/.ppt 转换,经 soffice.py 包装) |
| cli | pdftoppm(Poppler,出图) |
4Recommended Governance & Evidence
- scripts/: Executes local scripts or commands: add_slide.py / clean.py / thumbnail.py / validate.py / soffice.py (bundled Python
- 本地工作目录: File I/O and artifact output: outputs deck/out.pptx, unpacked/ directory, thumbnail jpg files, and C source/shim/profiles in soffice.py tempdir
5Second-Pass Verification
- [ok] office/ 树与 docx/xlsx 一致 — diff -rq 三目录 office/ 零差异;soffice.py/validate.py 为同一文件副本。
- [ok] add_slide/clean/thumbnail 行为声明 — SKILL.md 表与正文描述(注册报路径、孤儿清理、labeled 网格)与各脚本 docstring/实现相符。
- [ok] pptxgenjs 坑清单与 validate 兜底 — 'corrupts the file' 类规则 + 'After writeFile(), run validate.py' 原文在;validate.py 确有 chart/slide 检查逻辑。
- [ok] defusedxml 安全解析 — SKILL.md 明文禁止 xml.etree 做变换并指定 defusedxml.minidom;脚本中实际使用 defusedxml。
- [ok] 网络/凭证零命中 — 脚本无网络调用;环境变量仅 soffice.py 拷贝环境设 VCL 插件与 LD_PRELOAD(无读取密钥)。
- [ok] 夸大检查 — description 'any time a .pptx or .potx file is involved'——正文覆盖 create/edit/template/read/QA 全链,无越界承诺;设计指导属 prompt 层(依赖模型遵循+validate 兜底)。
- [ok] 元数据 — 本地 HEAD==pin 41bbe19;LICENSE 专有与 frontmatter 'Proprietary' 一致。
6Verdict & Scenarios
fa29d7374c319c8e…