document-docx

vasilyu1983/ai-agents-public · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/vasilyu1983/ai-agents-public --skill document-docx
0 commentsdiscussion
summary

This skill enables creation, editing, and analysis of .docx files for reports, contracts, proposals, documentation, and template-driven outputs.

skill.md

Document DOCX Skill - Quick Reference

This skill enables creation, editing, and analysis of .docx files for reports, contracts, proposals, documentation, and template-driven outputs.

Modern best practices (2026):

  • Prefer templates + styles over manual formatting.
  • Treat .docx as the editable source; treat PDF as a release artifact.
  • If distributing externally, include basic accessibility hygiene (headings, table headers, alt text).

Quick Reference

Task Tool/Library Language When to Use
Create DOCX python-docx Python Reports, contracts, proposals
Create DOCX docx Node.js Server-side document generation
Convert to HTML mammoth.js Node.js Web display, content extraction
Parse DOCX python-docx Python Extract text, tables, metadata
Template fill docxtpl Python Mail merge, template-based generation
Review workflow Word compare, comments/highlights Any Human review without OOXML surgery
Tracked changes OOXML inspection, docx4j/OpenXML SDK/Aspose Any True redlines or parsing tracked changes

Tool Selection

  • Prefer docxtpl when non-developers must edit layout/design in Word.
  • Prefer python-docx for structural edits (paragraphs/tables/headers/footers) when formatting complexity is moderate.
  • Prefer docx (Node.js) for server-side generation in TypeScript-heavy stacks.
  • Prefer mammoth for text-first extraction or DOCX-to-HTML (best effort; may drop some layout fidelity).

Known Limits (Plan Around These)

  • .doc (legacy) is not supported by these libraries; convert to .docx first (e.g., LibreOffice).
  • python-docx cannot reliably create true tracked changes; use Word compare or specialized OOXML tooling.
  • Tables of Contents and many fields are placeholders until opened/updated in Word.

Core Operations

Create Document (Python - python-docx)

from docx import Document
from docx.shared import Inches, Pt
from docx.enum.text import WD_ALIGN_PARAGRAPH

doc = Document()

# Title
title = doc.add_heading('Document Title', 0)
title.alignment = WD_ALIGN_PARAGRAPH.CENTER

# Paragraph with formatting
para = doc.add_paragraph()
run = para.add_run('Bold and ')
run.bold = True
run = para.add_run('italic text.')
run.italic = True

# Table
table = doc.add_table(rows=3, cols=3)
table.style = 'Table Grid'
for i, row in enumerate(table.rows):
    for j, cell in enumerate(row.cells):
        cell.text = f'Row {i+1}, Col {j+1}'

# Image
doc.add_picture('image.png', width=Inches(4))

# Save
doc.save('output.docx')

Create Document (Node.js - docx)

import { Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell } from 'docx';
import * as fs from 'fs';

const doc = new Document({
  sections: [{
    properties: {},
    children: [
      new Paragraph({
        children: [
          new TextRun({ text: 'Bold text', bold: true }),
          new TextRun({ text: ' and normal text.' }),
        ],
      }),
      new Table({
        rows: [
          new TableRow({
            children: [
              new TableCell({ children: [new Paragraph('Cell 1')] }),
              new TableCell({ children: [new Paragraph('Cell 2')] }),
            ],
          }),
        ],
      }),
    ],
  }],
});

Packer.toBuffer(doc).then((buffer) => {
  fs.writeFileSync('output.docx', buffer);
});

Template-Based Generation (Python - docxtpl)

from docxtpl import DocxTemplate

doc = DocxTemplate('template.docx')
context = {
    'company_name': 'Acme Corp',
    'date': '2025-01-15',
    'items': [
        {'name': 'Widget A', 'price': 100},
        {'name': 'Widget B', 'price': 200},
    ]
}
doc.render(context)
doc.save('filled_template.docx')

Extract Content (Python - python-docx)

from docx import Document

doc = Document('input.docx')

# Extract all text
full_text = []
for para in doc.paragraphs:
    full_text.append(para.text)

# Extract tables
for table in doc.tables:
    for row in table.rows:
        row_data = [cell.text for cell in row.cells]
        print(row_data)

Styling Reference

