spb/ultra-sharp-agent-skills Public
Ultra-Sharp Agent Skills — a research-first skill-authoring system + 72 production-ready skills for AI agents.
Python 100%
1---2name: processing-pptx3description: Creates, reads, and modifies PowerPoint presentations (.pptx, .potx) with python-pptx — slides, layouts, text, tables, images, charts. Use when the user asks to create, build, read, edit, or fix a presentation, deck, or slides, or mentions .pptx/.potx files or PowerPoint. Do not use for Word documents, PDFs, or Google Slides.4---56<!--7Author: Simon-Pierre Boucher8Contact: contact@spboucher.ai9-->1011# Processing PPTX1213## When to use / when NOT to use14- **Use for:** creating, reading, or modifying `.pptx` and `.potx` files — slides, text, tables, images, charts, speaker notes.15- **Do NOT use for:** Word documents, PDFs, or Google Slides (different API).1617## Quick reference1819Default library: **python-pptx**. Visual verification: **LibreOffice** render to PDF/images when layout correctness matters.2021**Create:**22```python23from pptx import Presentation24from pptx.util import Inches, Pt2526prs = Presentation() # 4:3 default; set 16:9 explicitly:27prs.slide_width, prs.slide_height = Inches(13.333), Inches(7.5)2829slide = prs.slides.add_slide(prs.slide_layouts[0]) # 0 = title slide30slide.shapes.title.text = "Q3 Results"31slide.placeholders[1].text = "Finance Team — 2026"32prs.save("deck.pptx")33```3435**Read:**36```python37from pptx import Presentation38for i, slide in enumerate(Presentation("deck.pptx").slides, 1):39 for shape in slide.shapes:40 if shape.has_text_frame:41 print(i, shape.text_frame.text)42```4344**Modify:**45```python46prs = Presentation("deck.pptx")47slide = prs.slides[1]48for shape in slide.shapes:49 if shape.has_text_frame and "draft" in shape.text_frame.text.lower():50 shape.text_frame.text = shape.text_frame.text.replace("Draft", "Final")51prs.save("deck.pptx")52```5354**Visual check (when layout matters):**55```bash56soffice --headless --convert-to pdf deck.pptx # then inspect pages for overflow/overlap57```5859## Design rules60- Safe fonts only: Arial or Calibri.61- Keep ≥0.5" margins; body text ≥14pt, titles ≥28pt.62- No text-only slides in a finished deck — add an image, chart, or table per slide where content allows.63- Build a new deck from an existing template (`Presentation("template.potx")`) when the user has one; reuse its layouts instead of drawing boxes manually.6465## Workflow661. Classify the task: create / read / modify.672. Creating: start from the user's template if provided, else default template with 16:9 size. Use slide layouts and placeholders, not free-floating text boxes, so themes apply.683. Modifying: read all slides first; edit in place, preserving each shape's position and formatting.694. Validate: re-open with `Presentation(path)` — if it raises, fix before delivering. Count slides and confirm expected titles.705. If the deck is a final deliverable, render via `soffice --headless --convert-to pdf` and check for text overflow, overlap, and contrast.716. Report the output path, slide count, and what changed.7273## Edge cases & failure modes74- **python-pptx missing** → `pip install python-pptx`. **LibreOffice missing** → `brew install --cask libreoffice` (only needed for visual checks/conversion).75- **Corrupt / not a zip** → `Presentation()` raises `PackageNotFoundError`; report invalid pptx, stop.76- **Password-protected file** → python-pptx cannot decrypt; ask for an unprotected copy.77- **`.ppt` (legacy binary)** → unsupported; convert first: `soffice --headless --convert-to pptx file.ppt`.78- **Text overflowing its box** → python-pptx cannot measure rendered text; shorten text or reduce font size, then re-render to verify.7980## References81Deeper recipes (bullets, tables, images, charts, speaker notes, template reuse, per-slide deletion, conversion, gotchas): see [references/recipes.md](references/recipes.md).82