Creates, edits, and analyzes .pptx/.potx files using pptxgenjs and OOXML manipulation. Handles slide thumbnails, structure editing, template reuse, and validation for Chinese business presentations.
Ships in document-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
.pptx/.potx 是包含 OOXML 的 ZIP 包。按任务选择:
| 任务 | 方法 |
|---|---|
| 新建演示稿 | 使用 pptxgenjs |
| 修改现有稿或模板 | 解包 → 调整结构 → 编辑 XML → 清理 → 压缩 |
| 读取内容 | markitdown deck.pptx |
| 观察全稿结构 | python scripts/thumbnail.py deck.pptx deck-thumbs |
脚本路径均相对于本 Skill 目录。
输入:“把这份 Data Agent 技术方案做成 12 页中文汇报,用公司模板,老板 10 分钟能讲完。”
**执行:**先提炼一条可讲述主线,再用缩略图选择不同模板布局;控制每页一个判断,保留公司母版,补讲稿备注,最后做内容、视觉和文件结构三轮检查。
输入:“roadmap.pptx 太密了,帮我重排但不要改事实。”
**执行:**先抽取文字和缩略图,建立事实清单;只重组层级和布局,不替换数据;输出前逐页渲染并核对原始事实。
| 脚本 | 用途 |
|---|---|
scripts/thumbnail.py deck.pptx prefix | 生成带页码的全稿缩略图网格 |
scripts/add_slide.py unpacked/ slide2.xml --after slideN.xml | 正确复制页面或 layout,并登记所有关系 |
scripts/clean.py unpacked/ | 在页面列表确定后清理孤立页面、媒体和关系 |
scripts/office/validate.py deck.pptx --original src.pptx | 校验 schema、关系、content type、图表和页面 |
scripts/office/soffice.py --headless --convert-to pdf deck.pptx | 在沙箱环境稳定调用 LibreOffice |
pptxgenjs 通常已预装。先直接 require("pptxgenjs"),只有导入失败才安装。
高风险规则:
pres.layout。LAYOUT_16x9 是 10 × 5.625 英寸,LAYOUT_WIDE 是 13.333 × 7.5 英寸。#;透明度使用对应属性,不写 8 位颜色。offset >= 0;向上投影使用正 offset 配合 angle: 270。margin: 0。bullet: true,不要手写 •。new pptxgen() 实例。slide.addNotes(),不要放成页面文本框。addChart();只有原生不支持的 Sankey、网络图等才转图片。dataLabelPosition 只能用 ctr、inEnd、inBase;错误配置会损坏文件。valAxes 和 catAxes。writeFile() 后立即运行 validate.py,从生成脚本修问题,不手改打包后的 XML。先生成缩略图并传入专属前缀,避免不同演示稿互相覆盖:
python scripts/thumbnail.py template.pptx template-thumbs
python -m markitdown template.pptx
结构编辑工作流:
python3 -c "import sys,zipfile; zipfile.ZipFile(sys.argv[1]).extractall('unpacked')" deck.pptx
find unpacked -type l -delete
python scripts/add_slide.py unpacked/ slide2.xml --after slide2.xml
# 在 ppt/presentation.xml 的 <p:sldIdLst> 调整顺序或删除页面
python scripts/clean.py unpacked/
# 编辑 ppt/slides/slideN.xml
(cd unpacked && rm -f ../output.pptx && zip -Xr ../output.pptx .)
python scripts/office/validate.py output.pptx --original deck.pptx
顺序必须是:先新增/删除/排序,再改页面内容。add_slide.py 会复制源页,若先编辑再复制,会意外克隆已改内容。
不要手工复制 slideN.xml。一个页面还涉及 presentation、rels、content type、notes 和媒体关系。
修改模板时:
<a:p>。text_frame.text = ... 抹掉格式。xml:space="preserve"。先确定受众、会议时长和单一结论,再设计页面。
内容检查:
python -m markitdown output.pptx
python -m markitdown output.pptx | grep -iE "xxxx|lorem|ipsum|placeholder"
python scripts/office/validate.py output.pptx
视觉检查:
rm -f slide-*.jpg
python scripts/office/soffice.py --headless --convert-to pdf output.pptx
pdftoppm -jpeg -r 150 output.pdf slide
ls -1 "$PWD"/slide-*.jpg
逐页检查:
修复后必须重新生成 PDF 和全部页面图片,不能只看旧截图。
pptxgenjs · markitdown[pptx] · Pillow · defusedxml · lxml · LibreOffice · Poppler
LICENSE.txt (opens in a new tab)scripts/__init__.py (opens in a new tab)scripts/add_slide.py (opens in a new tab)scripts/clean.py (opens in a new tab)scripts/office/helpers/__init__.py (opens in a new tab)scripts/office/helpers/pptx_chart.py (opens in a new tab)scripts/office/helpers/pptx_slide.py (opens in a new tab)scripts/office/helpers/pptx_theme.py (opens in a new tab)scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd (opens in a new tab)scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd (opens in a new tab)scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd (opens in a new tab)scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd (opens in a new tab)scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd (opens in a new tab)scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd (opens in a new tab)scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd (opens in a new tab)scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd (opens in a new tab)scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd (opens in a new tab)scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd (opens in a new tab)scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd (opens in a new tab)scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
4 skills in this plugin
/docx只要用户要创建、读取、修改或交付 Word 文档/模板(.docx、.dotx),就应使用本技能。中文触发包括:把会议纪要整理成正式 Word、制作带目录/页码/页眉页脚的报告或函件、修改合同、修订模式、批注、替换图片、提取或重组 Word 内容。即使用户只说“做成正式文档”“给我一份可打印的报告”,只要目标产物是 Word,也应触发。不要用于 PDF、表格、Google Docs API 或与文档无关的编码任务。/pdf只要任务涉及 PDF 输入或输出,就应优先使用本技能。包括:读取/抽取文本与表格、合并拆分、旋转页面、加水印、创建新 PDF、填写表单、加解密、提取图片、扫描件 OCR 等。用户提到 `.pdf` 文件名或要求交付 PDF 时都应触发。/xlsx当电子表格是主要输入或交付物时必须使用本技能。适用于打开、读取、清洗、修复、编辑或创建 .xlsx、.xlsm、.xltx、.csv、.tsv,包括中文销售台账、预算表、排期表、数据清洗、补公式、格式化、图表和模板更新。用户只说“下载目录里那个表”“把脏 CSV 整成 Excel”也应触发。若主要产物是 Word、HTML、独立 Python 脚本、数据库流水线或 Google Sheets API,则不要触发。/document-skills:pptxfrom document-skills
npx claudepluginhub marcelleon/skills-zh --plugin document-skillsOther plugins' skills for the same job