create-docxlisted
Install: claude install-skill MaskedControl/skills
# Create Word Documents (docx-js on Windows)
## Overview
Word documents are generated by writing a JavaScript file that uses the `docx` npm package,
running it with Node, then cleaning up the temp files. The `docx` package must be installed
**locally** in the same folder as the script - global install does not work with `require('docx')`.
The full docx-js API reference is in the `example-skills:docx` skill. Load it for syntax on
tables, images, headers/footers, tracked changes, and anything not covered here.
## Process
### 1. Write the script
Write the JS file to a working location (e.g. Desktop). Output path should be absolute.
```javascript
const { Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, LevelFormat, BorderStyle, WidthType,
ShadingType, VerticalAlign, PageBreak } = require('docx');
const fs = require('fs');
// ... build doc ...
Packer.toBuffer(doc).then(buf => {
fs.writeFileSync("C:/Users/rosem/Desktop/output.docx", buf);
console.log("Done");
}).catch(err => { console.error(err); process.exit(1); });
```
### 2. Install and run
```powershell
cd C:/Users/rosem/Desktop
npm init -y
npm install docx
node build-doc.js
```
### 3. Clean up
```powershell
Remove-Item -Recurse -Force build-doc.js, package.json, package-lock.json, node_modules
```
## Windows Validation Caveat
The `validate.py` script from `example-skills:docx` throws a `UnicodeEncodeError` on Windows
consoles (cp1252 can't encode th