---
name: "pptx_slide_editing"
description: "Edit PowerPoint decks programmatically with python-pptx: build from templates, fill layouts and placeholders, enforce brand fonts and colors, and generate slide-by-slide change reports. Triggers when the user asks to create, edit, audit, restyle, or diff a .pptx deck, apply a template, or lock a deck to brand."
metadata: { "includeInPrompt": true }
---

# PPTX Slide Editing

## Purpose

Make real .pptx edits that stay editable in PowerPoint: slides built from the template's own layouts and placeholders, brand fonts and colors enforced by a check script, and review copies diffed slide by slide. The skill ships three CLIs in `bin/` that do the auditing, brand-checking, and diffing, plus worked recipes in `references/` for everything else.

## Workflow

1. **Start from a template.** `Presentation("brand-template.pptx")` inherits the brand's fonts, colors, and layouts. Only use bare `Presentation()` for throwaway scripts.

2. **Audit before touching.** Run `bin/pptx_inspect.py deck.pptx` first. It lists every layout and placeholder (name, idx, type) plus a per-slide inventory of shapes, fonts, and explicitly-set colors. Never assume layout index 1 means "Title and Content" in someone else's template; resolve layouts by name and fail loudly listing the names when a lookup misses.

3. **Fill placeholders, don't free-draw.** Set `slide.shapes.title`, write into `slide.placeholders[idx]` text frames, drop pictures/tables/charts into content placeholders. Free text boxes and raw coordinates are the last resort, not the default. All geometry goes through `Inches`/`Pt`/`Cm`, never raw EMU.

4. **Lock the brand.** Put fonts and hex colors in `brand.json` and run `bin/pptx_brandcheck.py brand.json deck.pptx` after every edit. Exit 0 is clean, 1 lists violations with slide and shape names. Details: `references/brand-locks.md`.

5. **Track edits with diffs, not native tracking.** PowerPoint has no track-changes (and Microsoft is retiring the desktop Compare-and-Merge tool, so reviewers now work in shared copies). Keep the original, collect reviewer edits in a copy, then run `bin/pptx_diff.py original.pptx revised.pptx --md report.md` for a slide-by-slide change report covering text, tables, chart titles and series values, and speaker notes. Details: `references/change-reports.md`.

6. **Build new decks from recipes.** Worked, tested examples for titles, bullets, tables, charts, images, speaker notes, and multi-run text styling live in `references/recipes.md`. `references/building-decks.md` covers the layout/placeholder rules.

## Output Contract

- Every generated or edited deck: opens in PowerPoint, uses the template's layouts/placeholders, passes `pptx_brandcheck.py` against the project's brand.json when one exists.
- Every review cycle: produces a Markdown change report via `pptx_diff.py`, never a claim that edits were "tracked" natively.
- Scripts must run clean (`python3 -m py_compile`) and be dry-run tested before shipping.

## Operating Rules

1. Never invent layout names, placeholder indices, fonts, or colors. Inspect the actual deck first.
2. Never set positions in raw EMU; always use the unit helpers.
3. SVG is not supported by python-pptx. Pre-render diagrams to PNG (1600px wide or better) before `add_picture`.
4. Brand checks only see explicitly-set fonts and colors. Anything inherited from the template is reported as inherited and passes silently; if the template itself is off-brand, fix the template.
5. Charts written by python-pptx are native OpenXML charts: PowerPoint renders them and the user can re-edit the data. Prefer them over screenshotting chart images.
6. Keep `SKILL.md` tight. Bulky how-to material goes in `references/`; ship new recipes there, not here.
