Logo vun Document Docx

Document Docx

Communautéit
vasilyu1983
document-docx

Create/edit .docx files with styles, templates, comments, and extraction workflows. Use when asked to generate Word reports, contracts, proposals, or convert Word content.

Iwwersiicht

Editeurvasilyu1983
RepositoryAI-Agents-public
Skill-Nummdocument-docx
Stären
87
Forks
19
Matgeliwwert Fichieren
22
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 22 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum vasilyu1983 op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Document Docx an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/vasilyu1983/AI-Agents-public/tree/main/frameworks/shared-skills/skills/document-docx
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/vasilyu1983/AI-Agents-public.git /tmp/AI-Agents-public
mkdir -p .claude/skills
cp -r /tmp/AI-Agents-public/frameworks/shared-skills/skills/document-docx .claude/skills/document-docx
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Document Docx an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Document Docx automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Document Docx net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Document DOCX Skill - Quick Reference

This skill covers creation, editing, review, extraction, and release workflows for .docx documents.

Modern best practices (Jul 2026):

  • Treat .docx as the editable source and PDF as a release artifact.
  • Prefer templates and built-in styles over manual formatting.
  • Use comments for review notes; use Word Compare for true redlines.
  • For LLM/RAG extraction, optimize for structure, trust level, and sanitization rather than visual fidelity.
  • Treat macro-enabled Office files (.docm, .dotm) as untrusted by default.
  • Before promising a feature (comments, alt text, tracked changes), check the installed library version — several of these APIs are recent additions and silently absent on older pins. See "Version-Gate Before Promising A Feature" below.

Core Decision Rules (2026)

  • If non-developers need to own layout/design, prefer docxtpl with a Word-authored template.
  • If the stack is Python and edits are structural, prefer python-docx.
  • If the stack is TypeScript/Node and the output is generated server-side, prefer docx.
  • If you need semantic HTML from a trusted document, prefer mammoth, then sanitize before rendering or storing the output.
  • If you need Markdown/JSON for search, indexing, or RAG, prefer MarkItDown or Docling.
  • If the user asks for tracked changes, do not promise high-level library support. Generate a revised .docx and use Word Compare, or switch to OOXML-specialized tooling.
  • If the user asks for PDF output, prefer Word automation for highest fidelity and LibreOffice headless for cross-platform batch workflows.
  • If the input is .doc, convert to .docx first. If it is .docm or .dotm, do not trust embedded macros.

Quick Reference

TaskTool/LibraryLanguageWhen to Use
Create/edit DOCXpython-docxPythonStructural edits, reports, contracts, section/table/image work
Create/edit DOCXdocxNode.jsServer-side generation in TypeScript-heavy stacks
Template filldocxtplPythonWord-authored templates, mail merge, batch documents
Add/access commentspython-docx + Word review workflowPython / WordReview notes without tracked revisions
Convert DOCX to HTMLmammothNode.jsSemantic HTML from trusted documents
Convert DOCX to MarkdownMarkItDownPythonLLM/RAG ingestion where Markdown is preferred
Convert DOCX to Markdown/HTML/JSONDoclingPython / CLIMulti-format ingestion, structured extraction, batch conversion
Parse text/tables/metadatapython-docx + OOXML inspectionPythonExtraction, audits, migration tooling
Parse tracked changes/commentsOOXML, Open XML SDK, docx4j, Aspose.WordsPython / .NET / JavaRevision-heavy workflows and interoperability edge cases
Convert DOCX to PDFWord automation / LibreOffice headlessOS toolingRelease artifacts and cross-platform smoke checks

Selection Guide

  • Prefer docxtpl when a legal, ops, or business user needs to maintain the template in Word.
  • Prefer python-docx for moderate formatting complexity where you control the document structure in code.
  • Prefer docx when the surrounding service and tests already live in Node.js.
  • Prefer mammoth for trusted, text-first conversion to HTML; it is not a fidelity-preserving renderer.
  • Prefer MarkItDown for simple DOCX-to-Markdown pipelines.
  • Prefer Docling when DOCX is only one input among many formats or you need HTML/JSON/Markdown/text output from a unified pipeline.

