PPTX creation, editing, and analysis
Creating from Topic (Content-First)
For generating complete decks from a topic, document, or brief, use the content-first workflow built on the Pyramid Principle (conclusion, reasons, evidence):
- Intake: Use questionnaire at
references/content-workflow/INTAKE.md
- Follow 9-stage workflow:
references/content-workflow/WORKFLOW.md
- Score with rubric (must reach 75+):
references/content-workflow/RUBRIC.md
Content-First Reference Files
| File |
Purpose |
INTAKE.md |
Questionnaire to gather requirements |
WORKFLOW.md |
9-stage content generation process |
TEMPLATES.md |
Slide layout templates |
VIS-GUIDE.md |
Chart and visualisation selection |
STYLE-GUIDE.md |
WCAG 2.1 AA compliance, typography |
RUBRIC.md |
Quality scoring (10 dimensions, 75+ to pass) |
CHECKLIST.md |
Pre-delivery verification |
ORCHESTRATION_OVERVIEW.md |
High-level orchestration map across the 9 stages |
ORCHESTRATION_PPTX.md |
Slide-build orchestration (HTML, layout, packaging) |
ORCHESTRATION_DATA_CHARTS.md |
Chart and data-visual orchestration (chartkit) |
EXAMPLES.md |
Sample presentations |
Chart Generation
For data-driven charts, use chartkit:
Supported chart types: line, area, bar, barh, scatter, hist, waterfall
Reading and analysing content
Text extraction
To read text contents, convert the document to markdown:
Raw XML access
Raw XML access is needed for: comments, speaker notes, slide layouts, animations, design elements, and complex formatting. Unpack the presentation and read its raw XML contents.
Note: The unpack.py script is at skills/pptx/ooxml/scripts/unpack.py relative to the project root. If the script is not at this path, use find . -name "unpack.py" to locate it.
Typography and colour extraction
When given an example design to emulate: Analyse the presentation's typography and colours first:
- Read theme file: Check
ppt/theme/theme1.xml for colours (<a:clrScheme>) and fonts (<a:fontScheme>)
- Sample slide content: Examine
ppt/slides/slide1.xml for actual font usage (<a:rPr>) and colours
- Search for patterns: Use grep to find colour (
<a:solidFill>, <a:srgbClr>) and font references across all XML files
Creating a new presentation without a template
Use the html2pptx workflow to convert HTML slides to PowerPoint with accurate positioning.
Design Approach
Before creating any presentation, analyse the content and choose appropriate design elements:
- Identify the subject matter: What is this presentation about? What tone, industry, or mood does it suggest?
- Check for branding: If the user mentions a company or organisation, use their brand colours and identity
- Match palette to content: Select colours 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 colour
- Check readability: WCAG 2.1 AA contrast (>= 4.5:1 for body, >= 3:1 for large text), body text >= 18pt, headings >= 28pt, clean alignment
- Repeat patterns, spacing, and visual language across slides
Design Resources
For colour palettes and visual design elements, read:
references/color-palettes.md - 18 curated colour schemes
references/design-elements.md - Geometric patterns, typography, layouts
Layout Tips
When creating slides with charts or tables:
- Two-column layout (preferred): Use a header spanning the full width, then two columns below -- text/bullets in one column and the featured content in the other. Use flexbox with unequal column widths (e.g., 40%/60% split)
- Full-slide layout: Let the featured content take up the entire slide for maximum readability
- Do not vertically stack: Do not place charts/tables below text in a single column -- this causes poor readability and layout issues
Workflow
- Read
references/html2pptx-guide.md completely from start to finish before proceeding
- 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 areas where charts/tables will be added (render with grey background for visibility)
- Rasterise gradients and icons as PNG images first using Sharp, then reference in HTML
- For slides with charts/tables/images, use either full-slide layout or two-column layout
- Create and run a JavaScript file using the
html2pptx.js library to convert HTML slides to PowerPoint and save the presentation
- Use the
html2pptx() function to process each HTML file
- Add charts and tables to placeholder areas using PptxGenJS API
- Save the presentation using
pptx.writeFile()
- Visual validation: Generate thumbnails and inspect for layout issues
Editing an existing presentation
Work with the raw Office Open XML (OOXML) format: unpack the .pptx file, edit the XML content, and repack it.
Workflow
- Read
references/ooxml-reference.md (~500 lines) completely from start to finish before any editing
- Unpack the presentation:
- Edit the XML files (primarily
ppt/slides/slide{N}.xml and related files)
- Validate immediately after each edit:
- Pack the final presentation:
Creating a presentation using a template
Read references/template-workflow.md completely from start to finish. It covers the full 7-step process:
- Extract template text and create visual thumbnail grid
- Analyse template and save inventory to a file
- Create presentation outline based on template inventory
- Duplicate, reorder, and delete slides using
rearrange.py
- Extract all text using
inventory.py
- Generate replacement text and save to JSON
- Apply replacements using
replace.py
Creating Thumbnail Grids
Features:
- Creates:
thumbnails.jpg (or thumbnails-1.jpg, thumbnails-2.jpg, etc. for large decks)
- Default: 5 columns, max 30 slides per grid (5x6)
- Custom prefix:
python scripts/thumbnail.py template.pptx my-grid
- Note: The output prefix should include the path if you want output in a specific directory (e.g.,
workspace/my-grid)
- Adjust columns:
--cols 4 (range: 3-6, affects slides per grid)
- Grid limits: 3 cols = 12 slides/grid, 4 cols = 20, 5 cols = 30, 6 cols = 42
- Slides are zero-indexed (Slide 0, Slide 1, etc.)
Use cases:
- Template analysis: Quickly understand slide layouts and design patterns
- Content review: Visual overview of entire presentation
- Navigation reference: Find specific slides by their visual appearance
- Quality check: Verify all slides are properly formatted
Combine options: custom name, columns
python scripts/thumbnail.py template.pptx analysis --cols 4
</example>
## Converting Slides to Individual Images
For cases where you need individual slide images rather than a grid:
<example>
```bash
# Step 1: Convert PPTX to PDF
soffice --headless --convert-to pdf template.pptx
# Step 2: Convert PDF pages to JPEG images
pdftoppm -jpeg -r 150 template.pdf slide
Creates: slide-1.jpg, slide-2.jpg, etc.
Options: -r 150 (DPI), -jpeg or -png (format), -f N -l N (page range)
Code Style Guidelines
When generating code for PPTX operations, write concise code. Avoid verbose variable names, redundant operations, and unnecessary print statements.
Dependencies
Required dependencies (should already be installed):
| Package |
Install (pip) |
Install (npm) |
Purpose |
| markitdown |
pip install "markitdown[pptx]" |
-- |
Text extraction from presentations |
| pptxgenjs |
-- |
npm install -g pptxgenjs |
Creating presentations via html2pptx |
| playwright |
-- |
npm install -g playwright |
HTML rendering in html2pptx |
| react-icons |
-- |
npm install -g react-icons react react-dom |
Icons |
| sharp |
-- |
npm install -g sharp |
SVG rasterisation and image processing |
| defusedxml |
pip install defusedxml |
-- |
Secure XML parsing |
| LibreOffice |
System package: brew install libreoffice (macOS) or apt-get install libreoffice (Linux) |
-- |
PDF conversion |
| Poppler |
System package: brew install poppler (macOS) or apt-get install poppler-utils (Linux) |
-- |
PDF to image conversion via pdftoppm |
1---2name: pptx3description: Creates, edits, and analyses PowerPoint presentations with layouts, speaker notes, and design elements. Use when working with .pptx files, creating presentations from topics, modifying slides, or extracting content. Triggers: 'create presentation from topic', 'slide deck from document', 'powerpoint from scratch'.4license: MIT5---67# PPTX creation, editing, and analysis89<context>10A .pptx file is a ZIP archive containing XML files and other resources. This skill provides different workflows for creating, editing, and analysing presentations.11</context>1213## Creating from Topic (Content-First)1415For generating complete decks from a topic, document, or brief, use the content-first workflow built on the **Pyramid Principle** (conclusion, reasons, evidence):16171. **Intake**: Use questionnaire at `references/content-workflow/INTAKE.md`182. **Follow 9-stage workflow**: `references/content-workflow/WORKFLOW.md`193. **Score with rubric** (must reach 75+): `references/content-workflow/RUBRIC.md`2021### Content-First Reference Files2223| File | Purpose |24|------|---------|25| `INTAKE.md` | Questionnaire to gather requirements |26| `WORKFLOW.md` | 9-stage content generation process |27| `TEMPLATES.md` | Slide layout templates |28| `VIS-GUIDE.md` | Chart and visualisation selection |29| `STYLE-GUIDE.md` | WCAG 2.1 AA compliance, typography |30| `RUBRIC.md` | Quality scoring (10 dimensions, 75+ to pass) |31| `CHECKLIST.md` | Pre-delivery verification |32| `ORCHESTRATION_OVERVIEW.md` | High-level orchestration map across the 9 stages |33| `ORCHESTRATION_PPTX.md` | Slide-build orchestration (HTML, layout, packaging) |34| `ORCHESTRATION_DATA_CHARTS.md` | Chart and data-visual orchestration (chartkit) |35| `EXAMPLES.md` | Sample presentations |3637### Chart Generation3839For data-driven charts, use chartkit:4041<example>42```bash43python scripts/chartkit.py \44 --data data.csv \45 --type line \46 --x date \47 --y sales profit \48 --out output/assets \49 --filename kpi_trend.png \50 --title "Monthly KPIs"51```52Creates: `kpi_trend.png` line chart in output/assets53</example>5455Supported chart types: `line`, `area`, `bar`, `barh`, `scatter`, `hist`, `waterfall`5657## Reading and analysing content5859### Text extraction6061To read text contents, convert the document to markdown:6263<example>64```bash65python -m markitdown path-to-file.pptx66```67Outputs: Markdown text content from all slides68</example>6970### Raw XML access7172Raw XML access is needed for: comments, speaker notes, slide layouts, animations, design elements, and complex formatting. Unpack the presentation and read its raw XML contents.7374<example>75```bash76python ooxml/scripts/unpack.py presentation.pptx unpacked/77```78Creates: Directory with extracted XML files and media79</example>8081**Note**: The unpack.py script is at `skills/pptx/ooxml/scripts/unpack.py` relative to the project root. If the script is not at this path, use `find . -name "unpack.py"` to locate it.8283<context>84#### Key file structures85* `ppt/presentation.xml` - Main presentation metadata and slide references86* `ppt/slides/slide{N}.xml` - Individual slide contents (slide1.xml, slide2.xml, etc.)87* `ppt/notesSlides/notesSlide{N}.xml` - Speaker notes for each slide88* `ppt/comments/modernComment_*.xml` - Comments for specific slides89* `ppt/slideLayouts/` - Layout templates for slides90* `ppt/slideMasters/` - Master slide templates91* `ppt/theme/` - Theme and styling information92* `ppt/media/` - Images and other media files93</context>9495#### Typography and colour extraction9697**When given an example design to emulate**: Analyse the presentation's typography and colours first:98991. **Read theme file**: Check `ppt/theme/theme1.xml` for colours (`<a:clrScheme>`) and fonts (`<a:fontScheme>`)1002. **Sample slide content**: Examine `ppt/slides/slide1.xml` for actual font usage (`<a:rPr>`) and colours1013. **Search for patterns**: Use grep to find colour (`<a:solidFill>`, `<a:srgbClr>`) and font references across all XML files102103## Creating a new presentation without a template104105<instructions>106107Use the **html2pptx** workflow to convert HTML slides to PowerPoint with accurate positioning.108109### Design Approach110111Before creating any presentation, analyse the content and choose appropriate design elements:1121131. **Identify the subject matter**: What is this presentation about? What tone, industry, or mood does it suggest?1142. **Check for branding**: If the user mentions a company or organisation, use their brand colours and identity1153. **Match palette to content**: Select colours that reflect the subject1164. **State your approach**: Explain your design choices before writing code117118**Requirements**:119- State your content-informed design approach before writing code120- Use web-safe fonts only: Arial, Helvetica, Times New Roman, Georgia, Courier New, Verdana, Tahoma, Trebuchet MS, Impact121- Create clear visual hierarchy through size, weight, and colour122- Check readability: WCAG 2.1 AA contrast (>= 4.5:1 for body, >= 3:1 for large text), body text >= 18pt, headings >= 28pt, clean alignment123- Repeat patterns, spacing, and visual language across slides124125#### Design Resources126127For colour palettes and visual design elements, read:128- `references/color-palettes.md` - 18 curated colour schemes129- `references/design-elements.md` - Geometric patterns, typography, layouts130131### Layout Tips132133**When creating slides with charts or tables:**134- **Two-column layout (preferred)**: Use a header spanning the full width, then two columns below -- text/bullets in one column and the featured content in the other. Use flexbox with unequal column widths (e.g., 40%/60% split)135- **Full-slide layout**: Let the featured content take up the entire slide for maximum readability136- **Do not vertically stack**: Do not place charts/tables below text in a single column -- this causes poor readability and layout issues137138### Workflow1391401. Read [`references/html2pptx-guide.md`](references/html2pptx-guide.md) completely from start to finish before proceeding1412. Create an HTML file for each slide with proper dimensions (e.g., 720pt x 405pt for 16:9)142 - Use `<p>`, `<h1>`-`<h6>`, `<ul>`, `<ol>` for all text content143 - Use `class="placeholder"` for areas where charts/tables will be added (render with grey background for visibility)144 - Rasterise gradients and icons as PNG images first using Sharp, then reference in HTML145 - For slides with charts/tables/images, use either full-slide layout or two-column layout1463. Create and run a JavaScript file using the [`html2pptx.js`](scripts/html2pptx.js) library to convert HTML slides to PowerPoint and save the presentation147 - Use the `html2pptx()` function to process each HTML file148 - Add charts and tables to placeholder areas using PptxGenJS API149 - Save the presentation using `pptx.writeFile()`1504. **Visual validation**: Generate thumbnails and inspect for layout issues151 <example>152 ```bash153 python scripts/thumbnail.py output.pptx workspace/thumbnails --cols 4154 ```155 Creates: `workspace/thumbnails.jpg` grid for visual validation156 </example>157 - Read and examine the thumbnail image for:158 - **Text cutoff**: Text being cut off by header bars, shapes, or slide edges159 - **Text overlap**: Text overlapping with other text or shapes160 - **Positioning issues**: Content too close to slide boundaries or other elements161 - **Contrast issues**: Insufficient contrast between text and backgrounds162 - If issues found, adjust HTML margins/spacing/colours and regenerate the presentation163 - Repeat until all slides are visually correct164165</instructions>166167## Editing an existing presentation168169<instructions>170171Work with the raw Office Open XML (OOXML) format: unpack the .pptx file, edit the XML content, and repack it.172173### Workflow1741751. Read [`references/ooxml-reference.md`](references/ooxml-reference.md) (~500 lines) completely from start to finish before any editing1762. Unpack the presentation:177 <example>178 ```bash179 python ooxml/scripts/unpack.py presentation.pptx unpacked/180 ```181 </example>1823. Edit the XML files (primarily `ppt/slides/slide{N}.xml` and related files)1834. Validate immediately after each edit:184 <example>185 ```bash186 python ooxml/scripts/validate.py unpacked/ --original presentation.pptx187 ```188 </example>1895. Pack the final presentation:190 <example>191 ```bash192 python ooxml/scripts/pack.py unpacked/ output.pptx193 ```194 </example>195196</instructions>197198## Creating a presentation using a template199200<instructions>201202Read [`references/template-workflow.md`](references/template-workflow.md) completely from start to finish. It covers the full 7-step process:2032041. Extract template text and create visual thumbnail grid2052. Analyse template and save inventory to a file2063. Create presentation outline based on template inventory2074. Duplicate, reorder, and delete slides using `rearrange.py`2085. Extract all text using `inventory.py`2096. Generate replacement text and save to JSON2107. Apply replacements using `replace.py`211212</instructions>213214## Creating Thumbnail Grids215216<example>217```bash218python scripts/thumbnail.py template.pptx [output_prefix]219```220Creates: `thumbnails.jpg` (or `output_prefix.jpg` if specified)221</example>222223**Features**:224- Creates: `thumbnails.jpg` (or `thumbnails-1.jpg`, `thumbnails-2.jpg`, etc. for large decks)225- Default: 5 columns, max 30 slides per grid (5x6)226- Custom prefix: `python scripts/thumbnail.py template.pptx my-grid`227 - Note: The output prefix should include the path if you want output in a specific directory (e.g., `workspace/my-grid`)228- Adjust columns: `--cols 4` (range: 3-6, affects slides per grid)229- Grid limits: 3 cols = 12 slides/grid, 4 cols = 20, 5 cols = 30, 6 cols = 42230- Slides are zero-indexed (Slide 0, Slide 1, etc.)231232**Use cases**:233- Template analysis: Quickly understand slide layouts and design patterns234- Content review: Visual overview of entire presentation235- Navigation reference: Find specific slides by their visual appearance236- Quality check: Verify all slides are properly formatted237238<example>239```bash240# Basic usage241python scripts/thumbnail.py presentation.pptx242243# Combine options: custom name, columns244python scripts/thumbnail.py template.pptx analysis --cols 4245```246</example>247248## Converting Slides to Individual Images249250For cases where you need individual slide images rather than a grid:251252<example>253```bash254# Step 1: Convert PPTX to PDF255soffice --headless --convert-to pdf template.pptx256257# Step 2: Convert PDF pages to JPEG images258pdftoppm -jpeg -r 150 template.pdf slide259```260Creates: `slide-1.jpg`, `slide-2.jpg`, etc.261</example>262263Options: `-r 150` (DPI), `-jpeg` or `-png` (format), `-f N -l N` (page range)264265## Code Style Guidelines266267When generating code for PPTX operations, write concise code. Avoid verbose variable names, redundant operations, and unnecessary print statements.268269## Dependencies270271Required dependencies (should already be installed):272273| Package | Install (pip) | Install (npm) | Purpose |274|---------|--------------|---------------|---------|275| markitdown | `pip install "markitdown[pptx]"` | -- | Text extraction from presentations |276| pptxgenjs | -- | `npm install -g pptxgenjs` | Creating presentations via html2pptx |277| playwright | -- | `npm install -g playwright` | HTML rendering in html2pptx |278| react-icons | -- | `npm install -g react-icons react react-dom` | Icons |279| sharp | -- | `npm install -g sharp` | SVG rasterisation and image processing |280| defusedxml | `pip install defusedxml` | -- | Secure XML parsing |281| LibreOffice | System package: `brew install libreoffice` (macOS) or `apt-get install libreoffice` (Linux) | -- | PDF conversion |282| Poppler | System package: `brew install poppler` (macOS) or `apt-get install poppler-utils` (Linux) | -- | PDF to image conversion via pdftoppm |