Create, edit, and extract content from PowerPoint (.pptx) files; use when you need to generate slides programmatically, update existing decks, or export slide previews.
63
75%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./scientific-skills/Other/PPTX-Skill/SKILL.md.pptx deck from a short prompt or structured outline (e.g., "5 slides about machine learning")..pptx files and populate them with slides..pptx templates and extend them.>=3.7>=0.6.21>=9.0.0 (image handling)>=2.28.0 (downloading remote images)>=7.0 (e.g., PPTX → PDF conversion)# pip install python-pptx Pillow requests
from pptx import Presentation
from pptx.util import Inches
from PIL import Image
import requests
from io import BytesIO
def create_presentation(output_path: str) -> None:
prs = Presentation()
# Slide 1: Title slide
slide = prs.slides.add_slide(prs.slide_layouts[0])
slide.shapes.title.text = "Machine Learning"
slide.placeholders[1].text = "A 5-slide overview generated programmatically"
# Slide 2: Bullets
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "What is Machine Learning?"
tf = slide.shapes.placeholders[1].text_frame
tf.clear()
tf.text = "A field of AI focused on learning patterns from data"
for bullet in [
"Supervised learning",
"Unsupervised learning",
"Reinforcement learning",
]:
p = tf.add_paragraph()
p.text = bullet
# Slide 3: Add an image (downloaded)
img_url = "https://upload.wikimedia.org/wikipedia/commons/4/44/Neural_network.svg"
resp = requests.get(img_url, timeout=30)
resp.raise_for_status()
# Ensure the image is in a format python-pptx can embed reliably
img = Image.open(BytesIO(resp.content)).convert("RGBA")
buf = BytesIO()
img.save(buf, format="PNG")
buf.seek(0)
slide = prs.slides.add_slide(prs.slide_layouts[5]) # Title Only
slide.shapes.title.text = "Neural Networks (Illustration)"
slide.shapes.add_picture(buf, Inches(1), Inches(1.6), width=Inches(8))
# Slide 4: Edit text on an existing slide (example: update slide 2 title)
prs.slides[1].shapes.title.text = "Machine Learning: Definition & Types"
# Slide 5: Summary
slide = prs.slides.add_slide(prs.slide_layouts[1])
slide.shapes.title.text = "Summary"
tf = slide.shapes.placeholders[1].text_frame
tf.clear()
tf.text = "Key takeaways"
for bullet in [
"ML learns from data to make predictions or decisions",
"Model choice depends on task and constraints",
"Evaluation and iteration are essential",
]:
p = tf.add_paragraph()
p.text = bullet
prs.save(output_path)
def list_slide_titles(pptx_path: str) -> list[str]:
prs = Presentation(pptx_path)
titles = []
for slide in prs.slides:
title_shape = slide.shapes.title if hasattr(slide.shapes, "title") else None
if title_shape is not None and getattr(title_shape, "text", "").strip():
titles.append(title_shape.text.strip())
else:
titles.append("(no title)")
return titles
if __name__ == "__main__":
out = "machine_learning.pptx"
create_presentation(out)
print("Created:", out)
print("Slide titles:", list_slide_titles(out))python-pptx to read/write the Open XML .pptx format.prs.slide_layouts[0] for title slide, prs.slide_layouts[1] for title+content). Layout availability can vary by template.TextFrame and Paragraph objects. Clearing and rebuilding a text frame is a common approach to ensure consistent bullet structure.requests.Pillow (e.g., converting to PNG) before embedding to improve compatibility.Inches(x)) and optional sizing parameters.slide.shapes.title when present; some slides may not have a title placeholder.python-pptx does not natively render slides to images or PDF. Thumbnail/PDF export generally requires external rendering (commonly LibreOffice in headless mode).pptx_skill_result.md unless the skill documentation defines a better convention.Run this minimal verification path before full execution when possible:
python scripts/__init__.py --helpExpected output format:
Result file: pptx_skill_result.md
Validation summary: PASS/FAIL with brief notes
Assumptions: explicit list if any63c61d3
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.