powerpoint
Create, edit, and manipulate PowerPoint (.pptx) files programmatically using python-pptx. Use when a user asks to generate a PPTX, modify slides, extract text from a presentation, add charts or tables to PowerPoint, build slides from data, convert content to PPTX, or automate PowerPoint file creation.
What this skill does
# PowerPoint
## Overview
Create, read, and edit PowerPoint (.pptx) files programmatically using the python-pptx library. Handles slide creation, text formatting, images, tables, charts, shapes, slide layouts, and speaker notes. Works without PowerPoint installed — reads and writes the Open XML format directly.
## Instructions
### Setup
```bash
pip install python-pptx
```
**Alternative — AI-generated PPTX:** For fully automated slide generation from text prompts, Presenton (`github.com/presenton/presenton`) is an open-source tool that produces PPTX using OpenAI, Gemini, Claude, or Ollama. Runs locally via Docker. Use python-pptx (below) when you need precise control over content, formatting, and programmatic data-driven generation.
### Object model
```
Presentation
├── slide_layouts[] # Layout variants (title, content, blank, etc.)
├── slides[] # Actual slides
│ ├── shapes[] # Text boxes, images, charts, tables
│ │ ├── text_frame → paragraphs[] → runs[] # Text with formatting
│ │ └── table # Table object (if table shape)
│ └── notes_slide # Speaker notes
└── core_properties # Title, author, subject
```
Layout indices vary by template. Always verify first:
```python
for i, layout in enumerate(prs.slide_layouts):
print(i, layout.name)
```
Common defaults: 0 = Title Slide, 1 = Title and Content, 5 = Title Only, 6 = Blank.
### Creating a presentation
```python
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN
prs = Presentation()
# Title slide
slide = prs.slides.add_slide(prs.slide_layouts[0])
slide.shapes.title.text = "Q4 Revenue Report"
slide.placeholders[1].text = "Finance Team — January 2025"
# Content slide with bullets
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "Key Highlights"
tf = slide.placeholders[1].text_frame
tf.text = "Revenue up 23% year-over-year"
p = tf.add_paragraph()
p.text = "New enterprise clients: 14"
p.level = 1
prs.save("report.pptx")
```
### Editing existing files (template fill)
```python
prs = Presentation("template.pptx")
for slide in prs.slides:
for shape in slide.shapes:
if shape.has_text_frame:
for paragraph in shape.text_frame.paragraphs:
for run in paragraph.runs:
if "{{COMPANY}}" in run.text:
run.text = run.text.replace("{{COMPANY}}", "Acme Corp")
prs.save("filled.pptx")
```
### Quick reference — adding elements
**Image:**
```python
slide.shapes.add_picture("photo.png", Inches(1), Inches(1.5), width=Inches(8))
```
**Table:**
```python
tbl = slide.shapes.add_table(rows, cols, Inches(1), Inches(2), Inches(8), Inches(3)).table
tbl.cell(0, 0).text = "Header"
```
**Chart:**
```python
from pptx.chart.data import CategoryChartData
from pptx.enum.chart import XL_CHART_TYPE
chart_data = CategoryChartData()
chart_data.categories = ["Q1", "Q2", "Q3", "Q4"]
chart_data.add_series("Revenue", (3.2, 3.8, 4.2, 5.1))
slide.shapes.add_chart(XL_CHART_TYPE.COLUMN_CLUSTERED, Inches(1), Inches(2), Inches(8), Inches(4.5), chart_data)
```
**Speaker notes:**
```python
slide.notes_slide.notes_text_frame.text = "Key talking point here."
```
**Text formatting:**
```python
run = paragraph.runs[0]
run.font.size = Pt(28)
run.font.bold = True
run.font.color.rgb = RGBColor(0x1A, 0x73, 0xE8)
run.font.name = "Calibri"
paragraph.alignment = PP_ALIGN.CENTER
```
### Design principles for generated slides
Apply these rules when building presentations programmatically:
**Typography:** Use Inter, Poppins, or Montserrat instead of default Calibri. One font family per presentation. Titles minimum 36pt, body minimum 24pt. Set line spacing to 1.2–1.3 for body text, 0.8–0.9 for large display text.
**Layout:** Left-align body text (center only for short titles). Use generous margins — `Inches(1)` minimum on all sides. Use multi-column layouts for readability. Vary slide designs while keeping a consistent style.
**Content density:** One idea per slide. Maximum 6 lines of text, 6 words per line. Split dense content across multiple slides (~30 seconds each). Replace bullet lists with visual hierarchy using font size, weight, and spacing.
**Whitespace:** Treat empty space as a design element, not wasted space. Apply padding inside boxes and shapes — at least `Inches(0.3)` internal margin.
**Visuals:** One hero image or chart per slide. Use high-contrast text on backgrounds. SVG icons from Noun Project (thenounproject.com) enhance slides without clutter. For professional templates as starting points, download PPTX files from Slidesgo (slidesgo.com) and load them with `Presentation("template.pptx")`.
## Examples
### Example 1: Generate a sales report from JSON data
**User request:** "Create a PowerPoint report from this sales data JSON file"
```python
import json
from pptx import Presentation
from pptx.util import Inches
from pptx.chart.data import CategoryChartData
from pptx.enum.chart import XL_CHART_TYPE
with open("sales_data.json") as f:
data = json.load(f)
prs = Presentation()
# Title slide
slide = prs.slides.add_slide(prs.slide_layouts[0])
slide.shapes.title.text = f"Sales Report — {data['period']}"
slide.placeholders[1].text = f"Generated {data['generated_date']}"
# Summary slide
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "Executive Summary"
tf = slide.placeholders[1].text_frame
tf.text = f"Total Revenue: ${data['total_revenue']:,.0f}"
p = tf.add_paragraph()
p.text = f"Units Sold: {data['units_sold']:,}"
p = tf.add_paragraph()
p.text = f"Top Region: {data['top_region']}"
# Chart slide — revenue by region
chart_data = CategoryChartData()
chart_data.categories = [r["name"] for r in data["regions"]]
chart_data.add_series("Revenue ($M)", [r["revenue"] for r in data["regions"]])
slide = prs.slides.add_slide(prs.slide_layouts[5])
slide.shapes.title.text = "Revenue by Region"
slide.shapes.add_chart(
XL_CHART_TYPE.COLUMN_CLUSTERED,
Inches(1), Inches(2), Inches(8), Inches(4.5), chart_data
)
# Table slide — product breakdown
products = data["products"]
slide = prs.slides.add_slide(prs.slide_layouts[5])
slide.shapes.title.text = "Product Performance"
tbl = slide.shapes.add_table(len(products) + 1, 3, Inches(1), Inches(2), Inches(8), Inches(3)).table
for j, h in enumerate(["Product", "Units", "Revenue"]):
tbl.cell(0, j).text = h
for i, prod in enumerate(products):
tbl.cell(i + 1, 0).text = prod["name"]
tbl.cell(i + 1, 1).text = f"{prod['units']:,}"
tbl.cell(i + 1, 2).text = f"${prod['revenue']:,.0f}"
prs.save("sales_report.pptx")
```
### Example 2: Batch-update branding across PPTX templates
**User request:** "Update the company name and logo across all our PPTX templates"
```python
import glob
from pptx import Presentation
from pptx.util import Inches
old_name, new_name = "OldCorp Inc.", "NewBrand Technologies"
new_logo = "assets/newbrand_logo.png"
for filepath in glob.glob("templates/*.pptx"):
prs = Presentation(filepath)
for slide in prs.slides:
to_remove = []
for shape in slide.shapes:
if shape.has_text_frame:
for para in shape.text_frame.paragraphs:
for run in para.runs:
if old_name in run.text:
run.text = run.text.replace(old_name, new_name)
if shape.shape_type == 13 and shape.name.startswith("Logo"):
to_remove.append((shape, shape.left, shape.top, shape.width, shape.height))
slide.shapes.add_picture(new_logo, shape.left, shape.top, shape.width, shape.height)
for shape, *_ in to_remove:
shape._element.getparent().remove(shape._element)
output = filepath.replace("templates/", "updated/")
prs.save(output)
print(f"Updated: {output}")
```
### Example 3: Extract presentation content to markdown
**User request:** "Extract allRelated in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.