Anthropic office pptx

From diegosouzapw/awesome-omni-skill · View interactive version

Anthropic office pptx is an AI agent skill from the GitHub repository diegosouzapw/awesome-omni-skill. Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks

How to use this skill

Skill file

PPTX creation, editing, and analysis

Overview

Observability

First: At the start of execution, display:

🔧 Skill "anthropic-office-pptx" activated

A user may ask you to create, edit, or analyze the contents of a .pptx file. A .pptx file is essentially a ZIP archive containing XML files and other resources that you can read or edit. You have different tools and workflows available for different tasks.

Reading and analyzing content

Text extraction

If you just need to read the text contents of a presentation, you should convert the document to markdown:

# Convert document to markdown
python -m markitdown path-to-file.pptx

Raw XML access

You need raw XML access for: comments, speaker notes, slide layouts, animations, design elements, and complex formatting. For any of these features, you'll need to 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
Typography and color extraction

When given an example design to emulate: Always analyze the presentation's typography and colors first using the methods below:

  1. Read theme file: Check ppt/theme/theme1.xml for colors (<a:clrScheme>) and fonts (<a:fontScheme>)
  2. Sample slide content: Examine ppt/slides/slide1.xml for actual font usage (<a:rPr>) and colors
  3. 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**

When creating a new PowerPoint presentation from scratch, 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:

  1. Consider the subject matter: What is this presentation about? What tone, industry, or mood does it suggest?
  2. Check for branding: If the user mentions a company/organization, consider their brand colors and identity
  3. Match palette to content: Select colors that reflect the subject
  4. State your approach: Explain your design choices before writing code

Requirements:

Color Palette Selection

Choosing colors creatively:

