Back to Skills

office

verified

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, presentations, form filling, exporting data to Office formats, or troubleshooting "Packer.toBuffer", "XLSX.utils", "PDFDocument", "pptxgenjs" errors.

View on GitHub

Marketplace

claude-skills

jezweb/claude-skills

Plugin

frontend

Repository

jezweb/claude-skills
211stars

skills/office/SKILL.md

Last Verified

January 21, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/jezweb/claude-skills/blob/main/skills/office/SKILL.md -a claude-code --skill office

Installation paths:

Claude
.claude/skills/office/
Powered by add-skill CLI

Instructions

# Office Document Generation

**Status**: Production Ready
**Last Updated**: 2026-01-12
**Dependencies**: None (pure JavaScript libraries)
**Latest Versions**: docx@9.5.0, xlsx@0.18.5, pdf-lib@1.17.1, pptxgenjs@4.0.1

---

## Overview

Generate Microsoft Office documents and PDFs programmatically with TypeScript. All libraries are pure JavaScript with zero native dependencies, enabling universal runtime support:

| Format | Library | Workers | Browser | Node.js |
|--------|---------|---------|---------|---------|
| **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).

---

## Quick Start

### Installation

```bash
# Install all four (or pick what you need)
npm install docx xlsx pdf-lib pptxgenjs
```

### Create a Word Document (30 seconds)

```typescript
import { Document, Packer, Paragraph, TextRun } from 'docx';
import { writeFileSync } from 'fs';

const doc = new Document({
  sections: [{
    children: [
      new Paragraph({
        children: [
          new TextRun({ text: 'Hello World', bold: true, size: 48 }),
        ],
      }),
    ],
  }],
});

// Node.js: Save to file
const buffer = await Packer.toBuffer(doc);
writeFileSync('hello.docx', buffer);

// Browser/Workers: Get as blob
const blob = await Packer.toBlob(doc);
```

### Create an Excel Spreadsheet (30 seconds)

```typescript
import * as XLSX from 'xlsx';

// Create workbook with data
const data = [
  ['Name', 'Amount', 'Date'],
  ['Invoice #1', 1500, '2026-01-12'],
  ['Invoice #2', 2300, '2026-01-13'],
];

const worksheet = XLSX.utils.aoa_to_sheet(data);
const workbook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workbook, worksheet, 'Invoices');

// Node.js: Save to file
XLSX.writeFile(workbook, 'invoices.xlsx');

// Browser/Workers: Get as buffer
const buffer = XLSX.write(workbook,

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
21028 chars