pptx
PPTX creation, editing, and analysis
Overview
A .pptx file is a ZIP archive containing XML files and resources. Create, edit, or analyze PowerPoint presentations using text extraction, raw XML access, or html2pptx workflows. Apply this skill for programmatic presentation creation and modification.
Visual Enhancement with Project Diagrams
When creating documents with this skill, always consider adding diagrams to enhance visual communication.
If your document does not already contain diagrams:
- Use the project-diagrams skill to generate AI-powered publication-quality diagrams
- Simply describe your desired diagram in natural language
python .claude/skills/project-diagrams/scripts/generate_schematic.py "your diagram description" -o figures/output.png
When to add schematics: Presentation workflow diagrams, slide design process flowcharts, content organization diagrams, system architecture illustrations, process flow visualizations.
Reading and analyzing content
Text extraction
python -m markitdown path-to-file.pptx
Raw XML access
Raw XML access is required for: comments, speaker notes, slide layouts, animations, design elements, and complex formatting. Unpack a presentation and read its raw XML contents.
Unpacking a file
python ooxml/scripts/unpack.py <office_file> <output_dir>
Note: The unpack.py script is located at skills/pptx/ooxml/scripts/unpack.py relative to the project root. If the script doesn't exist at this path, use find . -name "unpack.py" to locate it.
Key file structures
ppt/presentation.xml- Main presentation metadata and slide referencesppt/slides/slide{N}.xml- Individual slide contentsppt/notesSlides/notesSlide{N}.xml- Speaker notes for each slideppt/comments/modernComment_*.xml- Comments for specific slidesppt/slideLayouts/- Layout templatesppt/slideMasters/- Master slide templatesppt/theme/- Theme and styling informationppt/media/- Images and other media files
Typography and color extraction
When given an example design to emulate: Always analyze the presentation's typography and colors first:
- Read theme file: Check
ppt/theme/theme1.xmlfor colors (<a:clrScheme>) and fonts (<a:fontScheme>) - Sample slide content: Examine
ppt/slides/slide1.xmlfor actual font usage (<a:rPr>) and colors - Search for patterns: Use grep to find color (
<a:solidFill>,<a:srgbClr>) and font references across all XML files
Creating a new PowerPoint presentation without a template
Use the html2pptx workflow to convert HTML slides to PowerPoint with accurate positioning.
Design Principles
CRITICAL: Before creating any presentation, analyze the content and choose appropriate design elements:
- Consider the subject matter: What tone, industry, or mood does it suggest?
- Check for branding: If the user mentions a company/organization, consider their brand colors
- Match palette to content: Select colors that reflect the subject
- State your approach: Explain your design choices before writing code
Requirements:
- State your content-informed design approach BEFORE writing code
- Use web-safe fonts only: Arial, Helvetica, Times New Roman, Georgia, Courier New, Verdana, Tahoma, Trebuchet MS, Impact
- Create clear visual hierarchy through size, weight, and color
- Ensure readability: strong contrast, appropriately sized text, clean alignment
- Be consistent: repeat patterns, spacing, and visual language across slides
For color palette options (18 curated palettes), visual detail options (geometric patterns, border treatments, typography treatments, chart styling, layout innovations, background treatments), see references/design_reference.md.
Layout Tips
For slides with charts or tables:
- Two-column layout (PREFERRED): Header spanning full width, then two columns below - text/bullets in one, featured content in the other. Use flexbox with unequal column widths (e.g., 40%/60%)
- Full-slide layout: Let featured content take up entire slide for maximum impact
- NEVER vertically stack: Do not place charts/tables below text in a single column
Workflow
- MANDATORY - READ ENTIRE FILE: Read
html2pptx.mdcompletely from start to finish. NEVER set any range limits when reading this file. - Create an HTML file for each slide with proper dimensions (e.g., 720pt x 405pt for 16:9)
- Use
<p>,<h1>-<h6>,<ul>,<ol>for all text content - Use
class="placeholder"for chart/table areas - CRITICAL: Rasterize gradients and icons as PNG images FIRST using Sharp
- LAYOUT: Use full-slide or two-column layout for slides with charts/tables/images
- Use
- Create and run a JavaScript file using
html2pptx.jsto convert HTML slides to PowerPoint - Visual validation: Generate thumbnails and inspect for layout issues
- Create thumbnail grid:
python .claude/skills/document-skills/pptx/scripts/thumbnail.py output.pptx workspace/thumbnails --cols 4 - Check for: text cutoff, text overlap, positioning issues, contrast issues
- If issues found, adjust HTML and regenerate
- Create thumbnail grid:
Editing an existing PowerPoint presentation
Work with the raw Office Open XML (OOXML) format: unpack, edit XML, repack.
Workflow
- MANDATORY - READ ENTIRE FILE: Read
ooxml.md(~500 lines) completely from start to finish. NEVER set any range limits when reading this file. - Unpack:
python ooxml/scripts/unpack.py <office_file> <output_dir> - Edit the XML files (primarily
ppt/slides/slide{N}.xml) - CRITICAL: Validate after each edit:
python ooxml/scripts/validate.py <dir> --original <file> - Pack:
python ooxml/scripts/pack.py <input_directory> <office_file>
Creating a new PowerPoint presentation using a template
Duplicate and re-arrange template slides before replacing placeholder content.
Workflow
-
Extract template text AND create visual thumbnail grid:
python -m markitdown template.pptx > template-content.md- Read
template-content.mdcompletely python .claude/skills/document-skills/pptx/scripts/thumbnail.py template.pptx
-
Analyze template and save inventory:
- Review thumbnails for layout patterns, design, visual structure
- Save
template-inventory.mdwith slide index, layout code, and description for every slide - IMPORTANT: Slides are 0-indexed (first slide = 0)
-
Create presentation outline:
- Match layout structure to actual content (single-column, two-column, three-column as appropriate)
- Count actual content pieces BEFORE selecting layouts
- Never use layouts with more placeholders than available content
- Save
outline.mdwith template mapping
-
Rearrange slides:
python scripts/rearrange.py template.pptx working.pptx 0,34,34,50,52 -
Extract text inventory:
python scripts/inventory.py working.pptx text-inventory.json- Read the entire text-inventory.json file
-
Generate replacement text and save to
replacement-text.json:- Verify which shapes exist in inventory before referencing them
- Shapes without "paragraphs" in replacement JSON are cleared automatically
- Include paragraph properties (bold, bullet, alignment, font) from original
- When
bullet: true, do NOT include bullet symbols in text - When
bullet: true, do NOT set alignment (auto left-aligned)
"paragraphs": [ {"text": "Title text", "alignment": "CENTER", "bold": true}, {"text": "Bullet point", "bullet": true, "level": 0}, {"text": "Regular text"} ] -
Apply replacements:
python scripts/replace.py working.pptx replacement-text.json output.pptx
Creating Thumbnail Grids
python .claude/skills/document-skills/pptx/scripts/thumbnail.py template.pptx [output_prefix]
- Default: 5 columns, max 30 slides per grid (5x6)
- Custom columns:
--cols 4(range: 3-6) - Grid limits: 3 cols = 12 slides/grid, 4 cols = 20, 5 cols = 30, 6 cols = 42
- Slides are zero-indexed
Converting Slides to Images
# Convert PPTX to PDF, then PDF pages to JPEG
soffice --headless --convert-to pdf template.pptx
pdftoppm -jpeg -r 150 template.pdf slide
# Specific range: pdftoppm -jpeg -r 150 -f 2 -l 5 template.pdf slide
Code Style Guidelines
IMPORTANT: Write concise code. Avoid verbose variable names, redundant operations, and unnecessary print statements.
Dependencies
- markitdown:
pip install "markitdown[pptx]"(text extraction) - pptxgenjs:
npm install -g pptxgenjs(creating presentations) - playwright:
npm install -g playwright(HTML rendering) - react-icons:
npm install -g react-icons react react-dom(icons) - sharp:
npm install -g sharp(SVG rasterization) - LibreOffice:
sudo apt-get install libreoffice(PDF conversion) - Poppler:
sudo apt-get install poppler-utils(pdftoppm) - defusedxml:
pip install defusedxml(secure XML parsing)
More from flight505/claude-project-planner
project-diagrams
Create publication-quality architecture diagrams using Nano Banana Pro AI or Mermaid. Specialized in system architecture, C4 diagrams, data flow, sequence diagrams, and software design visualizations for project planning.
17risk-assessment
Project risk assessment toolkit. Identify technical, business, resource, and external risks, score likelihood and impact, define mitigation strategies and contingency plans for comprehensive risk management.
3