Example color palettes (use these to spark creativity - choose one, adapt it, or create your own):

  1. Classic Blue: Deep navy (#1C2833), slate gray (#2E4053), silver (#AAB7B8), off-white (#F4F6F6)
  2. Teal & Coral: Teal (#5EA8A7), deep teal (#277884), coral (#FE4447), white (#FFFFFF)
  3. Bold Red: Red (#C0392B), bright red (#E74C3C), orange (#F39C12), yellow (#F1C40F), green (#2ECC71)
  4. Warm Blush: Mauve (#A49393), blush (#EED6D3), rose (#E8B4B8), cream (#FAF7F2)
  5. Burgundy Luxury: Burgundy (#5D1D2E), crimson (#951233), rust (#C15937), gold (#997929)
  6. Deep Purple & Emerald: Purple (#B165FB), dark blue (#181B24), emerald (#40695B), white (#FFFFFF)
  7. Cream & Forest Green: Cream (#FFE1C7), forest green (#40695B), white (#FCFCFC)
  8. Pink & Purple: Pink (#F8275B), coral (#FF574A), rose (#FF737D), purple (#3D2F68)
  9. Lime & Plum: Lime (#C5DE82), plum (#7C3A5F), coral (#FD8C6E), blue-gray (#98ACB5)
  10. Black & Gold: Gold (#BF9A4A), black (#000000), cream (#F4F6F6)
  11. Sage & Terracotta: Sage (#87A96B), terracotta (#E07A5F), cream (#F4F1DE), charcoal (#2C2C2C)
  12. Charcoal & Red: Charcoal (#292929), red (#E33737), light gray (#CCCBCB)
  13. Vibrant Orange: Orange (#F96D00), light gray (#F2F2F2), charcoal (#222831)
  14. Forest Green: Black (#191A19), green (#4E9F3D), dark green (#1E5128), white (#FFFFFF)
  15. Retro Rainbow: Purple (#722880), pink (#D72D51), orange (#EB5C18), amber (#F08800), gold (#DEB600)
  16. Vintage Earthy: Mustard (#E3B448), sage (#CBD18F), forest green (#3A6B35), cream (#F4F1DE)
  17. Coastal Rose: Old rose (#AD7670), beaver (#B49886), eggshell (#F3ECDC), ash gray (#BFD5BE)
  18. Orange & Turquoise: Light orange (#FC993E), grayish turquoise (#667C6F), white (#FCFCFC)
Visual Details Options

Geometric Patterns:

Border & Frame Treatments:

Typography Treatments:

Chart & Data Styling:

Layout Innovations:

Background Treatments:

Layout Tips

When creating slides with charts or tables:

Workflow

  1. MANDATORY - READ ENTIRE FILE: Read CODE0 completely from start to finish. NEVER set any range limits when reading this file. Read the full file content for detailed syntax, critical formatting rules, and best practices before proceeding with presentation creation.
  2. Create an HTML file for each slide with proper dimensions (e.g., 720pt × 405pt for 16:9)
  1. Create and run a JavaScript file using the CODE0 library to convert HTML slides to PowerPoint and save the presentation
  1. Visual validation: Generate thumbnails and inspect for layout issues

Editing an existing PowerPoint presentation

When edit slides in an existing PowerPoint presentation, you need to work with the raw Office Open XML (OOXML) format. This involves unpacking the .pptx file, editing the XML content, and repacking it.

Workflow

  1. MANDATORY - READ ENTIRE FILE: Read CODE0 (~500 lines) completely from start to finish. NEVER set any range limits when reading this file. Read the full file content for detailed guidance on OOXML structure and editing workflows before any presentation editing.
  2. Unpack the presentation: python ooxml/scripts/unpack.py <office_file> <output_dir>
  3. Edit the XML files (primarily ppt/slides/slide{N}.xml and related files)
  4. CRITICAL: Validate immediately after each edit and fix any validation errors before proceeding: python ooxml/scripts/validate.py <dir> --original <file>
  5. Pack the final presentation: python ooxml/scripts/pack.py <input_directory> <office_file>

Creating a new PowerPoint presentation **using a template**

When you need to create a presentation that follows an existing template's design, you'll need to duplicate and re-arrange template slides before then replacing placeholder context.

Workflow

  1. Extract template text AND create visual thumbnail grid:
  1. Analyze template and save inventory to a file:

```markdown

# Template Inventory Analysis

Total Slides: [count]

IMPORTANT: Slides are 0-indexed (first slide = 0, last slide = count-1)

## [Category Name]

[... EVERY slide must be listed individually with its index ...]

```

  1. Create presentation outline based on template inventory:

```

# Template slides to use (0-based indexing)

# WARNING: Verify indices are within range! Template with 73 slides has indices 0-72

# Mapping: slide numbers from outline -> template slide indices

template_mapping = [

0, # Use slide 0 (Title/Cover)

34, # Use slide 34 (B1: Title and body)

34, # Use slide 34 again (duplicate for second B1)

50, # Use slide 50 (E1: Quote)

54, # Use slide 54 (F2: Closing + Text)

]

```

  1. Duplicate, reorder, and delete slides using rearrange.py:

```bash

python scripts/rearrange.py template.pptx working.pptx 0,34,34,50,52

```

  1. Extract ALL text using the inventory.py script:

```bash

python scripts/inventory.py working.pptx text-inventory.json

```

```json

{

"slide-0": {

"shape-0": {

"placeholder_type": "TITLE", // or null for non-placeholders

"left": 1.5, // position in inches

"top": 2.0,

"width": 7.5,

"height": 1.2,

"paragraphs": [

{

"text": "Paragraph text",

// Optional properties (only included when non-default):

"bullet": true, // explicit bullet detected

"level": 0, // only included when bullet is true

"alignment": "CENTER", // CENTER, RIGHT (not LEFT)

"space_before": 10.0, // space before paragraph in points

"space_after": 6.0, // space after paragraph in points

"line_spacing": 22.4, // line spacing in points

"font_name": "Arial", // from first run

"font_size": 14.0, // in points

"bold": true,

"italic": false,

"underline": false,

"color": "FF0000" // RGB color

}

]

}

}

}

```

  1. Generate replacement text and save the data to a JSON file

Based on the text inventory from the previous step:

Example paragraphs field showing proper formatting:

```json

"paragraphs": [

{

"text": "New presentation title text",

"alignment": "CENTER",

"bold": true

},

{

"text": "Section Header",

"bold": true

},

{

"text": "First bullet point without bullet symbol",

"bullet": true,

"level": 0

},

{

"text": "Red colored text",

"color": "FF0000"

},

{

"text": "Theme colored text",

"theme_color": "DARK_1"

},

{

"text": "Regular paragraph text without special formatting"

}

]

```

Shapes not listed in the replacement JSON are automatically cleared:

```json

{

"slide-0": {

"shape-0": {

"paragraphs": [...] // This shape gets new text

}

// shape-1 and shape-2 from inventory will be cleared automatically

}

}

```

Common formatting patterns for presentations:

  1. Apply replacements using the replace.py script

```bash

python scripts/replace.py working.pptx replacement-text.json output.pptx

```

The script will:

Example validation errors:

```

ERROR: Invalid shapes in replacement JSON:

```

```

ERROR: Replacement text made overflow worse in these shapes:

```

Creating Thumbnail Grids

To create visual thumbnail grids of PowerPoint slides for quick analysis and reference:

python scripts/thumbnail.py template.pptx [output_prefix]

Features:

Use cases:

Examples:

# Basic usage
python scripts/thumbnail.py presentation.pptx

# Combine options: custom name, columns
python scripts/thumbnail.py template.pptx analysis --cols 4

Converting Slides to Images

To visually analyze PowerPoint slides, convert them to images using a two-step process:

  1. Convert PPTX to PDF:

```bash

soffice --headless --convert-to pdf template.pptx

```

  1. Convert PDF pages to JPEG images:

```bash

pdftoppm -jpeg -r 150 template.pdf slide

```

This creates files like slide-1.jpg, slide-2.jpg, etc.

Options:

Example for specific range:

pdftoppm -jpeg -r 150 -f 2 -l 5 template.pdf slide  # Converts only pages 2-5

Code Style Guidelines

IMPORTANT: When generating code for PPTX operations:

Dependencies

Required dependencies (should already be installed):

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.