| name | docx |
| description | Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of "Word doc", "word document", ".docx", or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. |
DOCX Creation, Editing, and Analysis
Quick Reference
| Task | Approach |
|---|
| Read/analyze content | pandoc or unpack for raw XML |
| Create new document | Use docx-js |
| Edit existing document | Unpack → edit XML → repack |
Creating New Documents (docx-js)
Setup
const { Document, Packer, Paragraph, TextRun, Table } = require('docx');
const doc = new Document({ sections: [{ children: [] }] });
Packer.toBuffer(doc).then(buffer => fs.writeFileSync("doc.docx", buffer));
Page Size (US Letter)
sections: [{
properties: {
page: {
size: { width: 12240, height: 15840 },
margin: { top: 1440, right: 1440, bottom: 1440, left: 1440 }
}
},
children: []
}]
Editing Existing Documents
Step 1: Unpack
python scripts/office/unpack.py document.docx unpacked/
Step 2: Edit XML
Edit files in unpacked/word/
Step 3: Pack
python scripts/office/pack.py unpacked/ output.docx
Important Notes
Missing Scripts: This skill references scripts (unpack.py, pack.py, validate.py, etc.) that are not included in this migration. The XML editing workflow can still be performed manually, or you can create these scripts based on the skill documentation.
Qwen Code Integration
Use /skills docx to invoke manually, or mention Word document tasks for automatic activation.