Claude Document Creation Capabilities for DOCX, PDF, PPTX, and XLSX

Claude can generate, edit, and analyze DOCX, PDF, PPTX, and XLSX files by loading specialized skills that invoke libraries like python-docx, reportlab, PptxGenJS, and openpyxl, returning sandbox-hosted download links.

According to the asgeirtj/system_prompts_leaks repository, Claude treats document creation as a modular skill-based architecture. When users request office documents, the model loads format-specific instruction bundles from /mnt/skills/public/ before executing generation code. This system ensures consistent output quality across Word reports, PDFs, presentations, and spreadsheets.

How Claude's Document Skills Work

Claude's document creation follows a strict load-then-execute workflow defined in the system prompts.

Skill Loading Protocol

Before generating any document, Claude executes a file_read operation on the relevant skill file. According to lines 410-414 of /Anthropic/old/claude-opus-4.5.md, the model must load skills from /mnt/skills/public/<format>/SKILL.md where <format> is docx, pdf, pptx, or xlsx.

Execution Pipeline

  1. Read Skill: Load the specific SKILL.md file for the target format
  2. Generate Code: Produce Python or JavaScript using the prescribed libraries
  3. Sandbox Execution: Run the code in the isolated environment
  4. Output Storage: Save to /mnt/user-data/outputs/
  5. Download Link: Return a sandbox link like [Download file](sandbox:/mnt/data/filename.ext)

DOCX Creation and Editing

Claude handles Microsoft Word documents through the python-docx library, which is installed by default in the sandbox environment.

Capabilities

  • Create new documents with headings, tables, and images
  • Edit existing .docx files while preserving tracked changes and comments
  • Extract text content from uploaded Word files
  • Apply formatting styles and document templates

Implementation Reference

The DOCX skill file at /mnt/skills/public/docx/SKILL.md contains concrete templates for document generation. When editing existing files, Claude maintains revision history integrity rather than flattening the document structure.

PDF Generation and Parsing

For PDF documents, Claude uses a dual approach: reportlab for generation and a dedicated reader service for parsing.

Generation with ReportLab

Claude generates PDFs programmatically using the reportlab library. This allows precise control over:

  • Headers and footers
  • Page numbering
  • Custom layouts and typography
  • Vector graphics integration

Parsing via Local Service

When reading user-uploaded PDFs, Claude must use the PDF reader service at http://localhost:8451/<pdf_path>. This service handles text extraction and page screenshot capabilities. According to the system prompts, direct PDF parsing libraries are not used for security reasons; the sandboxed service acts as a controlled gateway.

PowerPoint Presentation Building

Claude creates PPTX files using either JavaScript or Python libraries depending on whether it's generating new slides or editing existing decks.

PptxGenJS for New Presentations

For building fresh presentations, Claude uses PptxGenJS, a JavaScript library that runs in the sandbox Node.js environment. This skill supports:

  • Master slide layouts
  • Chart generation
  • Image placeholders
  • Speaker notes

python-pptx for Editing

When modifying uploaded PowerPoint files, Claude switches to the python-pptx library. This maintains compatibility with existing presentation structures while allowing content updates.

Content Safety Constraints

The system prompts include specific warnings about slide overflow in ChatGPT-GPT-5-Agent-mode-System-Prompt.md. Claude must verify that content fits within slide boundaries and does not overflow text boxes.

Excel Spreadsheet Manipulation

For XLSX files, Claude leverages openpyxl to create and modify spreadsheets with full formula support.

Spreadsheet Capabilities

  • Create multi-sheet workbooks
  • Write and preserve Excel formulas (not just calculated values)
  • Apply cell formatting, conditional formatting, and data validation
  • Generate charts and pivot tables
  • Preserve existing workbook structure during updates

Data Analysis Integration

The XLSX skill file emphasizes that Claude can run data analysis on spreadsheet contents before generation, allowing for dynamic report creation based on calculated results.

Practical Implementation Examples

Creating a Word Document

When a user requests a DOCX file, Claude executes this workflow:


# Claude internally loads /mnt/skills/public/docx/SKILL.md first

from docx import Document

doc = Document()
doc.add_heading('Market Analysis Report', 0)
doc.add_paragraph('This report covers renewable energy trends...')
doc.add_table(rows=3, cols=2)

# Saved to /mnt/user-data/outputs/report.docx

The response includes: Download the report

Generating a PDF with Headers

from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph, PageBreak
from reportlab.lib.styles import getSampleStyleSheet

doc = SimpleDocTemplate("/mnt/user-data/outputs/summary.pdf", pagesize=letter)
styles = getSampleStyleSheet()
story = [Paragraph("Executive Summary", styles['Heading1'])]

# Content added here...

doc.build(story)

Building a PowerPoint Deck

Using PptxGenJS (JavaScript execution in sandbox):

const PptxGenJS = require("pptxgenjs");
const pptx = new PptxGenJS();

pptx.title = "AI Trends 2024";
const slide = pptx.addSlide();
slide.addText("Machine Learning Advances", { x: 0.5, y: 0.5, fontSize: 24 });
slide.addChart(pptx.ChartType.bar, chartData, { x: 1, y: 2, w: 8, h: 4 });

pptx.writeFile({ fileName: "/mnt/user-data/outputs/ai_trends.pptx" });

Creating an Excel Financial Model

from openpyxl import Workbook
from openpyxl.styles import Font, Alignment

wb = Workbook()
ws = wb.active
ws.title = "Financial Model"

# Headers

ws['A1'] = "Month"
ws['B1'] = "Revenue"
ws['C1'] = "Costs"
ws['D1'] = "Profit"

# Formulas

for row in range(2, 14):
    ws[f'D{row}'] = f"=B{row}-C{row}"

wb.save("/mnt/user-data/outputs/financial_model.xlsx")

Summary

  • Skill-Based Architecture: Claude loads format-specific skills from /mnt/skills/public/<format>/SKILL.md before executing any document task, ensuring consistent library usage and best practices.

  • Library Stack: The sandbox environment includes python-docx for Word files, reportlab for PDF generation, PptxGenJS and python-pptx for PowerPoint, and openpyxl for Excel spreadsheets.

  • Execution Workflow: Claude reads the skill file, generates Python or JavaScript code, executes it in the sandbox, saves outputs to /mnt/user-data/outputs/, and returns a sandbox download link.

  • PDF Parsing Security: Unlike generation which uses reportlab, reading PDFs requires calling a dedicated local service at http://localhost:8451 rather than direct library access.

  • Content Safety: PowerPoint generation includes overflow checks to prevent text from exceeding slide boundaries, as specified in the agent mode system prompts.

Frequently Asked Questions

What libraries does Claude use to create Word documents?

Claude uses the python-docx library to create and edit DOCX files. According to the system prompts in claude-opus-4.5.md, this library is pre-installed in the sandbox environment and allows Claude to preserve tracked changes, comments, and formatting when editing existing documents.

How does Claude generate PDF files versus reading them?

Claude uses reportlab to generate PDFs programmatically, allowing precise control over layouts, headers, and page numbers. However, when reading uploaded PDFs, Claude must use a dedicated PDF reader service at http://localhost:8451/<pdf_path> rather than parsing libraries directly, as implemented in the sandbox security model.

Can Claude edit existing PowerPoint files or only create new ones?

Claude can do both. For new presentations, Claude uses PptxGenJS (JavaScript) to build slides with charts and master layouts. For editing existing PPTX files, Claude switches to python-pptx (Python) to modify content while preserving the original presentation structure, as documented in the skill files under /mnt/skills/public/pptx/.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →