$npx -y skills add proyecto26/slides-ai-plugin --skill pptx-slidesUsed when the user asks to "create a PowerPoint", "generate PPTX slides", "make a PowerPoint presentation", "build a .pptx deck", "create editable slides", "PptxGenJS", "editable presentation", "corporate deck", "slide deck for sharing", or when the output format is PPTX for any
| 1 | # PPTX Slides — Programmatic PowerPoint Generation |
| 2 | |
| 3 | Generate professional, editable PowerPoint presentations using PptxGenJS (Node.js). Produces OOXML-compliant `.pptx` files with precise layout, text measurement, and overlap validation. |
| 4 | |
| 5 | ## Bundled Helpers |
| 6 | |
| 7 | Every PPTX generation script imports the bundled TypeScript helper modules via bun: |
| 8 | |
| 9 | ```typescript |
| 10 | import pptxgen from 'pptxgenjs'; |
| 11 | import * as h from '${CLAUDE_PLUGIN_ROOT}/skills/pptx-slides/scripts/main.ts'; |
| 12 | const pptx = new pptxgen(); |
| 13 | pptx.layout = 'LAYOUT_16x9'; // 10" × 5.625" |
| 14 | ``` |
| 15 | |
| 16 | Run generation scripts with bun (no build step needed): |
| 17 | ```bash |
| 18 | npx -y bun ${CLAUDE_PLUGIN_ROOT}/skills/pptx-slides/scripts/main.ts theme list |
| 19 | ``` |
| 20 | |
| 21 | Dependencies (`skia-canvas`, `fontkit`, `linebreak`, `prismjs`) are auto-installed by bun on first run — no manual install step needed. |
| 22 | |
| 23 | ### Module Summary |
| 24 | |
| 25 | | Module | Key Exports | Purpose | |
| 26 | |--------|-------------|---------| |
| 27 | | **text** | `autoFontSize()`, `calcTextBoxHeightSimple()`, `scale()` | Font-aware text measurement via skia-canvas, adaptive sizing | |
| 28 | | **theme** | `createTheme()`, `PRESETS`, `sectionBackground()` | Design token system with 12 curated presets | |
| 29 | | **layout** | `warnIfSlideHasOverlaps()`, `alignSlideElements()`, `distributeSlideElements()` | Overlap detection, bounds checking, positioning | |
| 30 | | **layout_builders** | `addFeatureGrid()`, `addCardRow()`, `addTimeline()`, `addMetricsRow()`, `addComparisonTable()` | High-level component builders | |
| 31 | | **decorative** | `addStaircase()`, `addSectionBadge()`, `addProgressBar()`, `addSlideNumber()` | Visual personality elements | |
| 32 | | **validation** | `validateDeck()` | Consolidated pre-save quality validation | |
| 33 | | **code** | `codeToRuns()` | Prism.js syntax highlighting to PptxGenJS text runs | |
| 34 | | **image** | `getImageDimensions()`, `imageSizingCrop()`, `imageSizingContain()` | Binary dimension detection and aspect-ratio sizing | |
| 35 | | **svg** | `svgToDataUri()` | SVG sanitization and base64 data URI encoding | |
| 36 | | **util** | `safeOuterShadow()`, `normalizeColor()`, `inchesToEmu()` | Shadow effects, color/unit conversion | |
| 37 | |
| 38 | ## Theme Selection |
| 39 | |
| 40 | Pick a curated preset or create a custom theme: |
| 41 | |
| 42 | ```javascript |
| 43 | // Use a preset |
| 44 | const theme = h.createTheme(h.PRESETS.darkMonospace); |
| 45 | |
| 46 | // Or customize |
| 47 | const theme = h.createTheme({ |
| 48 | accent: 'ff6b35', |
| 49 | font: { heading: 'Poppins', body: 'Inter' }, |
| 50 | }); |
| 51 | ``` |
| 52 | |
| 53 | **Available presets**: darkMonospace, swissModern, boldSignal, darkBotanical, cleanCorporate, neonCyber, warmMinimal, vintageEditorial, terminalGreen, gradientWave, midnightBlue, paperInk. |
| 54 | |
| 55 | For mixed-background decks, define a section map: |
| 56 | ```javascript |
| 57 | const sectionMap = { '0': 'brand', '1-3': 'light', '4-8': 'default' }; |
| 58 | const colors = { brand: theme.accent, light: theme.bg.secondary, default: theme.bg.primary }; |
| 59 | slide.background = { color: h.sectionBackground(slideIndex, sectionMap, colors) }; |
| 60 | ``` |
| 61 | |
| 62 | ### Adaptive Font Sizing |
| 63 | |
| 64 | Use `scale()` instead of hardcoded font sizes — the PPTX equivalent of CSS `clamp()`: |
| 65 | |
| 66 | ```javascript |
| 67 | const titleSize = h.scale(theme.size.title.min, theme.size.title.max, { bullets: 0, textLength: title.length }); |
| 68 | const bodySize = h.scale(theme.size.body.min, theme.size.body.max, { bullets: 5, textLength: 800 }); |
| 69 | ``` |
| 70 | |
| 71 | For precise text box fitting, use `autoFontSize()` with skia-canvas measurement: |
| 72 | ```javascript |
| 73 | const opts = h.autoFontSize('Long paragraph text...', 'Arial', { w: 8, h: 3, minFontSize: 14, maxFontSize: 28 }); |
| 74 | slide.addText(text, { x: 1, y: 1.5, ...opts }); |
| 75 | ``` |
| 76 | |
| 77 | ## Generation Workflow |
| 78 | |
| 79 | 1. **Plan layout** — Map content outline to slide types from `references/slide-patterns.md` |
| 80 | 2. **Select theme** — Pick preset or define custom theme tokens |
| 81 | 3. **Generate slides** — Build with helpers: `addFeatureGrid()`, `addCardRow()`, etc. |
| 82 | 4. **Validate** — Run `h.validateDeck(pptx)` before saving |
| 83 | 5. **Fix issues** — Adjust based on validation report, re-validate |
| 84 | 6. **Deliver** — Provide `.pptx` file with speaker notes on every content slide |
| 85 | |
| 86 | ## Core Design Rules |
| 87 | |
| 88 | ### Typography |
| 89 | - **Minimum body text**: 18pt (24-28pt preferred). Use `scale()` for adaptive sizing. |
| 90 | - **Title text**: 36-44pt |
| 91 | - **Caption/footnote**: 14-16pt minimum (absolute floor: 14pt) |
| 92 | - **Font families**: Use `h.resolveFont(theme, 'heading')` for proper fallback chains |
| 93 | |
| 94 | ### Layout |
| 95 | - **Slide dimensions**: 10" × 5.625" (widescreen 16:9) |
| 96 | - **Safe margins**: 0.5" from all edges (`theme.spacing.margin`) |
| 97 | - **W |