---
name: pptx
description: Use for all PowerPoint .pptx tasks—create presentations from scratch, edit existing slides, analyze and extract presentation content, manage slide order, add shapes/images/tables/charts/speaker notes/hyperlinks. Invoke when the user mentions .pptx, PowerPoint, decks, slides, or any presentation deliverable.
user-invocable: true
---

# PresentationML (PPTX) skill

## Must-read guides (load with `read_file`)

| File | When |
|------|------|
| [`python_pptx_authoring.md`](python_pptx_authoring.md) | **Creating** presentations and **analyzing/extracting** content with **python-pptx** (text, shapes, tables, charts, speaker notes, hyperlinks). |
| [`unpacked_deck_editing.md`](unpacked_deck_editing.md) | Template-based unpack → edit XML → pack → clean; slide list ops; formatting pitfalls. |

## Decision tree

```
Need to CREATE a new deck?              → python_pptx_authoring.md
Need to EDIT an existing deck?          → unpacked_deck_editing.md
Need to ANALYZE / EXTRACT content?      → python_pptx_authoring.md (reading section)
Need to ADD charts?                     → python_pptx_authoring.md (charts section)
Need to ADD speaker notes?              → python_pptx_authoring.md (speaker notes section)
Need to REORDER / DELETE slides?        → unpacked_deck_editing.md (slide list mechanics)
Need slide THUMBNAILS?                  → slide_preview_grid.py
```

## OOXML kit

Same layout as the DOCX skill: `scripts/ooxml_kit/` contains `expand_ooxml_zip.py`, `build_ooxml_zip.py`, `libreoffice_runner.py`, `audit_ooxml_package.py`, validators, and `schemas/` for XSD checks.

## PPTX helpers

| Script | Role |
|--------|------|
| `slide_preview_grid.py` | Build a JPEG grid of slide thumbnails (Pillow + LibreOffice PDF export; falls back to embedded thumbnail if tools unavailable). |
| `prune_orphan_parts.py` | Remove unreferenced slides/media from an **unpacked** tree. |
| `insert_slide_copy.py` | Add slides from an existing slide XML or from a layout. Auto-inserts into `presentation.xml`; use `--position N` for ordering. |

## Reading / analyzing content

- **Python**: `python-pptx` — see `python_pptx_authoring.md` (reading section) for text extraction, title listing, table extraction, speaker notes extraction, and image extraction.
- **Quick text dump**: `python -m markitdown presentation.pptx` (if markitdown is installed).
- **Unpack for raw XML inspection**: `python scripts/ooxml_kit/expand_ooxml_zip.py deck.pptx unpacked/`

## Dependencies

`python-pptx` (creation/analysis), `defusedxml`, `lxml`, `Pillow`. Optional: LibreOffice + poppler-utils (`pdftoppm`) for full slide thumbnail rendering (falls back to embedded thumbnail without them).

## Important: do not read .pptx files with Read tool

After creating a `.pptx` file, do **not** use the Read tool or Bash `view` to verify it — `.pptx` files are binary ZIP archives and cannot be read as text. Instead:
- Confirm success from the script's stdout (e.g., `print("Created:", path)`)
- If verification is needed, use python-pptx to open the file and print slide text
- Always wrap the script body in `try/except` and print `ERROR:<type>:<message>` on failure
- **Only reference the file for delivery if the Bash output contains `SAVED:<path>`** — if the output shows an error or a non-zero exit code, the file was not created

