<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>DOCX on KnightLi Blog</title>
        <link>https://www.knightli.com/en/tags/docx/</link>
        <description>Recent content in DOCX on KnightLi Blog</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en</language>
        <lastBuildDate>Sat, 04 Apr 2026 11:00:00 +0800</lastBuildDate><atom:link href="https://www.knightli.com/en/tags/docx/index.xml" rel="self" type="application/rss+xml" /><item>
        <title>Analyzing Anthropic&#39;s docx Agent Skill: Features, Code Structure, Usage, and Caveats</title>
        <link>https://www.knightli.com/en/2026/04/04/analyze-docx-agent-skill/</link>
        <pubDate>Sat, 04 Apr 2026 11:00:00 +0800</pubDate>
        
        <guid>https://www.knightli.com/en/2026/04/04/analyze-docx-agent-skill/</guid>
        <description>&lt;p&gt;Anthropic&amp;rsquo;s &lt;code&gt;skills/docx&lt;/code&gt; is essentially a workflow spec plus a script toolkit for handling Word documents more reliably with AI.&lt;br&gt;
It does not just tell a model to &amp;ldquo;generate a &lt;code&gt;.docx&lt;/code&gt;.&amp;rdquo; Instead, it breaks document work into explicit paths: create, read, edit existing files, handle tracked changes, add comments, convert formats, and validate OOXML structure.&lt;/p&gt;
&lt;p&gt;If we reduce it to one line:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;It treats &lt;code&gt;.docx&lt;/code&gt; as ZIP + XML + Office compatibility constraints, not as a black box.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;what-this-skill-solves&#34;&gt;What this skill solves
&lt;/h2&gt;&lt;p&gt;When general-purpose models handle Word files, we often see the same failure patterns:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;They output text, but not a structurally valid &lt;code&gt;.docx&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;They break OOXML while editing existing documents.&lt;/li&gt;
&lt;li&gt;They do not know which XML parts to update for comments or tracked changes.&lt;/li&gt;
&lt;li&gt;Output opens in one app but behaves inconsistently across Word, LibreOffice, and Google Docs.&lt;/li&gt;
&lt;li&gt;They lack clear routing for when to use &lt;code&gt;pandoc&lt;/code&gt; vs. unpack/edit/repack.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The value of this skill is that it front-loads those decisions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;pandoc&lt;/code&gt; or unpacking for reading and analysis.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;docx-js&lt;/code&gt; for creating new &lt;code&gt;.docx&lt;/code&gt; files.&lt;/li&gt;
&lt;li&gt;Use &amp;ldquo;unpack -&amp;gt; edit XML -&amp;gt; repack -&amp;gt; validate&amp;rdquo; for existing documents.&lt;/li&gt;
&lt;li&gt;Use dedicated scripts for tracked changes/comments/schema-sensitive operations.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That approach works because Word problems are usually not about wording quality. They are about structural correctness and compatibility.&lt;/p&gt;
&lt;h2 id=&#34;directory-and-code-structure&#34;&gt;Directory and code structure
&lt;/h2&gt;&lt;p&gt;This skill can be understood in four layers.&lt;/p&gt;
&lt;h3 id=&#34;1-guidance-layer-skillmd&#34;&gt;1. Guidance layer: &lt;code&gt;SKILL.md&lt;/code&gt;
&lt;/h3&gt;&lt;p&gt;&lt;code&gt;SKILL.md&lt;/code&gt; does two important jobs:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;It defines trigger conditions.&lt;br&gt;
If a request mentions Word, &lt;code&gt;.docx&lt;/code&gt;, comments, tracked changes, TOC, page numbers, or polished document formatting, this skill should be activated.&lt;/li&gt;
&lt;li&gt;It defines execution routes.&lt;br&gt;
Different task types map to different toolchains, instead of improvising every run.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It also captures practical compatibility rules, for example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;docx-js&lt;/code&gt; defaults to A4, not US Letter.&lt;/li&gt;
&lt;li&gt;Landscape page sizing must follow &lt;code&gt;docx-js&lt;/code&gt; internals.&lt;/li&gt;
&lt;li&gt;Lists should not be built from manual Unicode bullets.&lt;/li&gt;
&lt;li&gt;Table width needs coordinated settings at table and cell levels.&lt;/li&gt;
&lt;li&gt;Image &lt;code&gt;type&lt;/code&gt; is required.&lt;/li&gt;
&lt;li&gt;Generated files should be validated.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That is a strong signal that the goal is not just &amp;ldquo;generate something,&amp;rdquo; but &amp;ldquo;generate something that is robust.&amp;rdquo;&lt;/p&gt;
&lt;h2 id=&#34;2-office-package-layer-scriptsoffice&#34;&gt;2. Office package layer: &lt;code&gt;scripts/office/*&lt;/code&gt;
&lt;/h2&gt;&lt;p&gt;This layer treats &lt;code&gt;.docx/.pptx/.xlsx&lt;/code&gt; as Open XML packages.&lt;/p&gt;
&lt;h3 id=&#34;unpackpy&#34;&gt;&lt;code&gt;unpack.py&lt;/code&gt;
&lt;/h3&gt;&lt;p&gt;This script unpacks files and prepares XML for safer editing:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Extracts ZIP package content&lt;/li&gt;
&lt;li&gt;Pretty-prints XML and &lt;code&gt;.rels&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Optionally runs &lt;code&gt;merge_runs&lt;/code&gt; for DOCX&lt;/li&gt;
&lt;li&gt;Optionally runs &lt;code&gt;simplify_redlines&lt;/code&gt; for DOCX&lt;/li&gt;
&lt;li&gt;Escapes smart quotes into XML entities&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So it is not just decompression. It normalizes content into an editing-friendly shape.&lt;/p&gt;
&lt;h3 id=&#34;packpy&#34;&gt;&lt;code&gt;pack.py&lt;/code&gt;
&lt;/h3&gt;&lt;p&gt;This script repacks a directory into &lt;code&gt;.docx/.pptx/.xlsx&lt;/code&gt;.&lt;br&gt;
Before packaging, it can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Run validation and auto-repair&lt;/li&gt;
&lt;li&gt;Condense XML formatting safely&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If &lt;code&gt;--original&lt;/code&gt; is provided, it compares and validates against the source context.&lt;br&gt;
That matters because &amp;ldquo;repacked successfully&amp;rdquo; is not equal to &amp;ldquo;semantically safe.&amp;rdquo;&lt;/p&gt;
&lt;h3 id=&#34;validatepy&#34;&gt;&lt;code&gt;validate.py&lt;/code&gt;
&lt;/h3&gt;&lt;p&gt;This is the quality gate. It checks:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;XML well-formedness&lt;/li&gt;
&lt;li&gt;Namespace correctness&lt;/li&gt;
&lt;li&gt;Unique ID constraints&lt;/li&gt;
&lt;li&gt;Relationship/content type consistency&lt;/li&gt;
&lt;li&gt;XSD compliance&lt;/li&gt;
&lt;li&gt;Whitespace preservation rules&lt;/li&gt;
&lt;li&gt;Insertion/deletion/comment marker constraints&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For DOCX work, this is a core component, not an optional extra.&lt;/p&gt;
&lt;h3 id=&#34;sofficepy&#34;&gt;&lt;code&gt;soffice.py&lt;/code&gt;
&lt;/h3&gt;&lt;p&gt;This helper wraps LibreOffice execution for restricted/sandboxed environments.&lt;br&gt;
It configures &lt;code&gt;SAL_USE_VCLPLUGIN=svp&lt;/code&gt; and can apply a shim for AF_UNIX socket limitations when needed.&lt;/p&gt;
&lt;p&gt;That tells us the skill is designed for automated agent workflows, not only local manual usage.&lt;/p&gt;
&lt;h2 id=&#34;3-word-specific-layer-comments-revisions-and-redlines&#34;&gt;3. Word-specific layer: comments, revisions, and redlines
&lt;/h2&gt;&lt;h3 id=&#34;commentpy&#34;&gt;&lt;code&gt;comment.py&lt;/code&gt;
&lt;/h3&gt;&lt;p&gt;This script adds comments to DOCX, including required package plumbing across multiple parts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;word/comments.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;commentsExtended.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;commentsIds.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;commentsExtensible.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;comment range markers in &lt;code&gt;document.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;declarations in &lt;code&gt;[Content_Types].xml&lt;/code&gt; and &lt;code&gt;document.xml.rels&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If comment parts do not exist yet, it can initialize templates and required relationships/content types.&lt;/p&gt;
&lt;h3 id=&#34;accept_changespy&#34;&gt;&lt;code&gt;accept_changes.py&lt;/code&gt;
&lt;/h3&gt;&lt;p&gt;This script accepts all tracked changes via LibreOffice headless + macro (&lt;code&gt;.uno:AcceptAllTrackedChanges&lt;/code&gt;) rather than fragile raw XML surgery.&lt;/p&gt;
&lt;p&gt;That is a pragmatic choice because accepting revisions is a behavior-level operation, not just deleting &lt;code&gt;&amp;lt;w:ins&amp;gt;&lt;/code&gt; / &lt;code&gt;&amp;lt;w:del&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;
&lt;h3 id=&#34;validatorsredliningpy&#34;&gt;&lt;code&gt;validators/redlining.py&lt;/code&gt;
&lt;/h3&gt;&lt;p&gt;This is one of the most valuable pieces.&lt;br&gt;
It removes tracked changes for a specific author in both original and modified documents, then compares resulting text to verify that changes are properly represented in revision markup.&lt;/p&gt;
&lt;p&gt;So it validates revision semantics, not only XML syntax.&lt;/p&gt;
&lt;h2 id=&#34;4-schema-and-support-layer-schemas-helpers-templates&#34;&gt;4. Schema and support layer: &lt;code&gt;schemas/&lt;/code&gt;, &lt;code&gt;helpers/&lt;/code&gt;, &lt;code&gt;templates/&lt;/code&gt;
&lt;/h2&gt;&lt;h3 id=&#34;schemas&#34;&gt;&lt;code&gt;schemas/&lt;/code&gt;
&lt;/h3&gt;&lt;p&gt;Contains OOXML/ECMA/Microsoft-related XSD files used by validators.&lt;br&gt;
Validation is therefore grounded in formal schema constraints.&lt;/p&gt;
&lt;h3 id=&#34;helpers&#34;&gt;&lt;code&gt;helpers/&lt;/code&gt;
&lt;/h3&gt;&lt;p&gt;Includes utilities such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;merge_runs.py&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;simplify_redlines.py&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These stabilize XML structure for clearer edits and diffs.&lt;/p&gt;
&lt;h3 id=&#34;templates&#34;&gt;&lt;code&gt;templates/&lt;/code&gt;
&lt;/h3&gt;&lt;p&gt;Contains XML templates needed for comment support, including:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;comments.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;commentsExtended.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;commentsIds.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;commentsExtensible.xml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;people.xml&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These templates help avoid package-level inconsistencies when creating comment-related parts.&lt;/p&gt;
&lt;h2 id=&#34;typical-usage-patterns&#34;&gt;Typical usage patterns
&lt;/h2&gt;&lt;p&gt;From &lt;code&gt;SKILL.md&lt;/code&gt;, the most common workflows are:&lt;/p&gt;
&lt;h2 id=&#34;scenario-1-readanalyze-an-existing-docx&#34;&gt;Scenario 1: Read/analyze an existing DOCX
&lt;/h2&gt;&lt;p&gt;Use &lt;code&gt;pandoc&lt;/code&gt; for text-level extraction with tracked changes:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;pandoc --track-changes&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;all document.docx -o output.md
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Use unpacking for raw XML inspection:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;python scripts/office/unpack.py document.docx unpacked/
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id=&#34;scenario-2-create-a-new-docx&#34;&gt;Scenario 2: Create a new DOCX
&lt;/h2&gt;&lt;p&gt;Use &lt;code&gt;docx-js&lt;/code&gt; for generation:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;npm install -g docx
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Then validate:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;python scripts/office/validate.py doc.docx
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id=&#34;scenario-3-edit-an-existing-docx&#34;&gt;Scenario 3: Edit an existing DOCX
&lt;/h2&gt;&lt;p&gt;Core workflow:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;python scripts/office/unpack.py document.docx unpacked/
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# edit XML under unpacked/&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;python scripts/office/pack.py unpacked/ output.docx --original document.docx
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;&lt;code&gt;--original&lt;/code&gt; is the critical part because it enables stronger structural and revision-aware checks.&lt;/p&gt;
&lt;h2 id=&#34;scenario-4-accept-all-tracked-changes&#34;&gt;Scenario 4: Accept all tracked changes
&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;python scripts/accept_changes.py input.docx output.docx
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Requires LibreOffice; useful for producing a clean post-review file.&lt;/p&gt;
&lt;h2 id=&#34;scenario-5-add-comments&#34;&gt;Scenario 5: Add comments
&lt;/h2&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;div class=&#34;chroma&#34;&gt;
&lt;table class=&#34;lntable&#34;&gt;&lt;tr&gt;&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;lnt&#34;&gt;1
&lt;/span&gt;&lt;span class=&#34;lnt&#34;&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class=&#34;lntd&#34;&gt;
&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;python comment.py unpacked/ &lt;span class=&#34;m&#34;&gt;0&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Comment text&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;python comment.py unpacked/ &lt;span class=&#34;m&#34;&gt;1&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;Reply text&amp;#34;&lt;/span&gt; --parent &lt;span class=&#34;m&#34;&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;You still need to place comment range markers in &lt;code&gt;document.xml&lt;/code&gt; where the comment should attach.&lt;/p&gt;
&lt;h2 id=&#34;key-caveats-to-remember&#34;&gt;Key caveats to remember
&lt;/h2&gt;&lt;h3 id=&#34;1-docx-is-not-a-plain-text-file&#34;&gt;1. &lt;code&gt;.docx&lt;/code&gt; is not a plain text file
&lt;/h3&gt;&lt;p&gt;A single edit may involve body XML, relationships, content types, comment parts, IDs, and schema constraints.&lt;/p&gt;
&lt;h3 id=&#34;2-docx-js-generation-still-needs-explicit-guardrails&#34;&gt;2. &lt;code&gt;docx-js&lt;/code&gt; generation still needs explicit guardrails
&lt;/h3&gt;&lt;p&gt;Defaults can be wrong for your target layout and compatibility goals.&lt;/p&gt;
&lt;h3 id=&#34;3-comments-and-tracked-changes-are-multi-part-operations&#34;&gt;3. Comments and tracked changes are multi-part operations
&lt;/h3&gt;&lt;p&gt;They are package-level features, not single-tag edits.&lt;/p&gt;
&lt;h3 id=&#34;4-opens-successfully-does-not-mean-correctly-modified&#34;&gt;4. &amp;ldquo;Opens successfully&amp;rdquo; does not mean &amp;ldquo;correctly modified&amp;rdquo;
&lt;/h3&gt;&lt;p&gt;Many issues only surface later during editing, reviewing, cross-app opening, or acceptance of changes.&lt;/p&gt;
&lt;h3 id=&#34;5-environment-readiness-matters&#34;&gt;5. Environment readiness matters
&lt;/h3&gt;&lt;p&gt;You need tools such as &lt;code&gt;pandoc&lt;/code&gt;, &lt;code&gt;LibreOffice/soffice&lt;/code&gt;, &lt;code&gt;docx-js&lt;/code&gt;, and Python deps (&lt;code&gt;defusedxml&lt;/code&gt;, &lt;code&gt;lxml&lt;/code&gt;) available.&lt;/p&gt;
&lt;h2 id=&#34;what-this-skill-is-good-for-and-not&#34;&gt;What this skill is good for (and not)
&lt;/h2&gt;&lt;h3 id=&#34;good-fit&#34;&gt;Good fit
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;Batch Word report generation&lt;/li&gt;
&lt;li&gt;Structured formal document production&lt;/li&gt;
&lt;li&gt;Automated edits to existing &lt;code&gt;.docx&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Tracked-changes aware workflows&lt;/li&gt;
&lt;li&gt;Automated comment insertion&lt;/li&gt;
&lt;li&gt;Agent/script-driven document pipelines&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;not-ideal&#34;&gt;Not ideal
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;Very simple PDF-only output cases&lt;/li&gt;
&lt;li&gt;Pure text extraction with no document fidelity requirement&lt;/li&gt;
&lt;li&gt;Fully manual visual editing workflows&lt;/li&gt;
&lt;li&gt;Zero-dependency expectations for end-to-end Word automation&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;summary&#34;&gt;Summary
&lt;/h2&gt;&lt;p&gt;Anthropic&amp;rsquo;s &lt;code&gt;skills/docx&lt;/code&gt; is strong not because it can &amp;ldquo;generate Word files,&amp;rdquo; but because it encodes why Word automation fails and how to handle those failure modes systematically.&lt;br&gt;
It combines generation, low-level XML editing, revision semantics, schema validation, and cross-app compatibility into one executable workflow.&lt;/p&gt;
&lt;p&gt;If your use case includes existing DOCX edits, comments, tracked changes, or compatibility-sensitive automation, this design is very practical and high value.&lt;/p&gt;
&lt;p&gt;Code location: &lt;a class=&#34;link&#34; href=&#34;https://github.com/anthropics/skills/tree/main/skills/docx&#34;  target=&#34;_blank&#34; rel=&#34;noopener&#34;
    &gt;https://github.com/anthropics/skills/tree/main/skills/docx&lt;/a&gt;&lt;/p&gt;
</description>
        </item>
        
    </channel>
</rss>