ASCII Flow

text
DOCX request
  |
  v
Classify file + trust level
  |-- .docx / .dotx -----> normal OOXML workflow
  |-- .doc -------------> convert to .docx first
  |-- .docm / .dotm ----> treat macros as untrusted
  |
  v
Choose lane
  |-- Word-owned template ------> docxtpl
  |-- Python structural edit ---> python-docx
  |-- Node service generation --> docx
  |-- trusted HTML conversion --> mammoth + sanitizer
  |-- Markdown / JSON ingest ---> MarkItDown or Docling
  |-- tracked-change review ----> revised DOCX + Word Compare
  |
  v
Generate, edit, or extract
  |
  v
Quality gate
  |-- parseability + unresolved tags ---> scripts/docx_quality_gate.py
  |-- comments / revisions / OOXML ----> scripts/docx_inspect_ooxml.py
  |
  v
Viewer, accessibility, and release checks

Format And Safety Caveats

  • .docx and .dotx are Office Open XML packages; .doc is legacy binary and needs conversion first.
  • .docm and .dotm are macro-enabled; do not treat them as safe content inputs.
  • python-docx can add and read comments in the main document body, but not threaded replies/resolved states, and not comment anchors in headers/footers.
  • python-docx does not provide reliable tracked-change authoring.
  • mammoth performs no sanitization of generated HTML or links from untrusted source documents.
  • Tables of contents and many Word fields are placeholders until updated in Word.

Version-Gate Before Promising A Feature

Do not assume the environment has a current library. This is the single most common way this skill causes a confident-but-wrong answer:

  • Document.add_comment() only exists from python-docx 1.2.0 onward. On an older pinned version it raises AttributeError, not a graceful fallback. Check first: python -c "import docx; print(docx.__version__)".
  • python-docx still has no public high-level property for image alt text (no .alt_text on InlineShape) as of the current 1.x line — InlineShape only documents height, width, and type. The OOXML workaround in references/accessibility-compliance.md reaches into the private _inline attribute; treat that as an implementation detail that can move between releases, re-verify after any python-docx upgrade, and prefer python-docx's own comment/style APIs wherever a public one exists instead of private attributes.
  • If a user asks for a feature this skill flags as unsupported (tracked-change authoring, threaded comment replies, resolved-state comments), say so plainly rather than approximating it with formatting hacks — a document that merely looks right (e.g., colored/struck-through text standing in for <w:ins>/<w:del>) will fail any real redline/legal review because it carries no revision metadata.

Default Workflow

  1. Identify the file type and trust level: .docx/.dotx vs .docm/.dotm vs legacy .doc.
  2. Pick the lane:
    • Template generation -> docxtpl
    • Programmatic structure edits -> python-docx or docx
    • Review/comments -> comments or Word Compare
    • LLM extraction -> MarkItDown, Docling, or mammoth
  3. Generate or modify the document.
  4. Run scripts/docx_quality_gate.py and, when needed, scripts/docx_inspect_ooxml.py.
  5. If shipping externally, validate rendering in Word plus at least one secondary viewer and apply accessibility hygiene.

Core Operations

Create A Document (Python - python-docx)

python
from docx import Document
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.shared import Inches

doc = Document()

title = doc.add_heading("Quarterly Review", 0)
title.alignment = WD_ALIGN_PARAGRAPH.CENTER

doc.add_paragraph("Executive summary goes here.")

table = doc.add_table(rows=2, cols=2)
table.style = "Table Grid"
table.rows[0].cells[0].text = "Metric"
table.rows[0].cells[1].text = "Value"
table.rows[1].cells[0].text = "Revenue"
table.rows[1].cells[1].text = "$1.2M"

