Word Document Processing
Paste the following prompt into your AI chat to install this skill:
Please follow https://skillhub.cn/install/skillhub.md and install @kunlungrowth/kg-docx.
About this skill
Problem
A .docx file is a ZIP package of XML, so naive string replacement can miss w:ins, w:del, comments, and original RSID values, producing unreadable redlines or broken formatting. This skill targets engineers who need to create, read, and review Word documents in automated workflows, with a focus on verifiable output rather than ad hoc text substitution.
How It Works
- Read/analyze: extract Markdown with
pandoc, using--track-changes=allto preserve tracked changes; when comments, media, or complex structure matter, unpack and inspectword/document.xml,word/comments.xml, andword/media/. - Create documents: build and export
.docxfiles with the Nodedocxlibrary usingDocument,Paragraph, andTextRuncomponents. - Edit existing documents: plan the redline first, group changes into 3 to 10 batches by section or type, unpack the document, apply replacements with an OOXML document library, preserve original
RSIDfor unchanged text, split replacements into unchanged + deleted + inserted + unchanged, repackage, and verify by converting back to Markdown.
Boundaries
It fits new documents, text extraction, legal/contract redlines, and structural analysis; complex layout tweaks are best confirmed in a desktop client. Output includes a DocArtifact and redline notes, suitable for downstream PDF conversion or multimodal understanding.
Use Cases
- Review a contract term and change only “30 days” to “60 days” with tracked changes.
- Extract `.docx` to Markdown to verify section structure and clause text for scripts.
- Create a product spec Word document with headings, paragraphs, and text runs via `docx`.
- Unpack `word/comments.xml` to confirm how comments map to body XML content.
Best For
- Legal engineers who need contract redlines as auditable OOXML tracked changes.
- Document automation developers who need to read `.docx`, extract text, and emit structured artifacts.
- Technical writing maintainers who need to create standardized Word docs with paragraph and text-run structure.
- Content reviewers who need to inspect comments, media, and body XML mappings.
Related Skills
Turns files, references, or chat context into styled single-page HTML reports with built-in templates and preset themes.
An engineering-oriented email automation solution for batch sending, Jinja2 templates, attachments, scheduled sending, inbox monitoring, and rule-based auto-reply.
An engineering workflow for creating, editing, reviewing, analyzing, and image-converting .docx files using pandoc, docx-js, OOXML, and LibreOffice.
Pre-submission scanner for Word/PDF blind-bid files that checks margins, fonts, page numbers, and metadata against tender requirements and flags residual bidder identities.