Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
sickn33 avatar

Docx Official

  • 441 installs
  • 44k repo stars
  • Updated July 27, 2026
  • sickn33/antigravity-awesome-skills

DOCX Official is an agent skill that teaches solo builders how to generate Microsoft Word .docx files programmatically with the docx JavaScript/TypeScript library.

About

DOCX Official is an agent skill that embeds a structured tutorial for the popular docx JavaScript/TypeScript library so you can generate valid Microsoft Word files from code. Solo and indie builders use it when contracts, one-pagers, status reports, or customer-facing exports must land as real .docx—not screenshots or ad-hoc copy-paste. The skill stresses setup (global or project docx install), the Document → sections → children model, and saving via Packer.toBuffer or Packer.toBlob depending on runtime. It walks through text runs, paragraph-level layout, tables, images, headers and footers, hyperlinks, footnotes, and common pitfalls that corrupt files if you skip sections. Invoke when an agent task needs repeatable Word output from Node automation, CI artifacts, or internal tooling, and you want procedural knowledge inlined instead of guessing API shapes from scattered Stack Overflow threads.

  • End-to-end docx npm setup with Document, Packer, and save paths for Node.js buffers and browser blobs
  • Explicit formatting guardrails—never use \n inside TextRun; use separate Paragraph elements for line breaks
  • Covers core composition APIs: Paragraph, TextRun, Table/TableRow/TableCell, ImageRun, headers, footers, and TOC helpers
  • Documents alignment, spacing, indent, headings, hyperlinks, footnotes, page breaks, and page-number runs from the offici
  • Reference-oriented workflow: read the full tutorial before generating files to avoid corruption and rendering issues

Docx Official by the numbers

  • 441 all-time installs (skills.sh)
  • +5 installs in the week ending Jul 27, 2026 (Skillselion tracking)
  • Ranked #159 of 690 Office & Documents skills by installs in the Skillselion catalog
  • Security screen: LOW risk (skills.sh audit)
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill docx-official

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs441
repo stars44k
Security audit3 / 3 scanners passed
Last updatedJuly 27, 2026
Repositorysickn33/antigravity-awesome-skills

What it does

Programmatically generate polished Word (.docx) deliverables from Node or TypeScript agents without hand-editing Office.

Who is it for?

Best when you're automating reports, proposals, or export templates from Node/TypeScript and must deliver real.docx files.

Skip if: Skip if you only publish Markdown or PDF and never need Word-compatible binaries, or workflows that should use human templates in Word Desktop instead of code generation.

When should I use this skill?

The user or task requires creating, fixing, or extending programmatic .docx output with the docx npm package in JavaScript or TypeScript.

What you get

After following the skill, your agent emits structurally correct .docx using Paragraph-centric patterns and Packer save flows you can drop into scripts or repos.

  • Valid .docx binary written via Packer (Node buffer or browser blob)
  • Reusable Document/section/Paragraph composition patterns for future templates

By the numbers

  • Explicit rule: never use \n inside TextRun—use separate Paragraph elements for line breaks

Files

SKILL.mdMarkdownGitHub ↗

DOCX Library Tutorial

Generate .docx files with JavaScript/TypeScript.

Important: Read this entire document before starting. Critical formatting rules and common pitfalls are covered throughout - skipping sections may result in corrupted files or rendering issues.

Setup

Assumes docx is already installed globally If not installed: npm install -g docx

const { Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell, ImageRun, Media, 
        Header, Footer, AlignmentType, PageOrientation, LevelFormat, ExternalHyperlink, 
        InternalHyperlink, TableOfContents, HeadingLevel, BorderStyle, WidthType, TabStopType, 
        TabStopPosition, UnderlineType, ShadingType, VerticalAlign, SymbolRun, PageNumber,
        FootnoteReferenceRun, Footnote, PageBreak } = require('docx');

// Create & Save
const doc = new Document({ sections: [{ children: [/* content */] }] });
Packer.toBuffer(doc).then(buffer => fs.writeFileSync("doc.docx", buffer)); // Node.js
Packer.toBlob(doc).then(blob => { /* download logic */ }); // Browser