doc.add_picture("chart.png", width=Inches(4.5))
doc.save("quarterly-review.docx")

Add A Review Comment (Python - python-docx)

python
from docx import Document

doc = Document()
paragraph = doc.add_paragraph("This clause needs legal review.")

comment = doc.add_comment(
    runs=paragraph.runs,
    text="Clarify whether this applies to renewals as well.",
    author="Legal",
    initials="LG",
)

comment.paragraphs[0].add_run(" Add the renewal edge case explicitly.").bold = True
doc.save("reviewable.docx")

Fill A Template (Python - docxtpl)

python
from docxtpl import DocxTemplate

doc = DocxTemplate("template.docx")
context = {
    "company_name": "Acme Corp",
    "contract_date": "2026-03-13",
    "items": [
        {"name": "Widget A", "price": 100},
        {"name": "Widget B", "price": 200},
    ],
}
doc.render(context)
doc.save("filled-template.docx")

Convert Trusted DOCX To HTML (Script)

bash
node scripts/docx_to_html.mjs input.docx output.html --style-map custom-style-map.txt --extract-images-dir output-assets/

Extract Structure For Automation (Script)

bash
python3 scripts/docx_extract.py input.docx --include headers footers hyperlinks comments images --out extracted.json

Output Quality Checklist

  • Structure: heading hierarchy, list styles, and tables are intentional and consistent.
  • Reviewability: comments or Word Compare are used for feedback-heavy workflows instead of ad hoc formatting hacks.
  • Safety: macro-enabled files are treated as untrusted; HTML generated from DOCX is sanitized before use.
  • Portability: fonts, numbering, tables, and images are checked in at least one non-Word viewer when documents are distributed.
  • Accessibility hygiene: headings, descriptive links, table headers, document language, and alt text are present where needed.
  • Release quality: run scripts/docx_quality_gate.py before shipping or batch-publishing.

Optional: AI / Automation

Use only when explicitly requested and policy-compliant.

  • Convert trusted DOCX content into Markdown/HTML/JSON for search or RAG.
  • Summarize meeting notes into a Word template, but keep humans accountable for factual accuracy.
  • Generate first-pass reports/contracts from structured data, then route through human review.

Navigation

Resources

Scripts

  • scripts/docx_inspect_ooxml.py - Dependency-free OOXML inspection for tracked changes and comments
  • scripts/docx_extract.py - Extract text, tables, metadata, and optional headers/footers/hyperlinks/comments/images to JSON
  • scripts/docx_render_template.py - Render a docxtpl template from JSON
  • scripts/docx_to_html.mjs - Convert trusted .docx to HTML with style maps and optional image extraction
  • scripts/docx_quality_gate.py - Validate parseability, unresolved template tags, tracked-change/comment signals, and optional LibreOffice conversion

Templates

Related Skills

Fact-Checking

  • Use data/sources.json as the starting set of primary sources.
  • Use web search/web fetch to verify current external facts, versions, release behavior, regulations, and platform quirks before final answers.
  • Prefer primary documentation, package pages, release pages, and official standards pages.
  • If web access is unavailable, state the limitation and mark volatile guidance as unverified.

Learnings Loop

Before applying this skill on a non-trivial task, read learnings.consolidated.md in this directory (and learnings.md if present).

After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to learnings.md via agents-skills-feedback-loop/scripts/append_learning.py. Do not modify SKILL.md itself.

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Document Docx?

Create/edit .docx files with styles, templates, comments, and extraction workflows. Use when asked to generate Word reports, contracts, proposals, or convert Word content.

Firwat Document Docx op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Document Docx besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Document Docx an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/vasilyu1983/AI-Agents-public/tree/main/frameworks/shared-skills/skills/document-docx an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Document Docx benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Document Docx benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Document Docx domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Document Docx gratis?

Jo. De Skill gëtt vum vasilyu1983 ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