Skills for Claude Code CLI such as full stack dev Cloudflare, React, Tailwind v4, and AI integrations.
Python aianthropicautomationclaude-codeclaude-skillscloudflaredevtoolsproductivityreactskillstailwindvite
feat(office): Add PPTX support and office-docs agent
Jezbdf3afa80959
diff --git a/skills/office/.claude-plugin/plugin.json b/skills/office/.claude-plugin/plugin.jsonindex b13fc1ec..54968373 100644--- a/skills/office/.claude-plugin/plugin.json+++ b/skills/office/.claude-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "office",- "description": "Generate Office documents (DOCX, XLSX, PDF) with TypeScript. Pure JS libraries that work everywhere: Claude Code CLI, Cloudflare Workers, browsers. Uses docx (Word), xlsx/SheetJS (Excel), pdf-lib (PDF). Use when: creating invoices, reports, spreadsheets, form filling, exporting data to Office formats, or troubleshooting Packer.toBuffer, XLSX.utils, PDFDocument errors.",- "version": "1.0.0",+ "description": "Generate Office documents (DOCX, XLSX, PDF, PPTX) with TypeScript. Pure JS libraries that work everywhere: Claude Code CLI, Cloudflare Workers, browsers. Uses docx (Word), xlsx/SheetJS (Excel), pdf-lib (PDF), pptxgenjs (PowerPoint). Use when: creating presentations, invoices, reports, spreadsheets, or troubleshooting Packer.toBuffer, XLSX.utils, PDFDocument, pptxgenjs errors.",+ "version": "1.1.0","author": {"name": "Jeremy Dawes","email": "[email protected]"@@ -12,14 +12,19 @@"docx","xlsx","pdf",+ "pptx","office","word","excel",+ "powerpoint","spreadsheet",+ "presentation","document","invoice","report",+ "slides","pdf-lib",+ "pptxgenjs","sheetjs","cloudflare-workers"]diff --git a/skills/office/SKILL.md b/skills/office/SKILL.mdindex 7d2e7c94..079cd871 100644--- a/skills/office/SKILL.md+++ b/skills/office/SKILL.md@@ -1,9 +1,9 @@---name: officedescription: |- Generate Office documents (DOCX, XLSX, PDF) with TypeScript. Pure JS libraries that work everywhere: Claude Code CLI, Cloudflare Workers, browsers. Uses docx (Word), xlsx/SheetJS (Excel), pdf-lib (PDF).+ Generate Office documents (DOCX, XLSX, PDF, PPTX) with TypeScript. Pure JS libraries that work everywhere: Claude Code CLI, Cloudflare Workers, browsers. Uses docx (Word), xlsx/SheetJS (Excel), pdf-lib (PDF), pptxgenjs (PowerPoint).- Use when: creating invoices, reports, spreadsheets, form filling, exporting data to Office formats, or troubleshooting "Packer.toBuffer", "XLSX.utils", "PDFDocument" errors.+ Use when: creating invoices, reports, spreadsheets, presentations, form filling, exporting data to Office formats, or troubleshooting "Packer.toBuffer", "XLSX.utils", "PDFDocument", "pptxgenjs" errors.---# Office Document Generation@@ -11,7 +11,7 @@ description: |**Status**: Production Ready**Last Updated**: 2026-01-12**Dependencies**: None (pure JavaScript libraries)---@@ -24,6 +24,9 @@ Generate Microsoft Office documents and PDFs programmatically with TypeScript. A| **DOCX** | `docx` | ✅ | ✅ | ✅ || **XLSX** | `xlsx` (SheetJS) | ✅ | ✅ | ✅ || **PDF** | `pdf-lib` | ✅ | ✅ | ✅ |+| **PPTX** | `pptxgenjs` | ⚠️* | ✅ | ✅ |++*PPTX in Workers: Works for local images/data. Remote image fetching needs workaround (uses `https` module).---@@ -32,8 +35,8 @@ Generate Microsoft Office documents and PDFs programmatically with TypeScript. A### Installation```bash-# Install all three (or pick what you need)-npm install docx xlsx pdf-lib+# Install all four (or pick what you need)+npm install docx xlsx pdf-lib pptxgenjs```### Create a Word Document (30 seconds)@@ -109,6 +112,29 @@ const pdfBytes = await pdfDoc.save();writeFileSync('hello.pdf', pdfBytes);```+### Create a PowerPoint (30 seconds)++```typescript+import pptxgen from 'pptxgenjs';++const pptx = new pptxgen();+pptx.author = 'Your Name';+pptx.title = 'Sample Presentation';++// Add a slide+const slide = pptx.addSlide();+slide.addText('Hello World', {+ x: 1, y: 1, w: 8, h: 1.5,+ fontSize: 36, bold: true, color: '363636',+});++// Node.js: Save to file+await pptx.writeFile({ fileName: 'hello.pptx' });++// Browser: Trigger download+await pptx.writeFile({ fileName: 'hello.pptx' });+```+---## DOCX: Word Documents@@ -451,9 +477,211 @@ const mergedBytes = await mergedPdf.save();---+## PPTX: PowerPoint Presentations++### Key Concepts++pptxgenjs uses a slide-based approach:+- **Presentation** - The PPTX file (new pptxgen())+- **Slide** - Individual slide (addSlide())+- **Elements** - Text, images, shapes, tables, charts+- **Units** - Inches by default (can change to cm/points)++### Basic Presentation++```typescript+import pptxgen from 'pptxgenjs';++const pptx = new pptxgen();+pptx.author = 'Author Name';+pptx.title = 'Presentation Title';+pptx.subject = 'Subject';+pptx.company = 'Company';++// Title slide+const titleSlide = pptx.addSlide();+titleSlide.addText('Quarterly Report', {+ x: 0.5, y: 2, w: 9, h: 1,+ fontSize: 44, bold: true, color: '0066CC', align: 'center',+});+titleSlide.addText('Q1 2026', {+ x: 0.5, y: 3.5, w: 9, h: 0.5,+ fontSize: 24, color: '666666', align: 'center',+});+```++### Slide with Bullet Points++```typescript+const contentSlide = pptx.addSlide();++// Title+contentSlide.addText('Key Highlights', {+ x: 0.5, y: 0.5, w: 9, h: 0.8,+ fontSize: 32, bold: true, color: '333333',+});++// Bullet points+contentSlide.addText([+ { text: 'Revenue up 25% YoY', options: { bullet: true, fontSize: 20 } },+ { text: 'Customer base grew to 10,000', options: { bullet: true, fontSize: 20 } },+ { text: 'New product launch successful', options: { bullet: true, fontSize: 20 } },+ { text: 'Expanded to 5 new markets', options: { bullet: true, fontSize: 20 } },+], { x: 0.5, y: 1.5, w: 8, h: 4, valign: 'top' });+```++### Tables++```typescript+const tableSlide = pptx.addSlide();++tableSlide.addText('Sales Summary', {+ x: 0.5, y: 0.5, w: 9, h: 0.8,+ fontSize: 28, bold: true,+});++const tableData = [+ [{ text: 'Region', options: { bold: true, fill: '0066CC', color: 'FFFFFF' } },+ { text: 'Q1', options: { bold: true, fill: '0066CC', color: 'FFFFFF' } },+ { text: 'Q2', options: { bold: true, fill: '0066CC', color: 'FFFFFF' } }],+ ['North America', '$2.5M', '$2.8M'],+ ['Europe', '$1.8M', '$2.1M'],+ ['Asia Pacific', '$1.2M', '$1.5M'],+];++tableSlide.addTable(tableData, {+ x: 0.5, y: 1.5, w: 9,+ border: { pt: 1, color: 'CCCCCC' },+ fontFace: 'Arial',+ fontSize: 14,+ align: 'center',+ valign: 'middle',+});+```++### Charts++```typescript+const chartSlide = pptx.addSlide();++chartSlide.addText('Revenue Trend', {+ x: 0.5, y: 0.5, w: 9, h: 0.6,+ fontSize: 28, bold: true,+});++chartSlide.addChart(pptx.ChartType.line, [+ { name: 'Revenue', labels: ['Jan', 'Feb', 'Mar', 'Apr'], values: [100, 120, 150, 180] },+ { name: 'Expenses', labels: ['Jan', 'Feb', 'Mar', 'Apr'], values: [80, 85, 90, 95] },+], {+ x: 0.5, y: 1.2, w: 9, h: 4,+ showLegend: true,+ legendPos: 'b',+ showTitle: false,+});+```++### Images++```typescript+import { readFileSync } from 'fs';++const imageSlide = pptx.addSlide();++// From file (Node.js)+imageSlide.addImage({+ path: 'logo.png',+ x: 0.5, y: 0.5, w: 2, h: 1,+});++// From base64+const imageBase64 = readFileSync('chart.png').toString('base64');+imageSlide.addImage({+ data: `image/png;base64,${imageBase64}`,+ x: 0.5, y: 2, w: 4, h: 3,+});++// From URL (Node.js only - uses https module)+imageSlide.addImage({+ path: 'https://example.com/image.png',+ x: 5, y: 2, w: 4, h: 3,+});+```++### Shapes++```typescript+const shapeSlide = pptx.addSlide();++// Rectangle+shapeSlide.addShape(pptx.ShapeType.rect, {+ x: 0.5, y: 0.5, w: 3, h: 2,+ fill: { color: '0066CC' },+ line: { color: '004499', pt: 2 },+});++// Circle/Oval+shapeSlide.addShape(pptx.ShapeType.ellipse, {+ x: 4, y: 0.5, w: 2, h: 2,+ fill: { color: '00AA00' },+});++// Arrow+shapeSlide.addShape(pptx.ShapeType.rightArrow, {+ x: 1, y: 3, w: 3, h: 1,+ fill: { color: 'FF6600' },+});+```++### Slide Layouts and Masters++```typescript+// Define a master slide+pptx.defineSlideMaster({+ title: 'COMPANY_MASTER',+ background: { color: 'FFFFFF' },+ objects: [+ { text: { text: 'Company Name', options: { x: 0.5, y: 0.2, w: 4, h: 0.3, fontSize: 10, color: '999999' } } },+ { line: { x: 0.5, y: 0.6, w: 9, h: 0, line: { color: '0066CC', pt: 2 } } },+ ],+});++// Use the master+const slide = pptx.addSlide({ masterName: 'COMPANY_MASTER' });+```++### Export Patterns++```typescript+// Node.js - Save to file+await pptx.writeFile({ fileName: 'presentation.pptx' });++// Browser - Trigger download+await pptx.writeFile({ fileName: 'presentation.pptx' });++// Get as base64 (for email, API, etc.)+const base64 = await pptx.write({ outputType: 'base64' });++// Get as Blob (browser)+const blob = await pptx.write({ outputType: 'blob' });++// Get as ArrayBuffer+const arrayBuffer = await pptx.write({ outputType: 'arraybuffer' });++// Cloudflare Workers - Return as Response+const arrayBuffer = await pptx.write({ outputType: 'arraybuffer' });+return new Response(arrayBuffer, {+ headers: {+ 'Content-Type': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',+ 'Content-Disposition': 'attachment; filename="presentation.pptx"',+ },+});+```++---+## Cloudflare Workers Integration-All three libraries work in Cloudflare Workers without modification.+All four libraries work in Cloudflare Workers (PPTX with caveats for remote images).### DOCX Generation Endpoint@@ -555,6 +783,8 @@ export default {✅ Use `type: 'buffer'` for XLSX in Workers/browser✅ Embed fonts in PDF before using them✅ Set proper Content-Type headers for downloads+✅ Use `await pptx.writeFile()` or `await pptx.write()` for PPTX+✅ Use base64 images in PPTX for Workers (avoid remote URLs)### Never Do@@ -563,6 +793,7 @@ export default {❌ Use `writeFile` in Workers (use Response instead)❌ Forget to set Content-Disposition for downloads❌ Use Node.js fs module in browser/Workers+❌ Use PPTX path URLs in Workers (https module not available)---@@ -588,6 +819,11 @@ export default {**Why**: Returning wrong type or missing Content-Type header**Prevention**: Return buffer directly with proper headers+### Issue #5: PPTX Remote Images Fail in Workers+**Error**: `https is not defined` or image not appearing+**Why**: pptxgenjs uses Node.js `https` module for remote images+**Prevention**: Use base64 data URIs or local images in Workers environment+---## Using Bundled Resources@@ -597,14 +833,15 @@ export default {- `docx-basic.ts` - Complete Word document with headings, tables, images- `xlsx-basic.ts` - Excel workbook with formulas and formatting- `pdf-basic.ts` - PDF with text, images, shapes-- `pdf-form-fill.ts` - Fill existing PDF forms-- `workers-pdf.ts` - Browser Rendering HTML→PDF example+- `pptx-basic.ts` - PowerPoint with slides, charts, tables+- `workers-pdf.ts` - Cloudflare Workers PDF generation example### References (references/)- `docx-api.md` - Quick reference for docx npm package- `xlsx-api.md` - Quick reference for SheetJS functions- `pdf-lib-api.md` - Quick reference for pdf-lib methods+- `pptxgenjs-api.md` - Quick reference for pptxgenjs### Scripts (scripts/)@@ -618,13 +855,13 @@ This skill focuses on **document creation** with portable TypeScript libraries:| Feature | This Skill | Anthropic's Skills ||---------|------------|-------------------|-| Create DOCX/XLSX/PDF | ✅ | ✅ |+| Create DOCX/XLSX/PDF/PPTX | ✅ | ✅ || Works in Cloudflare Workers | ✅ | ❌ || Plugin installable | ✅ | ❌ |+| TypeScript-first | ✅ | ❌ (Python) || Edit existing DOCX with tracked changes | ❌ | ✅ || Excel formula validation | ❌ | ✅ || OCR scanned PDFs | ❌ | ✅ |-| PowerPoint (PPTX) | ❌ (Phase 2) | ✅ |For advanced editing scenarios (tracked changes, formula validation), consider Anthropic's official skills with Python tooling.@@ -637,7 +874,8 @@ For advanced editing scenarios (tracked changes, formula validation), consider A"dependencies": {"docx": "^9.5.0","xlsx": "^0.18.5",- "pdf-lib": "^1.17.1"+ "pdf-lib": "^1.17.1",+ "pptxgenjs": "^4.0.1"}}```@@ -649,6 +887,7 @@ For advanced editing scenarios (tracked changes, formula validation), consider A- **docx**: https://docx.js.org/- **SheetJS (xlsx)**: https://docs.sheetjs.com/- **pdf-lib**: https://pdf-lib.js.org/+- **pptxgenjs**: https://gitbrent.github.io/PptxGenJS/- **Cloudflare Browser Rendering**: https://developers.cloudflare.com/browser-rendering/---diff --git a/skills/office/agents/office-docs.md b/skills/office/agents/office-docs.mdnew file mode 100644index 00000000..f921f4dc--- /dev/null+++ b/skills/office/agents/office-docs.md@@ -0,0 +1,172 @@+---+name: office-docs+description: "Office document generation specialist. MUST BE USED when generating DOCX, XLSX, PDF, or PPTX files. Use PROACTIVELY for any document generation task to maintain token efficiency."+model: sonnet+tools:+ - Read+ - Write+ - Edit+ - Bash+ - Glob+ - Grep+---++# Office Document Generator Agent++You are a specialized agent for generating Office documents (DOCX, XLSX, PDF, PPTX) with maximum token efficiency.++## Your Role++Generate professional documents WITHOUT outputting large code blocks to the conversation. Read templates, adapt minimally, execute, and report results.++## Token Efficiency Strategy++1. **Read templates** from `~/.claude/skills/office/templates/` (or from installed plugin cache)+2. **Adapt minimally** - only change what's needed for the user's request+3. **Execute silently** - run the script, don't show the code+4. **Report results** - return file path and success/failure only++## Workflow++### Step 1: Identify Document Type++Determine which format the user needs:+- **DOCX** - Word documents (reports, letters, contracts)+- **XLSX** - Excel spreadsheets (data, calculations, tables)+- **PDF** - PDF documents (invoices, certificates, reports)+- **PPTX** - PowerPoint presentations (slides, charts, visuals)++### Step 2: Find Template++Look for existing templates in order:+1. Project-local: `./templates/` or `./scripts/`+2. Skill templates: `~/.claude/skills/office/templates/`+3. Plugin cache: `~/.claude/plugins/cache/*/skills/office/templates/`++Templates available:+- `docx-basic.ts` - Word document with styles, tables, headers+- `xlsx-basic.ts` - Excel with formulas, multiple sheets+- `pdf-report.ts` - PDF with layout, fonts, images+- `pptx-basic.ts` - PowerPoint with slides, charts, shapes++### Step 3: Adapt Template++Create a working script by adapting the template:+- Copy template to working directory (e.g., `/tmp/generate-doc.ts`)+- Modify ONLY the data/content sections+- Keep all library imports and structure intact+- Replace placeholder text with user's content++### Step 4: Execute++```bash+# Install dependencies if needed+npm install docx xlsx pdf-lib pptxgenjs 2>/dev/null || true++# Run the script+npx tsx /tmp/generate-doc.ts+```++### Step 5: Report Results++Return a concise summary:+```+Document generated successfully.+File: /path/to/output.docx+Type: DOCX (Word Document)+Size: 45 KB+```++## What NOT to Do++- Do NOT output entire template files to conversation+- Do NOT explain every line of code+- Do NOT ask multiple clarifying questions (make reasonable assumptions)+- Do NOT show raw library APIs unless user asks++## Quick Reference++### File Extensions & MIME Types++| Format | Extension | MIME Type |+|--------|-----------|-----------|+| DOCX | `.docx` | `application/vnd.openxmlformats-officedocument.wordprocessingml.document` |+| XLSX | `.xlsx` | `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` |+| PDF | `.pdf` | `application/pdf` |+| PPTX | `.pptx` | `application/vnd.openxmlformats-officedocument.presentationml.presentation` |++### Common Patterns by Document Type++**DOCX** (Word):+- Business reports with headers/footers+- Letters and contracts+- Documents with tables and images++**XLSX** (Excel):+- Financial reports with formulas+- Data exports with multiple sheets+- Invoices with calculations++**PDF**:+- Certificates and receipts+- Reports with precise layout+- Documents requiring fixed formatting++**PPTX** (PowerPoint):+- Business presentations+- Sales decks with charts+- Reports with slides and visuals++## Error Handling++If generation fails:+1. Check if dependencies are installed+2. Verify template syntax+3. Check file permissions for output directory+4. Report specific error message++## Example Interaction++**User**: "Create a quarterly report presentation"++**Agent** (internal workflow):+1. Read `pptx-basic.ts` template+2. Adapt title, data, and chart values+3. Save to `/tmp/quarterly-report.pptx`+4. Execute with `npx tsx`++**Agent response**:+```+Created quarterly report presentation.+File: /tmp/quarterly-report.pptx+Slides: 6 (Title, Highlights, Financial Table, Revenue Chart, Regional Chart, Next Steps)+```++## Templates Location++When looking for templates, search in this order:++```bash+# 1. Local skill directory+ls ~/.claude/skills/office/templates/++# 2. Plugin cache (if installed via marketplace)+ls ~/.claude/plugins/cache/*/skills/office/templates/++# 3. This repo directly (if cloned)+ls ~/Documents/claude-skills/skills/office/templates/+```++## Dependencies++Ensure these are available:+- `docx` - Word documents+- `xlsx` - Excel spreadsheets+- `pdf-lib` - PDF generation+- `pptxgenjs` - PowerPoint presentations+- `tsx` - TypeScript execution++Quick install:+```bash+npm install docx xlsx pdf-lib pptxgenjs tsx+```diff --git a/skills/office/references/pptxgenjs-api.md b/skills/office/references/pptxgenjs-api.mdnew file mode 100644index 00000000..6c4cb86a--- /dev/null+++ b/skills/office/references/pptxgenjs-api.md@@ -0,0 +1,338 @@+# pptxgenjs - Quick API Reference++**Package**: `pptxgenjs` | **Version**: 4.0.1+ | **Docs**: https://gitbrent.github.io/PptxGenJS/++## Installation++```bash+npm install pptxgenjs+```++## Core Import++```typescript+import pptxgen from 'pptxgenjs';+```++## Create Presentation++```typescript+const pptx = new pptxgen();++// Metadata+pptx.author = 'Author Name';+pptx.title = 'Presentation Title';+pptx.subject = 'Subject';+pptx.company = 'Company Name';++// Layout (default is LAYOUT_16x9)+pptx.layout = 'LAYOUT_16x9'; // or 'LAYOUT_4x3', 'LAYOUT_WIDE'+```++## Add Slide++```typescript+const slide = pptx.addSlide();++// With master layout+const slide = pptx.addSlide({ masterName: 'MASTER_SLIDE' });+```++## Text++```typescript+// Simple text+slide.addText('Hello World', {+ x: 1, y: 1, w: 8, h: 1,+ fontSize: 24,+ color: '333333',+ bold: true,+ italic: false,+ align: 'center', // 'left', 'center', 'right'+ valign: 'middle', // 'top', 'middle', 'bottom'+});++// Multiple text runs with different formatting+slide.addText([+ { text: 'Bold text', options: { bold: true, fontSize: 18 } },+ { text: ' and ', options: { fontSize: 18 } },+ { text: 'colored text', options: { color: 'FF0000', fontSize: 18 } },+], { x: 1, y: 2, w: 8, h: 0.5 });++// Bullet points+slide.addText([+ { text: 'First point', options: { bullet: true } },+ { text: 'Second point', options: { bullet: true } },+ { text: 'Third point', options: { bullet: true } },+], { x: 1, y: 1, w: 8, h: 3 });+```++## Text Options++| Option | Type | Description |+|--------|------|-------------|+| `x`, `y` | number | Position in inches |+| `w`, `h` | number | Width/height in inches |+| `fontSize` | number | Font size in points |+| `fontFace` | string | Font family name |+| `color` | string | Hex color (without #) |+| `bold` | boolean | Bold text |+| `italic` | boolean | Italic text |+| `underline` | object | `{ style: 'sng' }` |+| `align` | string | 'left', 'center', 'right' |+| `valign` | string | 'top', 'middle', 'bottom' |+| `bullet` | boolean | Show bullet point |+| `fill` | object | `{ color: 'F0F0F0' }` |+| `rotate` | number | Rotation in degrees |++## Tables++```typescript+const tableData = [+ // Header row+ [+ { text: 'Name', options: { bold: true, fill: '0066CC', color: 'FFFFFF' } },+ { text: 'Value', options: { bold: true, fill: '0066CC', color: 'FFFFFF' } },+ ],+ // Data rows+ ['Item 1', '$100'],+ ['Item 2', '$200'],+ [{ text: 'Total', options: { bold: true } }, { text: '$300', options: { bold: true } }],+];++slide.addTable(tableData, {+ x: 0.5, y: 1, w: 9,+ colW: [5, 4], // Column widths+ border: { pt: 1, color: 'CCCCCC' },+ fontFace: 'Arial',+ fontSize: 14,+ align: 'center',+ valign: 'middle',+ rowH: 0.5, // Row height+});+```++## Charts++### Line Chart++```typescript+slide.addChart(pptx.ChartType.line, [+ { name: 'Series 1', labels: ['Jan', 'Feb', 'Mar'], values: [100, 150, 200] },+ { name: 'Series 2', labels: ['Jan', 'Feb', 'Mar'], values: [80, 120, 180] },+], {+ x: 0.5, y: 1, w: 9, h: 4,+ showLegend: true,+ legendPos: 'b', // 'b', 't', 'l', 'r'+ showTitle: false,+ lineDataSymbol: 'circle',+ chartColors: ['0066CC', 'FF6600'],+});+```++### Bar Chart++```typescript+slide.addChart(pptx.ChartType.bar, [+ { name: '2025', labels: ['Q1', 'Q2', 'Q3', 'Q4'], values: [100, 120, 110, 130] },+ { name: '2026', labels: ['Q1', 'Q2', 'Q3', 'Q4'], values: [120, 140, 130, 150] },+], {+ x: 0.5, y: 1, w: 9, h: 4,+ barDir: 'bar', // 'bar' (horizontal) or 'col' (vertical)+ showValue: true,+ chartColors: ['0066CC', 'CCCCCC'],+});+```++### Pie Chart++```typescript+slide.addChart(pptx.ChartType.pie, [+ { name: 'Sales', labels: ['Product A', 'Product B', 'Product C'], values: [45, 30, 25] },+], {+ x: 0.5, y: 1, w: 5, h: 4,+ showLegend: true,+ showPercent: true,+ chartColors: ['0066CC', '00AA44', 'FF6600'],+});+```++### Chart Types++```typescript+pptx.ChartType.line+pptx.ChartType.bar+pptx.ChartType.area+pptx.ChartType.pie+pptx.ChartType.doughnut+pptx.ChartType.scatter+```++## Images++```typescript+// From file path (Node.js)+slide.addImage({+ path: 'logo.png',+ x: 0.5, y: 0.5, w: 2, h: 1,+});++// From base64+slide.addImage({+ data: 'image/png;base64,iVBORw0KGgo...',+ x: 0.5, y: 2, w: 4, h: 3,+});++// From URL (Node.js only - uses https module)+slide.addImage({+ path: 'https://example.com/image.png',+ x: 5, y: 2, w: 4, h: 3,+});++// Hyperlink on image+slide.addImage({+ path: 'logo.png',+ x: 0.5, y: 0.5, w: 2, h: 1,+ hyperlink: { url: 'https://example.com' },+});+```++## Shapes++```typescript+// Rectangle+slide.addShape(pptx.ShapeType.rect, {+ x: 1, y: 1, w: 3, h: 2,+ fill: { color: '0066CC' },+ line: { color: '004499', pt: 2 },+});++// Circle/Ellipse+slide.addShape(pptx.ShapeType.ellipse, {+ x: 5, y: 1, w: 2, h: 2,+ fill: { color: '00AA00' },+});++// Line+slide.addShape(pptx.ShapeType.line, {+ x: 0.5, y: 3, w: 9, h: 0,+ line: { color: '333333', pt: 1 },+});++// Arrow+slide.addShape(pptx.ShapeType.rightArrow, {+ x: 1, y: 4, w: 2, h: 0.5,+ fill: { color: 'FF6600' },+});+```++### Shape Types++```typescript+pptx.ShapeType.rect+pptx.ShapeType.ellipse+pptx.ShapeType.roundRect+pptx.ShapeType.triangle+pptx.ShapeType.line+pptx.ShapeType.rightArrow+pptx.ShapeType.leftArrow+pptx.ShapeType.upArrow+pptx.ShapeType.downArrow+pptx.ShapeType.star5+pptx.ShapeType.heart+```++## Slide Masters++```typescript+// Define master slide+pptx.defineSlideMaster({+ title: 'COMPANY_MASTER',+ background: { color: 'FFFFFF' },+ objects: [+ { text: { text: 'Company Name', options: { x: 0.5, y: 0.2, fontSize: 10, color: '999999' } } },+ { line: { x: 0.5, y: 0.5, w: 9, h: 0, line: { color: '0066CC', pt: 2 } } },+ { image: { path: 'logo.png', x: 8.5, y: 0.1, w: 1, h: 0.4 } },+ ],+});++// Use master+const slide = pptx.addSlide({ masterName: 'COMPANY_MASTER' });+```++## Export++```typescript+// Node.js - Save to file+await pptx.writeFile({ fileName: 'presentation.pptx' });++// Browser - Trigger download (same API)+await pptx.writeFile({ fileName: 'presentation.pptx' });++// Get as base64+const base64 = await pptx.write({ outputType: 'base64' });++// Get as ArrayBuffer+const buffer = await pptx.write({ outputType: 'arraybuffer' });++// Get as Blob (browser)+const blob = await pptx.write({ outputType: 'blob' });++// Cloudflare Workers - Response+const buffer = await pptx.write({ outputType: 'arraybuffer' });+return new Response(buffer, {+ headers: {+ 'Content-Type': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',+ 'Content-Disposition': 'attachment; filename="presentation.pptx"',+ },+});+```++## Output Types++| Type | Return | Use Case |+|------|--------|----------|+| `base64` | string | Email attachments, APIs |+| `arraybuffer` | ArrayBuffer | Workers, general |+| `blob` | Blob | Browser downloads |+| `uint8array` | Uint8Array | Binary manipulation |+| `nodebuffer` | Buffer | Node.js file operations |++## Units++Default units are **inches**. Can change globally:++```typescript+pptx.defineLayout({+ name: 'LAYOUT_CUSTOM',+ width: 10, // inches+ height: 7.5, // inches+});+```++## Common Mistakes++| Mistake | Fix |+|---------|-----|+| Forgetting await on write/writeFile | Always `await pptx.writeFile()` |+| Color with # (`'#0066CC'`) | Omit # (`'0066CC'`) |+| Using path URL in Workers | Use base64 data instead |+| Positions in pixels | Positions are in inches |++## Workers Compatibility++pptxgenjs works in Workers **except** for remote image URLs (uses `https` module).++**Workaround**: Fetch images first, convert to base64:++```typescript+// In Workers, fetch image first+const imageResponse = await fetch('https://example.com/image.png');+const imageBuffer = await imageResponse.arrayBuffer();+const base64 = btoa(String.fromCharCode(...new Uint8Array(imageBuffer)));++slide.addImage({+ data: `image/png;base64,${base64}`,+ x: 1, y: 1, w: 4, h: 3,+});+```diff --git a/skills/office/rules/office.md b/skills/office/rules/office.mdindex 15cbe813..a34d5249 100644--- a/skills/office/rules/office.md+++ b/skills/office/rules/office.md@@ -1,6 +1,6 @@# Office Document Generation Corrections-Rules for generating DOCX, XLSX, and PDF documents with TypeScript libraries.+Rules for generating DOCX, XLSX, PDF, and PPTX documents with TypeScript libraries.## DOCX (docx npm package)@@ -94,6 +94,78 @@ const image = await pdfDoc.embedPng(imageBytes); // or embedJpgpage.drawImage(image, { x: 50, y: 700, width: 100, height: 50 });```+## PPTX (pptxgenjs)++### Colors Without Hash++| If Claude suggests... | Use instead... |+|----------------------|----------------|+| `color: '#0066CC'` | `color: '0066CC'` |+| `fill: { color: '#FF0000' }` | `fill: { color: 'FF0000' }` |++**Why**: pptxgenjs expects hex colors WITHOUT the `#` prefix. With `#`, colors may not render correctly.++### Positions in Inches++| If Claude suggests... | Use instead... |+|----------------------|----------------|+| `x: 100, y: 50` (pixels) | `x: 1, y: 0.5` (inches) |+| Large position values | Divide by ~100 for inches |++**Why**: All positions and sizes in pptxgenjs are in **inches**, not pixels. Standard slide is 10" × 7.5".++### Write Methods Are Async++| If Claude suggests... | Use instead... |+|----------------------|----------------|+| `pptx.writeFile('file.pptx')` | `await pptx.writeFile({ fileName: 'file.pptx' })` |+| `pptx.write('base64')` | `await pptx.write({ outputType: 'base64' })` |++**Why**: Both `writeFile` and `write` return Promises. Missing `await` gives `[object Promise]`.++### Remote Images in Workers++pptxgenjs uses Node.js `https` module for remote image URLs, which doesn't work in Cloudflare Workers.++```typescript+// ❌ Doesn't work in Workers+slide.addImage({ path: 'https://example.com/image.png', x: 1, y: 1, w: 4, h: 3 });++// ✅ Fetch first, then use base64+const imageResponse = await fetch('https://example.com/image.png');+const imageBuffer = await imageResponse.arrayBuffer();+const base64 = btoa(String.fromCharCode(...new Uint8Array(imageBuffer)));+slide.addImage({ data: `image/png;base64,${base64}`, x: 1, y: 1, w: 4, h: 3 });+```++### ChartType Access++| If Claude suggests... | Use instead... |+|----------------------|----------------|+| `pptxgen.ChartType.line` (lowercase instance) | `pptx.ChartType.line` (instance you created) |+| Importing ChartType separately | Access via your pptx instance |++```typescript+import pptxgen from 'pptxgenjs';++const pptx = new pptxgen();+// Use pptx.ChartType, NOT pptxgen.ChartType+slide.addChart(pptx.ChartType.line, data, options);+```++### Text Array for Bullet Points++```typescript+// ❌ Trying to pass bullet option to addText string+slide.addText('Item 1', { bullet: true }); // Only one line++// ✅ Use array of text objects for multiple bullets+slide.addText([+ { text: 'Item 1', options: { bullet: true } },+ { text: 'Item 2', options: { bullet: true } },+], { x: 1, y: 1, w: 8, h: 3 });+```+## Common HTTP Response Headers### DOCX@@ -129,9 +201,20 @@ return new Response(pdfBytes, {});```+### PPTX++```typescript+return new Response(buffer, {+ headers: {+ 'Content-Type': 'application/vnd.openxmlformats-officedocument.presentationml.presentation',+ 'Content-Disposition': 'attachment; filename="presentation.pptx"',+ },+});+```+## Applies To-- `**/*.ts` files using docx, xlsx, or pdf-lib+- `**/*.ts` files using docx, xlsx, pdf-lib, or pptxgenjs- Cloudflare Workers generating documents- Browser-based document export- Any TypeScript file with Office document generationdiff --git a/skills/office/templates/pptx-basic.ts b/skills/office/templates/pptx-basic.tsnew file mode 100644index 00000000..3529258f--- /dev/null+++ b/skills/office/templates/pptx-basic.ts@@ -0,0 +1,354 @@+/**+ * PPTX Basic Template - PowerPoint Generation with pptxgenjs+ *+ * This template demonstrates:+ * - Creating presentations with multiple slides+ * - Title slides, content slides, chart slides+ * - Tables, bullet points, shapes+ * - Export to file, buffer, base64+ *+ * Usage:+ * npm install pptxgenjs+ * npx tsx pptx-basic.ts+ */++import pptxgen from 'pptxgenjs';+import { writeFileSync } from 'fs';++// ============================================================================+// Create Presentation+// ============================================================================++const pptx = new pptxgen();++// Set presentation metadata+pptx.author = 'Office Skill';+pptx.title = 'Quarterly Business Review';+pptx.subject = 'Q1 2026 Performance';+pptx.company = 'Acme Corporation';++// ============================================================================+// Slide 1: Title Slide+// ============================================================================++const titleSlide = pptx.addSlide();++titleSlide.addText('Quarterly Business Review', {+ x: 0.5,+ y: 2,+ w: 9,+ h: 1.2,+ fontSize: 44,+ bold: true,+ color: '0066CC',+ align: 'center',+});++titleSlide.addText('Q1 2026', {+ x: 0.5,+ y: 3.5,+ w: 9,+ h: 0.6,+ fontSize: 28,+ color: '666666',+ align: 'center',+});++titleSlide.addText('Presented by: Business Intelligence Team', {+ x: 0.5,+ y: 4.5,+ w: 9,+ h: 0.4,+ fontSize: 14,+ color: '999999',+ align: 'center',+});++// ============================================================================+// Slide 2: Key Highlights (Bullet Points)+// ============================================================================++const highlightsSlide = pptx.addSlide();++highlightsSlide.addText('Key Highlights', {+ x: 0.5,+ y: 0.3,+ w: 9,+ h: 0.8,+ fontSize: 32,+ bold: true,+ color: '333333',+});++// Separator line+highlightsSlide.addShape(pptx.ShapeType.line, {+ x: 0.5,+ y: 1.0,+ w: 9,+ h: 0,+ line: { color: '0066CC', width: 2 },+});++highlightsSlide.addText(+ [+ {+ text: 'Revenue increased 25% year-over-year to $12.5M',+ options: { bullet: true, fontSize: 20 },+ },+ {+ text: 'Customer base grew from 8,000 to 10,500 accounts',+ options: { bullet: true, fontSize: 20 },+ },+ {+ text: 'Successfully launched 3 new product features',+ options: { bullet: true, fontSize: 20 },+ },+ {+ text: 'Expanded operations to 5 new markets',+ options: { bullet: true, fontSize: 20 },+ },+ {+ text: 'Net Promoter Score improved from 45 to 62',+ options: { bullet: true, fontSize: 20 },+ },+ ],+ {+ x: 0.5,+ y: 1.3,+ w: 8.5,+ h: 4,+ valign: 'top',+ color: '333333',+ }+);++// ============================================================================+// Slide 3: Financial Summary (Table)+// ============================================================================++const tableSlide = pptx.addSlide();++tableSlide.addText('Financial Summary', {+ x: 0.5,+ y: 0.3,+ w: 9,+ h: 0.8,+ fontSize: 32,+ bold: true,+ color: '333333',+});++const tableData = [+ [+ { text: 'Metric', options: { bold: true, fill: '0066CC', color: 'FFFFFF' } },+ { text: 'Q1 2025', options: { bold: true, fill: '0066CC', color: 'FFFFFF' } },+ { text: 'Q1 2026', options: { bold: true, fill: '0066CC', color: 'FFFFFF' } },+ { text: 'Change', options: { bold: true, fill: '0066CC', color: 'FFFFFF' } },+ ],+ ['Revenue', '$10.0M', '$12.5M', '+25%'],+ ['Gross Profit', '$6.5M', '$8.4M', '+29%'],+ ['Operating Expenses', '$4.2M', '$4.8M', '+14%'],+ ['Net Income', '$2.3M', '$3.6M', '+57%'],+ ['Customers', '8,000', '10,500', '+31%'],+];++tableSlide.addTable(tableData, {+ x: 0.5,+ y: 1.3,+ w: 9,+ colW: [2.5, 2, 2, 2.5],+ border: { pt: 1, color: 'CCCCCC' },+ fontFace: 'Arial',+ fontSize: 14,+ align: 'center',+ valign: 'middle',+});++// ============================================================================+// Slide 4: Revenue Trend (Chart)+// ============================================================================++const chartSlide = pptx.addSlide();++chartSlide.addText('Revenue Trend', {+ x: 0.5,+ y: 0.3,+ w: 9,+ h: 0.6,+ fontSize: 32,+ bold: true,+ color: '333333',+});++chartSlide.addChart(pptx.ChartType.line, [+ {+ name: 'Revenue ($M)',+ labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],+ values: [1.8, 2.1, 2.4, 2.2, 2.6, 2.9],+ },+ {+ name: 'Target ($M)',+ labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],+ values: [2.0, 2.0, 2.2, 2.2, 2.4, 2.4],+ },+], {+ x: 0.5,+ y: 1.0,+ w: 9,+ h: 4.2,+ showLegend: true,+ legendPos: 'b',+ showTitle: false,+ lineDataSymbol: 'circle',+ lineDataSymbolSize: 8,+ chartColors: ['0066CC', '999999'],+});++// ============================================================================+// Slide 5: Regional Performance (Bar Chart)+// ============================================================================++const barSlide = pptx.addSlide();++barSlide.addText('Regional Performance', {+ x: 0.5,+ y: 0.3,+ w: 9,+ h: 0.6,+ fontSize: 32,+ bold: true,+ color: '333333',+});++barSlide.addChart(pptx.ChartType.bar, [+ {+ name: 'Q1 2026',+ labels: ['North America', 'Europe', 'Asia Pacific', 'Latin America'],+ values: [5.2, 3.8, 2.5, 1.0],+ },+ {+ name: 'Q1 2025',+ labels: ['North America', 'Europe', 'Asia Pacific', 'Latin America'],+ values: [4.2, 3.1, 1.9, 0.8],+ },+], {+ x: 0.5,+ y: 1.0,+ w: 9,+ h: 4.2,+ showLegend: true,+ legendPos: 'b',+ showTitle: false,+ barDir: 'bar',+ chartColors: ['0066CC', 'CCCCCC'],+ showValue: true,+ dataLabelPosition: 'outEnd',+});++// ============================================================================+// Slide 6: Next Steps+// ============================================================================++const nextStepsSlide = pptx.addSlide();++nextStepsSlide.addText('Next Steps', {+ x: 0.5,+ y: 0.3,+ w: 9,+ h: 0.8,+ fontSize: 32,+ bold: true,+ color: '333333',+});++// Colored boxes for each action item+const steps = [+ { num: '1', text: 'Complete Q2 product roadmap review', color: '0066CC' },+ { num: '2', text: 'Finalize expansion strategy for APAC region', color: '00AA44' },+ { num: '3', text: 'Launch customer retention program', color: 'FF6600' },+];++steps.forEach((step, index) => {+ const y = 1.3 + index * 1.4;++ // Number circle+ nextStepsSlide.addShape(pptx.ShapeType.ellipse, {+ x: 0.5,+ y: y,+ w: 0.6,+ h: 0.6,+ fill: { color: step.color },+ });++ nextStepsSlide.addText(step.num, {+ x: 0.5,+ y: y,+ w: 0.6,+ h: 0.6,+ fontSize: 20,+ bold: true,+ color: 'FFFFFF',+ align: 'center',+ valign: 'middle',+ });++ // Step text+ nextStepsSlide.addText(step.text, {+ x: 1.3,+ y: y + 0.1,+ w: 7.5,+ h: 0.5,+ fontSize: 18,+ color: '333333',+ });+});++// ============================================================================+// Export Functions+// ============================================================================++// Node.js - Save to file+export async function saveToFile(filename: string = 'presentation.pptx'): Promise<void> {+ await pptx.writeFile({ fileName: filename });+ console.log(`Saved: ${filename}`);+}++// Get as ArrayBuffer (for Workers/Browser)+export async function toArrayBuffer(): Promise<ArrayBuffer> {+ return await pptx.write({ outputType: 'arraybuffer' }) as ArrayBuffer;+}++// Get as base64 (for email/API)+export async function toBase64(): Promise<string> {+ return await pptx.write({ outputType: 'base64' }) as string;+}++// Get as Blob (for browser downloads)+export async function toBlob(): Promise<Blob> {+ return await pptx.write({ outputType: 'blob' }) as Blob;+}++// Cloudflare Workers Response+export async function toResponse(filename: string = 'presentation.pptx'): Promise<Response> {+ const arrayBuffer = await toArrayBuffer();+ return new Response(arrayBuffer, {+ headers: {+ 'Content-Type':+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation',+ 'Content-Disposition': `attachment; filename="${filename}"`,+ },+ });+}++// ============================================================================+// Run if executed directly+// ============================================================================++// Check if running directly (not imported)+const isMainModule = import.meta.url === `file://${process.argv[1]}`;+if (isMainModule) {+ saveToFile('quarterly-report.pptx').then(() => {+ console.log('✅ PowerPoint presentation created successfully!');+ console.log(' Slides: 6 (Title, Highlights, Table, Line Chart, Bar Chart, Next Steps)');+ });+}