Skip to content
Back to skills

Dev Document

ASecurity

Code that generates documents inside an application (PDF, DOCX, XLSX, PPTX) - choose and wire the library for an export endpoint, an invoice, a scheduled report. Trigger when the user wants their app or a script to generate, export or download PDF/Word/Excel/PowerPoint files. For Claude itself to write, read or edit an office file, use Anthropic's docx/pdf/xlsx/pptx skills instead.

  • 5 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added May 28, 2026
ai-agentstypescriptpythongobashnodegit

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned October 4, 2026

npx -y skills add christopherlouet/claude-base --skill dev-document --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Dev Document?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Dev Document
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/christopherlouet-dev-document/badge)](https://www.skillsdirectory.com/skills/christopherlouet-dev-document)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: dev-document
description: Code that generates documents inside an application (PDF, DOCX, XLSX, PPTX) - choose and wire the library for an export endpoint, an invoice, a scheduled report. Trigger when the user wants their app or a script to generate, export or download PDF/Word/Excel/PowerPoint files. For Claude itself to write, read or edit an office file, use Anthropic's docx/pdf/xlsx/pptx skills instead.
---

# Document Generation

## Goal

Write the code that makes an application produce documents — PDF, DOCX, XLSX, PPTX — with the right library for the stack.

**Not this skill:** when the deliverable is a file Claude writes, reads or edits itself (a memo, a filled-in form, a reviewed contract with tracked changes), Anthropic's own skills do it far better: [`anthropics/skills`](https://github.com/anthropics/skills/tree/main/skills) — `docx`, `pdf`, `xlsx`, `pptx` (reading and editing existing files, tracked changes, form filling, OCR). They ship under Anthropic's own terms (not open source): install or point to them, never copy them.

## Supported formats

| Format | Extension | Recommended tool | Usage |
|--------|-----------|------------------|-------|
| **PDF** | `.pdf` | puppeteer / Playwright, WeasyPrint, pandoc | Reports, invoices, formal docs |
| **Word** | `.docx` | docx (npm), python-docx | Editable documents, specifications |
| **Excel** | `.xlsx` | exceljs, openpyxl | Tabular data, numeric reports |
| **PowerPoint** | `.pptx` | pptxgenjs, python-pptx | Presentations, pitch decks |

## Instructions per format

### PDF - Generation from HTML/Markdown

```bash
# Option 1: Puppeteer (Node.js)
npm install puppeteer

# Option 2: WeasyPrint (Python, HTML/CSS -> PDF, no browser)
pip install weasyprint
weasyprint input.html output.pdf

# Option 3: pandoc (Markdown -> PDF, needs a PDF engine such as weasyprint or a LaTeX install)
pandoc input.md -o output.pdf --pdf-engine=weasyprint
```

```typescript
// Puppeteer - HTML to PDF
import puppeteer from 'puppeteer';

async function generatePDF(htmlContent: string, outputPath: string) {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.setContent(htmlContent, { waitUntil: 'networkidle0' });
  await page.pdf({
    path: outputPath,
    format: 'A4',
    margin: { top: '20mm', right: '15mm', bottom: '20mm', left: '15mm' },
    printBackground: true,
  });
  await browser.close();
}
```

### DOCX - Word documents

```typescript
// npm install docx
import { Document, Packer, Paragraph, TextRun, HeadingLevel } from 'docx';
import * as fs from 'fs';

async function generateDOCX(title: string, sections: Section[]) {
  const doc = new Document({
    sections: [{
      properties: {},
      children: [
        new Paragraph({
          text: title,
          heading: HeadingLevel.TITLE,
        }),
        ...sections.flatMap(section => [
          new Paragraph({
            text: section.heading,
            heading: HeadingLevel.HEADING_1,
          }),
          new Paragraph({
            children: [new TextRun(section.content)],
          }),
        ]),
      ],
    }],
  });

  const buffer = await Packer.toBuffer(doc);
  fs.writeFileSync('output.docx', buffer);
}
```

### XLSX - Spreadsheets

```typescript
// npm install exceljs
import ExcelJS from 'exceljs';

async function generateXLSX(data: Record<string, any>[]) {
  const workbook = new ExcelJS.Workbook();
  const sheet = workbook.addWorksheet('Data');

  // Headers from the keys of the first object
  const headers = Object.keys(data[0]);
  sheet.addRow(headers);

  // Header styling
  sheet.getRow(1).font = { bold: true };
  sheet.getRow(1).fill = {
    type: 'pattern',
    pattern: 'solid',
    fgColor: { argb: 'FF4472C4' },
  };

  // Data
  data.forEach(row => {
    sheet.addRow(headers.map(h => row[h]));
  });

  // Auto-width
  sheet.columns.forEach(col => {
    col.width = 15;
  });

  await workbook.xlsx.writeFile('output.xlsx');
}
```

### PPTX - Presentations

```typescript
// npm install pptxgenjs
import PptxGenJS from 'pptxgenjs';

function generatePPTX(slides: SlideData[]) {
  const pptx = new PptxGenJS();

  slides.forEach(slideData => {
    const slide = pptx.addSlide();

    // Title
    slide.addText(slideData.title, {
      x: 0.5, y: 0.5, w: 9, h: 1,
      fontSize: 28, bold: true, color: '363636',
    });

    // Content
    slide.addText(slideData.content, {
      x: 0.5, y: 1.8, w: 9, h: 4,
      fontSize: 16, color: '666666',
      bullet: slideData.bullets ? true: false,
    });
  });

  pptx.writeFile({ fileName: 'output.pptx' });
}
```

## Python alternatives

```python
# PDF with reportlab
pip install reportlab

# DOCX with python-docx
pip install python-docx

# XLSX with openpyxl
pip install openpyxl

# PPTX with python-pptx
pip install python-pptx
```

## Generation workflow

```
1. IDENTIFY the required format (PDF, DOCX, XLSX, PPTX)
        |
2. PREPARE the data and content
        |
3. CHOOSE the library suited to the runtime (Node.js or Python)
        |
4. GENERATE the document with professional formatting
        |
5. VALIDATE the output (opening, layout, data)
```

## Best practices

- Always use templates for visual consistency
- Separate data from formatting
- Handle encoding errors (UTF-8)
- Test with different data sizes
- Include metadata (author, date, subject)

## Rules

- ALWAYS ask for the desired format if not specified
- ALWAYS verify that dependencies are installed before generating
- NEVER hardcode file paths
- PREFER reusable templates over one-shot documents

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.