← ClaudeAtlas

create-docxlisted

Use when creating or generating a Word document (.docx) for a client, email, or report. Covers Windows setup, running docx-js scripts in a temp folder, cleanup, and formatting patterns (tables, bullets, callout boxes, screenshot placeholders). Triggers on requests like "create a Word doc", "generate a .docx", "make a report in Word", or "build a document for the client."
MaskedControl/skills · ★ 0 · Data & Documents · score 68
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