Element Python Method Node.js Class
Heading 1 add_heading(text, 1) HeadingLevel.HEADING_1
Bold run.bold = True TextRun({ bold: true })
Italic run.italic = True TextRun({ italics: true })
Font size run.font.size = Pt(12) TextRun({ size: 24 }) (half-points)
Alignment WD_ALIGN_PARAGRAPH.CENTER AlignmentType.CENTER
Page break doc.add_page_break() new PageBreak()

Do / Avoid (Dec 2025)

Do

  • Use consistent heading levels and a table of contents for long docs.
  • Capture decisions and action items with owners and due dates.
  • Store docs in a versioned, searchable system.

Avoid

  • Manual formatting instead of styles (breaks consistency).
  • Docs with no owner or review cadence (stale quickly).
  • Copy/pasting without updating definitions and links.

Output Quality Checklist

  • Structure: consistent heading hierarchy, styles, and (when needed) an auto-generated table of contents.
  • Decisions: decisions/actions captured with owner + due date (not buried in prose).
  • Versioning: doc ID + version + change summary; review cadence defined.
  • Accessibility hygiene: headings/reading order are correct; table headers are marked; alt text for non-decorative images.
  • Reuse: use assets/doc-template-pack.md for decision logs and recurring doc types.

Optional: AI / Automation

Use only when explicitly requested and policy-compliant.

  • Summarize meeting notes into decisions/actions; humans verify accuracy.
  • Draft first-pass docs from outlines; do not invent facts or quotes.

Navigation

Resources

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

Task Automation & Efficiency

Automate repetitive workflows and reduce manual effort

Example

Generate reports, summarize documents, draft communications

Save 3-5 hours per week on routine tasks

Knowledge Enhancement

Learn new skills, understand complex topics, get expert guidance

Example

Explain concepts, provide examples, suggest learning resources

Accelerate learning and skill development by 2x

Quality Improvement

Enhance output quality through reviews, suggestions, and refinements

Example

Review drafts, suggest improvements, catch errors

Improve work quality by 30-40% with less effort

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client with skill support
  • Clear understanding of task or problem to solve
  • Willingness to iterate and refine outputs

Time Estimate

15-45 minutes depending on use case complexity

Installation Steps

  1. 1.Install skill using provided installation command
  2. 2.Test with simple use case relevant to your work
  3. 3.Evaluate output quality and relevance
  4. 4.Iterate on prompts to improve results
  5. 5.Integrate into regular workflow if valuable

Common Pitfalls

  • Expecting perfect results without iteration
  • Not providing enough context in prompts
  • Using skill for tasks outside its intended scope
  • Accepting outputs without review and validation

Best Practices

✓ Do

  • +Start with clear, specific prompts
  • +Provide relevant context and constraints
  • +Review and refine all outputs before using
  • +Iterate to improve output quality
  • +Document successful prompt patterns

✗ Don't

  • Don't use without understanding skill limitations
  • Don't skip validation of outputs
  • Don't share sensitive information in prompts
  • Don't expect skill to replace human judgment

💡 Pro Tips

  • Be specific about desired format and style
  • Ask for multiple options to choose from
  • Request explanations to understand reasoning
  • Combine AI efficiency with human expertise

When to Use This

✓ Use When

Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.

✗ Avoid When

Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.

Learning Path

  1. 1Familiarize yourself with skill capabilities and limitations
  2. 2Start with low-risk, non-critical tasks
  3. 3Progress to more complex and valuable use cases
  4. 4Build expertise through regular use and experimentation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.828 reviews
  • Chaitanya Patil· Dec 20, 2024

    We added document-docx from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Kabir Ramirez· Dec 8, 2024

    document-docx fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Sophia Khanna· Dec 4, 2024

    document-docx is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Hana Farah· Nov 23, 2024

    Keeps context tight: document-docx is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Piyush G· Nov 11, 2024

    Useful defaults in document-docx — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • William Nasser· Oct 14, 2024

    I recommend document-docx for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Shikha Mishra· Oct 2, 2024

    Registry listing for document-docx matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Kaira Torres· Sep 25, 2024

    Registry listing for document-docx matched our evaluation — installs cleanly and behaves as described in the markdown.

  • Rahul Santra· Sep 9, 2024

    Keeps context tight: document-docx is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Pratham Ware· Aug 28, 2024

    I recommend document-docx for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

showing 1-10 of 28

1 / 3