Text & Formatting

// IMPORTANT: Never use \n for line breaks - always use separate Paragraph elements
// ❌ WRONG: new TextRun("Line 1\nLine 2")
// ✅ CORRECT: new Paragraph({ children: [new TextRun("Line 1")] }), new Paragraph({ children: [new TextRun("Line 2")] })

// Basic text with all formatting options
new Paragraph({
  alignment: AlignmentType.CENTER,
  spacing: { before: 200, after: 200 },
  indent: { left: 720, right: 720 },
  children: [
    new TextRun({ text: "Bold", bold: true }),
    new TextRun({ text: "Italic", italics: true }),
    new TextRun({ text: "Underlined", underline: { type: UnderlineType.DOUBLE, color: "FF0000" } }),
    new TextRun({ text: "Colored", color: "FF0000", size: 28, font: "Arial" }), // Arial default
    new TextRun({ text: "Highlighted", highlight: "yellow" }),
    new TextRun({ text: "Strikethrough", strike: true }),
    new TextRun({ text: "x2", superScript: true }),
    new TextRun({ text: "H2O", subScript: true }),
    new TextRun({ text: "SMALL CAPS", smallCaps: true }),
    new SymbolRun({ char: "2022", font: "Symbol" }), // Bullet •
    new SymbolRun({ char: "00A9", font: "Arial" })   // Copyright © - Arial for symbols
  ]
})

Styles & Professional Formatting

const doc = new Document({
  styles: {
    default: { document: { run: { font: "Arial", size: 24 } } }, // 12pt default
    paragraphStyles: [
      // Document title style - override built-in Title style
      { id: "Title", name: "Title", basedOn: "Normal",
        run: { size: 56, bold: true, color: "000000", font: "Arial" },
        paragraph: { spacing: { before: 240, after: 120 }, alignment: AlignmentType.CENTER } },
      // IMPORTANT: Override built-in heading styles by using their exact IDs
      { id: "Heading1", name: "Heading 1", basedOn: "Normal", next: "Normal", quickFormat: true,
        run: { size: 32, bold: true, color: "000000", font: "Arial" }, // 16pt
        paragraph: { spacing: { before: 240, after: 240 }, outlineLevel: 0 } }, // Required for TOC
      { id: "Heading2", name: "Heading 2", basedOn: "Normal", next: "Normal", quickFormat: true,
        run: { size: 28, bold: true, color: "000000", font: "Arial" }, // 14pt
        paragraph: { spacing: { before: 180, after: 180 }, outlineLevel: 1 } },
      // Custom styles use your own IDs
      { id: "myStyle", name: "My Style", basedOn: "Normal",
        run: { size: 28, bold: true, color: "000000" },
        paragraph: { spacing: { after: 120 }, alignment: AlignmentType.CENTER } }
    ],
    characterStyles: [{ id: "myCharStyle", name: "My Char Style",
      run: { color: "FF0000", bold: true, underline: { type: UnderlineType.SINGLE } } }]
  },
  sections: [{
    properties: { page: { margin: { top: 1440, right: 1440, bottom: 1440, left: 1440 } } },
    children: [
      new Paragraph({ heading: HeadingLevel.TITLE, children: [new TextRun("Document Title")] }), // U

Related skills

How it compares

Use this procedural docx tutorial in the agent instead of improvising Office XML or one-off chat snippets that break on tables and page layout.

FAQ

Who is docx-official for?

Developers shipping document automation with Claude Code, Cursor, or Codex who need reliable.docx generation from JavaScript or TypeScript.

When should I use docx-official?

Use it during Build docs work when you are creating programmatic Word exports, fixing corrupted docx output, or scaffolding tables, headers, and TOC in Node; it is less central during pure frontend UI or database-only backend tasks.

Is docx-official safe to install?

Treat it as documentation and example code you review before running; check this listing’s Security Audits panel and avoid piping untrusted buffers straight into production paths without your own review.

Office & Documentsworkflownotes

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.