[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75BFAAJRTBQDXM2ARFJXVVB":3,"skill-same:01M75BFAAJRTBQDXM2ARFJXVVB":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M75BFAAJRTBQDXM2ARFJXVVB","docx",null,"A .docx file is a ZIP archive containing XML files.","ruake\u002FAWARE","ruake","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F253885939?v=4","01M75AVBM7FRFTS61RZRNMZB6C","01M75AVBMYHD7500NHVANF1HKM",0,"MIT","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fdocx\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: docx\ndescription: A .docx file is a ZIP archive containing XML files.\n---\n\n# DOCX creation, editing, and analysis\n\n## Overview\n\nA .docx file is a ZIP archive containing XML files.\n\n## Quick Reference\n\n| Task | Approach |\n|------|----------|\n| Read\u002Fanalyze content | `pandoc` or unpack for raw XML |\n| Create new document | Use `docx-js` - see Creating New Documents below |\n| Edit existing document | Unpack → edit XML → repack - see Editing Existing Documents below |\n\n### Converting .doc to .docx\n\nLegacy `.doc` files must be converted before editing:\n\n```bash\npython scripts\u002Foffice\u002Fsoffice.py --headless --convert-to docx document.doc\n```\n\n### Reading Content\n\n```bash\n# Text extraction with tracked changes\npandoc --track-changes=all document.docx -o output.md\n\n# Raw XML access\npython scripts\u002Foffice\u002Funpack.py document.docx unpacked\u002F\n```\n\n### Converting to Images\n\n```bash\npython scripts\u002Foffice\u002Fsoffice.py --headless --convert-to pdf document.docx\npdftoppm -jpeg -r 150 document.pdf page\n```\n\n### Accepting Tracked Changes\n\nTo produce a clean document with all tracked changes accepted (requires LibreOffice):\n\n```bash\npython scripts\u002Faccept_changes.py input.docx output.docx\n```\n\n---\n\n## Creating New Documents\n\nGenerate .docx files with JavaScript, then validate. Install: `npm install -g docx`\n\n### Setup\n```javascript\nconst { Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell, ImageRun,\n        Header, Footer, AlignmentType, PageOrientation, LevelFormat, ExternalHyperlink,\n        InternalHyperlink, Bookmark, FootnoteReferenceRun, PositionalTab,\n        PositionalTabAlignment, PositionalTabRelativeTo, PositionalTabLeader,\n        TabStopType, TabStopPosition, Column, SectionType,\n        TableOfContents, HeadingLevel, BorderStyle, WidthType, ShadingType,\n        VerticalAlign, PageNumber, PageBreak } = require('docx');\n\nconst doc = new Document({ sections: [{ children: [\u002F* content *\u002F] }] });\nPacker.toBuffer(doc).then(buffer => fs.writeFileSync(\"doc.docx\", buffer));\n```\n\n### Validation\nAfter creating the file, validate it. If validation fails, unpack, fix the XML, and repack.\n```bash\npython scripts\u002Foffice\u002Fvalidate.py doc.docx\n```\n\n### Page Size\n\n```javascript\n\u002F\u002F CRITICAL: docx-js defaults to A4, not US Letter\n\u002F\u002F Always set page size explicitly for consistent results\nsections: [{\n  properties: {\n    page: {\n      size: {\n        width: 12240,   \u002F\u002F 8.5 inches in DXA\n        height: 15840   \u002F\u002F 11 inches in DXA\n      },\n      margin: { top: 1440, right: 1440, bottom: 1440, left: 1440 } \u002F\u002F 1 inch margins\n    }\n  },\n  children: [\u002F* content *\u002F]\n}]\n```\n\n**Common page sizes (DXA units, 1440 DXA = 1 inch):**\n\n| Paper | Width | Height | Content Width (1\" margins) |\n|-------|-------|--------|---------------------------|\n| US Letter | 12,240 | 15,840 | 9,360 |\n| A4 (default) | 11,906 | 16,838 | 9,026 |\n\n**Landscape orientation:** docx-js swaps width\u002Fheight internally, so pass portrait dimensions and let it handle the swap:\n```javascript\nsize: {\n  width: 12240,   \u002F\u002F Pass SHORT edge as width\n  height: 15840,  \u002F\u002F Pass LONG edge as height\n  orientation: PageOrientation.LANDSCAPE  \u002F\u002F docx-js swaps them in the XML\n},\n\u002F\u002F Content width = 15840 - left margin - right margin (uses the long edge)\n```\n\n### Styles (Override Built-in Headings)\n\nUse Arial as the default font (universally supported). Keep titles black for readability.\n\n```javascript\nconst doc = new Document({\n  styles: {\n    default: { document: { run: { font: \"Arial\", size: 24 } } }, \u002F\u002F 12pt default\n    paragraphStyles: [\n      \u002F\u002F IMPORTANT: Use exact IDs to override built-in styles\n      { id: \"Heading1\", name: \"Heading 1\", basedOn: \"Normal\", next: \"Normal\", quickFormat: true,\n        run: { size: 32, bold: true, font: \"Arial\" },\n        paragraph: { spacing: { before: 240, after: 240 }, outlineLevel: 0 } }, \u002F\u002F outlineLevel required for TOC\n      { id: \"Heading2\", name: \"Heading 2\", basedOn: \"Normal\", next: \"Normal\", quickFormat: true,\n        run: { size: 28, bold: true, font: \"Arial\" },\n        paragraph: { spacing: { before: 180, after: 180 }, outlineLevel: 1 } },\n    ]\n  },\n  sections: [{\n    children: [\n      new Paragraph({ heading: HeadingLevel.HEADING_1, children: [new TextRun(\"Title\")] }),\n    ]\n  }]\n});\n```\n\n### Lists (NEVER use unicode bullets)\n\n```javascript\n\u002F\u002F ❌ WRONG - never manually insert bullet characters\nnew Paragraph({ children: [new TextRun(\"• Item\")] })  \u002F\u002F BAD\nnew Paragraph({ children: [new TextRun(\"\\u2022 Item\")] })  \u002F\u002F BAD\n\n\u002F\u002F ✅ CORRECT - use numbering config with LevelFormat.BULLET\nconst doc = new Document({\n  numbering: {\n    config: [\n      { reference: \"bullets\",\n        levels: [{ level: 0, format: LevelFormat.BULLET, text: \"•\", alignment: AlignmentType.LEFT,\n          style: { paragraph: { indent: { left: 720, hanging: 360 } } } }] },\n      { reference: \"numbers\",\n        levels: [{ level: 0, format: LevelFormat.DECIMAL, text: \"%1.\", alignment: AlignmentType.LEFT,\n          style: { paragraph: { indent: { left: 720, hanging: 360 } } } }] },\n    ]\n  },\n  sections: [{\n    children: [\n      new Paragraph({ numbering: { reference: \"bullets\", level: 0 },\n        children: [new TextRun(\"Bullet item\")] }),\n      new Paragraph({ numbering: { reference: \"numbers\", level: 0 },\n        children: [new TextRun(\"Numbered item\")] }),\n    ]\n  }]\n});\n\n\u002F\u002F ⚠️ Each reference creates INDEPENDENT numbering\n\u002F\u002F Same reference = continues (1,2,3 then 4,5,6)\n\u002F\u002F Different reference = restarts (1,2,3 then 1,2,3)\n```\n\n### Tables\n\n**CRITICAL: Tables need dual widths** - set both `columnWidths` on the table AND `width` on each cell. Without both, tables render incorrectly on some platforms.\n\n```javascript\n\u002F\u002F CRITICAL: Always set table width for consistent rendering\n\u002F\u002F CRITICAL: Use ShadingType.CLEAR (not SOLID) to prevent black backgrounds\nconst border = { style: BorderStyle.SINGLE, size: 1, color: \"CCCCCC\" };\nconst borders = { top: border, bottom: border, left: border, right: border };\n\nnew Table({\n  width: { size: 9360, type: WidthType.DXA }, \u002F\u002F Always use DXA (percentages break in Google Docs)\n  columnWidths: [4680, 4680], \u002F\u002F Must sum to table width (DXA: 1440 = 1 inch)\n  rows: [\n    new TableRow({\n      children: [\n        new TableCell({\n          borders,\n          width: { size: 4680, type: WidthType.DXA }, \u002F\u002F Also set on each cell\n          shading: { fill: \"D5E8F0\", type: ShadingType.CLEAR }, \u002F\u002F CLEAR not SOLID\n          margins: { top: 80, bottom: 80, left: 120, right: 120 }, \u002F\u002F Cell padding (internal, not added to width)\n          children: [new Paragraph({ children: [new TextRun(\"Cell\")] })]\n        })\n      ]\n    })\n  ]\n})\n```\n\n**Table width calculation:**\n\nAlways use `WidthType.DXA` — `WidthType.PERCENTAGE` breaks in Google Docs.\n\n```javascript\n\u002F\u002F Table width = sum of columnWidths = content width\n\u002F\u002F US Letter with 1\" margins: 12240 - 2880 = 9360 DXA\nwidth: { size: 9360, type: WidthType.DXA },\ncolumnWidths: [7000, 2360]  \u002F\u002F Must sum to table width\n```\n\n**Width rules:**\n- **Always use `WidthType.DXA`** — never `WidthType.PERCENTAGE` (incompatible with Google Docs)\n- Table width must equal the sum of `columnWidths`\n- Cell `width` must match corresponding `columnWidth`\n- Cell `margins` are internal padding - they reduce content area, not add to cell width\n- For full-width tables: use content width (page width minus left and right margins)\n\n### Images\n\n```javascript\n\u002F\u002F CRITICAL: type parameter is REQUIRED\nnew Paragraph({\n  children: [new ImageRun({\n    type: \"png\", \u002F\u002F Required: png, jpg, jpeg, gif, bmp, svg\n    data: fs.readFileSync(\"image.png\"),\n    transformation: { width: 200, height: 150 },\n    altText: { title: \"Title\", description: \"Desc\", name: \"Name\" } \u002F\u002F All three required\n  })]\n})\n```\n\n### Page Breaks\n\n```javascript\n\u002F\u002F CRITICAL: PageBreak must be inside a Paragraph\nnew Paragraph({ children: [new PageBreak()] })\n\n\u002F\u002F Or use pageBreakBefore\nnew Paragraph({ pageBreakBefore: true, children: [new TextRun(\"New page\")] })\n```\n\n### Hyperlinks\n\n```javascript\n\u002F\u002F External link\nnew Paragraph({\n  children: [new ExternalHyperlink({\n    children: [new TextRun({ text: \"Click here\", style: \"Hyperlink\" })],\n    link: \"https:\u002F\u002Fexample.com\",\n  })]\n})\n\n\u002F\u002F Internal link (bookmark + reference)\n\u002F\u002F 1. Create bookmark at destination\nnew Paragraph({ heading: HeadingLevel.HEADING_1, children: [\n  new Bookmark({ id: \"chapter1\", children: [new TextRun(\"Chapter 1\")] }),\n]})\n\u002F\u002F 2. Link to it\nnew Paragraph({ children: [new InternalHyperlink({\n  children: [new TextRun({ text: \"See Chapter 1\", style: \"Hyperlink\" })],\n  anchor: \"chapter1\",\n})]})\n```\n\n### Footnotes\n\n```javascript\nconst doc = new Document({\n  footnotes: {\n    1: { children: [new Paragraph(\"Source: Annual Report 2024\")] },\n    2: { children: [new Paragraph(\"See appendix for methodology\")] },\n  },\n  sections: [{\n    children: [new Paragraph({\n      children: [\n        new TextRun(\"Revenue grew 15%\"),\n        new FootnoteReferenceRun(1),\n        new TextRun(\" using adjusted metrics\"),\n        new FootnoteReferenceRun(2),\n      ],\n    })]\n  }]\n});\n```\n\n### Tab Stops\n\n```javascript\n\u002F\u002F Right-align text on same line (e.g., date opposite a title)\nnew Paragraph({\n  children: [\n    new TextRun(\"Company Name\"),\n    new TextRun(\"\\tJanuary 2025\"),\n  ],\n  tabStops: [{ type: TabStopType.RIGHT, position: TabStopPosition.MAX }],\n})\n\n\u002F\u002F Dot leader (e.g., TOC-style)\nnew Paragraph({\n  children: [\n    new TextRun(\"Introduction\"),\n    new TextRun({ children: [\n      new PositionalTab({\n        alignment: PositionalTabAlignment.RIGHT,\n        relativeTo: PositionalTabRelativeTo.MARGIN,\n        leader: PositionalTabLeader.DOT,\n      }),\n      \"3\",\n    ]}),\n  ],\n})\n```\n\n### Multi-Column Layouts\n\n```javascript\n\u002F\u002F Equal-width columns\nsections: [{\n  properties: {\n    column: {\n      count: 2,          \u002F\u002F number of columns\n      space: 720,        \u002F\u002F gap between columns in DXA (720 = 0.5 inch)\n      equalWidth: true,\n      separate: true,    \u002F\u002F vertical line between columns\n    },\n  },\n  children: [\u002F* content flows naturally across columns *\u002F]\n}]\n\n\u002F\u002F Custom-width columns (equalWidth must be false)\nsections: [{\n  properties: {\n    column: {\n      equalWidth: false,\n      children: [\n        new Column({ width: 5400, space: 720 }),\n        new Column({ width: 3240 }),\n      ],\n    },\n  },\n  children: [\u002F* content *\u002F]\n}]\n```\n\nForce a column break with a new section using `type: SectionType.NEXT_COLUMN`.\n\n### Table of Contents\n\n```javascript\n\u002F\u002F CRITICAL: Headings must use HeadingLevel ONLY - no custom styles\nnew TableOfContents(\"Table of Contents\", { hyperlink: true, headingStyleRange: \"1-3\" })\n```\n\n### Headers\u002FFooters\n\n```javascript\nsections: [{\n  properties: {\n    page: { margin: { top: 1440, right: 1440, bottom: 1440, left: 1440 } } \u002F\u002F 1440 = 1 inch\n  },\n  headers: {\n    default: new Header({ children: [new Paragraph({ children: [new TextRun(\"Header\")] })] })\n  },\n  footers: {\n    default: new Footer({ children: [new Paragraph({\n      children: [new TextRun(\"Page \"), new TextRun({ children: [PageNumber.CURRENT] })]\n    })] })\n  },\n  children: [\u002F* content *\u002F]\n}]\n```\n\n### Critical Rules for docx-js\n\n- **Set page size explicitly** - docx-js defaults to A4; use US Letter (12240 x 15840 DXA) for US documents\n- **Landscape: pass portrait dimensions** - docx-js swaps width\u002Fheight internally; pass short edge as `width`, long edge as `height`, and set `orientation: PageOrientation.LANDSCAPE`\n- **Never use `\\n`** - use separate Paragraph elements\n- **Never use unicode bullets** - use `LevelFormat.BULLET` with numbering config\n- **PageBreak must be in Paragraph** - standalone creates invalid XML\n- **ImageRun requires `type`** - always specify png\u002Fjpg\u002Fetc\n- **Always set table `width` with DXA** - never use `WidthType.PERCENTAGE` (breaks in Google Docs)\n- **Tables need dual widths** - `columnWidths` array AND cell `width`, both must match\n- **Table width = sum of columnWidths** - for DXA, ensure they add up exactly\n- **Always add cell margins** - use `margins: { top: 80, bottom: 80, left: 120, right: 120 }` for readable padding\n- **Use `ShadingType.CLEAR`** - never SOLID for table shading\n- **Never use tables as dividers\u002Frules** - cells have minimum height and render as empty boxes (including in headers\u002Ffooters); use `border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: \"2E75B6\", space: 1 } }` on a Paragraph instead. For two-column footers, use tab stops (see Tab Stops section), not tables\n- **TOC requires HeadingLevel only** - no custom styles on heading paragraphs\n- **Override built-in styles** - use exact IDs: \"Heading1\", \"Heading2\", etc.\n- **Include `outlineLevel`** - required for TOC (0 for H1, 1 for H2, etc.)\n\n---\n\n## Editing Existing Documents\n\n**Follow all 3 steps in order.**\n\n### Step 1: Unpack\n```bash\npython scripts\u002Foffice\u002Funpack.py document.docx unpacked\u002F\n```\nExtracts XML, pretty-prints, merges adjacent runs, and converts smart quotes to XML entities (`&#x201C;` etc.) so they survive editing. Use `--merge-runs false` to skip run merging.\n\n### Step 2: Edit XML\n\nEdit files in `unpacked\u002Fword\u002F`. See XML Reference below for patterns.\n\n**Use \"Claude\" as the author** for tracked changes and comments, unless the user explicitly requests use of a different name.\n\n**Use the Edit tool directly for string replacement. Do not write Python scripts.** Scripts introduce unnecessary complexity. The Edit tool shows exactly what is being replaced.\n\n**CRITICAL: Use smart quotes for new content.** When adding text with apostrophes or quotes, use XML entities to produce smart quotes:\n```xml\n\u003C!-- Use these entities for professional typography -->\n\u003Cw:t>Here&#x2019;s a quote: &#x201C;Hello&#x201D;\u003C\u002Fw:t>\n```\n| Entity | Character |\n|--------|-----------|\n| `&#x2018;` | ‘ (left single) |\n| `&#x2019;` | ’ (right single \u002F apostrophe) |\n| `&#x201C;` | “ (left double) |\n| `&#x201D;` | ” (right double) |\n\n**Adding comments:** Use `comment.py` to handle boilerplate across multiple XML files (text must be pre-escaped XML):\n```bash\npython scripts\u002Fcomment.py unpacked\u002F 0 \"Comment text with &amp; and &#x2019;\"\npython scripts\u002Fcomment.py unpacked\u002F 1 \"Reply text\" --parent 0  # reply to comment 0\npython scripts\u002Fcomment.py unpacked\u002F 0 \"Text\" --author \"Custom Author\"  # custom author name\n```\nThen add markers to document.xml (see Comments in XML Reference).\n\n### Step 3: Pack\n```bash\npython scripts\u002Foffice\u002Fpack.py unpacked\u002F output.docx --original document.docx\n```\nValidates with auto-repair, condenses XML, and creates DOCX. Use `--validate false` to skip.\n\n**Auto-repair will fix:**\n- `durableId` >= 0x7FFFFFFF (regenerates valid ID)\n- Missing `xml:space=\"preserve\"` on `\u003Cw:t>` with whitespace\n\n**Auto-repair won't fix:**\n- Malformed XML, invalid element nesting, missing relationships, schema violations\n\n### Common Pitfalls\n\n- **Replace entire `\u003Cw:r>` elements**: When adding tracked changes, replace the whole `\u003Cw:r>...\u003C\u002Fw:r>` block with `\u003Cw:del>...\u003Cw:ins>...` as siblings. Don't inject tracked change tags inside a run.\n- **Preserve `\u003Cw:rPr>` formatting**: Copy the original run's `\u003Cw:rPr>` block into your tracked change runs to maintain bold, font size, etc.\n\n---\n\n## XML Reference\n\n### Schema Compliance\n\n- **Element order in `\u003Cw:pPr>`**: `\u003Cw:pStyle>`, `\u003Cw:numPr>`, `\u003Cw:spacing>`, `\u003Cw:ind>`, `\u003Cw:jc>`, `\u003Cw:rPr>` last\n- **Whitespace**: Add `xml:space=\"preserve\"` to `\u003Cw:t>` with leading\u002Ftrailing spaces\n- **RSIDs**: Must be 8-digit hex (e.g., `00AB1234`)\n\n### Tracked Changes\n\n**Insertion:**\n```xml\n\u003Cw:ins w:id=\"1\" w:author=\"Claude\" w:date=\"2025-01-01T00:00:00Z\">\n  \u003Cw:r>\u003Cw:t>inserted text\u003C\u002Fw:t>\u003C\u002Fw:r>\n\u003C\u002Fw:ins>\n```\n\n**Deletion:**\n```xml\n\u003Cw:del w:id=\"2\" w:author=\"Claude\" w:date=\"2025-01-01T00:00:00Z\">\n  \u003Cw:r>\u003Cw:delText>deleted text\u003C\u002Fw:delText>\u003C\u002Fw:r>\n\u003C\u002Fw:del>\n```\n\n**Inside `\u003Cw:del>`**: Use `\u003Cw:delText>` instead of `\u003Cw:t>`, and `\u003Cw:delInstrText>` instead of `\u003Cw:instrText>`.\n\n**Minimal edits** - only mark what changes:\n```xml\n\u003C!-- Change \"30 days\" to \"60 days\" -->\n\u003Cw:r>\u003Cw:t>The term is \u003C\u002Fw:t>\u003C\u002Fw:r>\n\u003Cw:del w:id=\"1\" w:author=\"Claude\" w:date=\"...\">\n  \u003Cw:r>\u003Cw:delText>30\u003C\u002Fw:delText>\u003C\u002Fw:r>\n\u003C\u002Fw:del>\n\u003Cw:ins w:id=\"2\" w:author=\"Claude\" w:date=\"...\">\n  \u003Cw:r>\u003Cw:t>60\u003C\u002Fw:t>\u003C\u002Fw:r>\n\u003C\u002Fw:ins>\n\u003Cw:r>\u003Cw:t> days.\u003C\u002Fw:t>\u003C\u002Fw:r>\n```\n\n**Deleting entire paragraphs\u002Flist items** - when removing ALL content from a paragraph, also mark the paragraph mark as deleted so it merges with the next paragraph. Add `\u003Cw:del\u002F>` inside `\u003Cw:pPr>\u003Cw:rPr>`:\n```xml\n\u003Cw:p>\n  \u003Cw:pPr>\n    \u003Cw:numPr>...\u003C\u002Fw:numPr>  \u003C!-- list numbering if present -->\n    \u003Cw:rPr>\n      \u003Cw:del w:id=\"1\" w:author=\"Claude\" w:date=\"2025-01-01T00:00:00Z\"\u002F>\n    \u003C\u002Fw:rPr>\n  \u003C\u002Fw:pPr>\n  \u003Cw:del w:id=\"2\" w:author=\"Claude\" w:date=\"2025-01-01T00:00:00Z\">\n    \u003Cw:r>\u003Cw:delText>Entire paragraph content being deleted...\u003C\u002Fw:delText>\u003C\u002Fw:r>\n  \u003C\u002Fw:del>\n\u003C\u002Fw:p>\n```\nWithout the `\u003Cw:del\u002F>` in `\u003Cw:pPr>\u003Cw:rPr>`, accepting changes leaves an empty paragraph\u002Flist item.\n\n**Rejecting another author's insertion** - nest deletion inside their insertion:\n```xml\n\u003Cw:ins w:author=\"Jane\" w:id=\"5\">\n  \u003Cw:del w:author=\"Claude\" w:id=\"10\">\n    \u003Cw:r>\u003Cw:delText>their inserted text\u003C\u002Fw:delText>\u003C\u002Fw:r>\n  \u003C\u002Fw:del>\n\u003C\u002Fw:ins>\n```\n\n**Restoring another author's deletion** - add insertion after (don't modify their deletion):\n```xml\n\u003Cw:del w:author=\"Jane\" w:id=\"5\">\n  \u003Cw:r>\u003Cw:delText>deleted text\u003C\u002Fw:delText>\u003C\u002Fw:r>\n\u003C\u002Fw:del>\n\u003Cw:ins w:author=\"Claude\" w:id=\"10\">\n  \u003Cw:r>\u003Cw:t>deleted text\u003C\u002Fw:t>\u003C\u002Fw:r>\n\u003C\u002Fw:ins>\n```\n\n### Comments\n\nAfter running `comment.py` (see Step 2), add markers to document.xml. For replies, use `--parent` flag and nest markers inside the parent's.\n\n**CRITICAL: `\u003Cw:commentRangeStart>` and `\u003Cw:commentRangeEnd>` are siblings of `\u003Cw:r>`, never inside `\u003Cw:r>`.**\n\n```xml\n\u003C!-- Comment markers are direct children of w:p, never inside w:r -->\n\u003Cw:commentRangeStart w:id=\"0\"\u002F>\n\u003Cw:del w:id=\"1\" w:author=\"Claude\" w:date=\"2025-01-01T00:00:00Z\">\n  \u003Cw:r>\u003Cw:delText>deleted\u003C\u002Fw:delText>\u003C\u002Fw:r>\n\u003C\u002Fw:del>\n\u003Cw:r>\u003Cw:t> more text\u003C\u002Fw:t>\u003C\u002Fw:r>\n\u003Cw:commentRangeEnd w:id=\"0\"\u002F>\n\u003Cw:r>\u003Cw:rPr>\u003Cw:rStyle w:val=\"CommentReference\"\u002F>\u003C\u002Fw:rPr>\u003Cw:commentReference w:id=\"0\"\u002F>\u003C\u002Fw:r>\n\n\u003C!-- Comment 0 with reply 1 nested inside -->\n\u003Cw:commentRangeStart w:id=\"0\"\u002F>\n  \u003Cw:commentRangeStart w:id=\"1\"\u002F>\n  \u003Cw:r>\u003Cw:t>text\u003C\u002Fw:t>\u003C\u002Fw:r>\n  \u003Cw:commentRangeEnd w:id=\"1\"\u002F>\n\u003Cw:commentRangeEnd w:id=\"0\"\u002F>\n\u003Cw:r>\u003Cw:rPr>\u003Cw:rStyle w:val=\"CommentReference\"\u002F>\u003C\u002Fw:rPr>\u003Cw:commentReference w:id=\"0\"\u002F>\u003C\u002Fw:r>\n\u003Cw:r>\u003Cw:rPr>\u003Cw:rStyle w:val=\"CommentReference\"\u002F>\u003C\u002Fw:rPr>\u003Cw:commentReference w:id=\"1\"\u002F>\u003C\u002Fw:r>\n```\n\n### Images\n\n1. Add image file to `word\u002Fmedia\u002F`\n2. Add relationship to `word\u002F_rels\u002Fdocument.xml.rels`:\n```xml\n\u003CRelationship Id=\"rId5\" Type=\"...\u002Fimage\" Target=\"media\u002Fimage1.png\"\u002F>\n```\n3. Add content type to `[Content_Types].xml`:\n```xml\n\u003CDefault Extension=\"png\" ContentType=\"image\u002Fpng\"\u002F>\n```\n4. Reference in document.xml:\n```xml\n\u003Cw:drawing>\n  \u003Cwp:inline>\n    \u003Cwp:extent cx=\"914400\" cy=\"914400\"\u002F>  \u003C!-- EMUs: 914400 = 1 inch -->\n    \u003Ca:graphic>\n      \u003Ca:graphicData uri=\"...\u002Fpicture\">\n        \u003Cpic:pic>\n          \u003Cpic:blipFill>\u003Ca:blip r:embed=\"rId5\"\u002F>\u003C\u002Fpic:blipFill>\n        \u003C\u002Fpic:pic>\n      \u003C\u002Fa:graphicData>\n    \u003C\u002Fa:graphic>\n  \u003C\u002Fwp:inline>\n\u003C\u002Fw:drawing>\n```\n\n---\n\n## Dependencies\n\n- **pandoc**: Text extraction\n- **docx**: `npm install -g docx` (new documents)\n- **LibreOffice**: PDF conversion (auto-configured for sandboxed environments via `scripts\u002Foffice\u002Fsoffice.py`)\n- **Poppler**: `pdftoppm` for images\n","# DOCX creation, editing, and analysis\n\n## Overview\n\nA .docx file is a ZIP archive containing XML files.\n\n## Quick Reference\n\n| Task | Approach |\n|------|----------|\n| Read\u002Fanalyze content | `pandoc` or unpack for raw XML |\n| Create new document | Use `docx-js` - see Creating New Documents below |\n| Edit existing document | Unpack → edit XML → repack - see Editing Existing Documents below |\n\n### Converting .doc to .docx\n\nLegacy `.doc` files must be converted before editing:\n\n```bash\npython scripts\u002Foffice\u002Fsoffice.py --headless --convert-to docx document.doc\n```\n\n### Reading Content\n\n```bash\n# Text extraction with tracked changes\npandoc --track-changes=all document.docx -o output.md\n\n# Raw XML access\npython scripts\u002Foffice\u002Funpack.py document.docx unpacked\u002F\n```\n\n### Converting to Images\n\n```bash\npython scripts\u002Foffice\u002Fsoffice.py --headless --convert-to pdf document.docx\npdftoppm -jpeg -r 150 document.pdf page\n```\n\n### Accepting Tracked Changes\n\nTo produce a clean document with all tracked changes accepted (requires LibreOffice):\n\n```bash\npython scripts\u002Faccept_changes.py input.docx output.docx\n```\n\n---\n\n## Creating New Documents\n\nGenerate .docx files with JavaScript, then validate. Install: `npm install -g docx`\n\n### Setup\n```javascript\nconst { Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell, ImageRun,\n        Header, Footer, AlignmentType, PageOrientation, LevelFormat, ExternalHyperlink,\n        InternalHyperlink, Bookmark, FootnoteReferenceRun, PositionalTab,\n        PositionalTabAlignment, PositionalTabRelativeTo, PositionalTabLeader,\n        TabStopType, TabStopPosition, Column, SectionType,\n        TableOfContents, HeadingLevel, BorderStyle, WidthType, ShadingType,\n        VerticalAlign, PageNumber, PageBreak } = require('docx');\n\nconst doc = new Document({ sections: [{ children: [\u002F* content *\u002F] }] });\nPacker.toBuffer(doc).then(buffer => fs.writeFileSync(\"doc.docx\", buffer));\n```\n\n### Validation\nAfter creating the file, validate it. If validation fails, unpack, fix the XML, and repack.\n```bash\npython scripts\u002Foffice\u002Fvalidate.py doc.docx\n```\n\n### Page Size\n\n```javascript\n\u002F\u002F CRITICAL: docx-js defaults to A4, not US Letter\n\u002F\u002F Always set page size explicitly for consistent results\nsections: [{\n  properties: {\n    page: {\n      size: {\n        width: 12240,   \u002F\u002F 8.5 inches in DXA\n        height: 15840   \u002F\u002F 11 inches in DXA\n      },\n      margin: { top: 1440, right: 1440, bottom: 1440, left: 1440 } \u002F\u002F 1 inch margins\n    }\n  },\n  children: [\u002F* content *\u002F]\n}]\n```\n\n**Common page sizes (DXA units, 1440 DXA = 1 inch):**\n\n| Paper | Width | Height | Content Width (1\" margins) |\n|-------|-------|--------|---------------------------|\n| US Letter | 12,240 | 15,840 | 9,360 |\n| A4 (default) | 11,906 | 16,838 | 9,026 |\n\n**Landscape orientation:** docx-js swaps width\u002Fheight internally, so pass portrait dimensions and let it handle the swap:\n```javascript\nsize: {\n  width: 12240,   \u002F\u002F Pass SHORT edge as width\n  height: 15840,  \u002F\u002F Pass LONG edge as height\n  orientation: PageOrientation.LANDSCAPE  \u002F\u002F docx-js swaps them in the XML\n},\n\u002F\u002F Content width = 15840 - left margin - right margin (uses the long edge)\n```\n\n### Styles (Override Built-in Headings)\n\nUse Arial as the default font (universally supported). Keep titles black for readability.\n\n```javascript\nconst doc = new Document({\n  styles: {\n    default: { document: { run: { font: \"Arial\", size: 24 } } }, \u002F\u002F 12pt default\n    paragraphStyles: [\n      \u002F\u002F IMPORTANT: Use exact IDs to override built-in styles\n      { id: \"Heading1\", name: \"Heading 1\", basedOn: \"Normal\", next: \"Normal\", quickFormat: true,\n        run: { size: 32, bold: true, font: \"Arial\" },\n        paragraph: { spacing: { before: 240, after: 240 }, outlineLevel: 0 } }, \u002F\u002F outlineLevel required for TOC\n      { id: \"Heading2\", name: \"Heading 2\", basedOn: \"Normal\", next: \"Normal\", quickFormat: true,\n        run: { size: 28, bold: true, font: \"Arial\" },\n        paragraph: { spacing: { before: 180, after: 180 }, outlineLevel: 1 } },\n    ]\n  },\n  sections: [{\n    children: [\n      new Paragraph({ heading: HeadingLevel.HEADING_1, children: [new TextRun(\"Title\")] }),\n    ]\n  }]\n});\n```\n\n### Lists (NEVER use unicode bullets)\n\n```javascript\n\u002F\u002F ❌ WRONG - never manually insert bullet characters\nnew Paragraph({ children: [new TextRun(\"• Item\")] })  \u002F\u002F BAD\nnew Paragraph({ children: [new TextRun(\"\\u2022 Item\")] })  \u002F\u002F BAD\n\n\u002F\u002F ✅ CORRECT - use numbering config with LevelFormat.BULLET\nconst doc = new Document({\n  numbering: {\n    config: [\n      { reference: \"bullets\",\n        levels: [{ level: 0, format: LevelFormat.BULLET, text: \"•\", alignment: AlignmentType.LEFT,\n          style: { paragraph: { indent: { left: 720, hanging: 360 } } } }] },\n      { reference: \"numbers\",\n        levels: [{ level: 0, format: LevelFormat.DECIMAL, text: \"%1.\", alignment: AlignmentType.LEFT,\n          style: { paragraph: { indent: { left: 720, hanging: 360 } } } }] },\n    ]\n  },\n  sections: [{\n    children: [\n      new Paragraph({ numbering: { reference: \"bullets\", level: 0 },\n        children: [new TextRun(\"Bullet item\")] }),\n      new Paragraph({ numbering: { reference: \"numbers\", level: 0 },\n        children: [new TextRun(\"Numbered item\")] }),\n    ]\n  }]\n});\n\n\u002F\u002F ⚠️ Each reference creates INDEPENDENT numbering\n\u002F\u002F Same reference = continues (1,2,3 then 4,5,6)\n\u002F\u002F Different reference = restarts (1,2,3 then 1,2,3)\n```\n\n### Tables\n\n**CRITICAL: Tables need dual widths** - set both `columnWidths` on the table AND `width` on each cell. Without both, tables render incorrectly on some platforms.\n\n```javascript\n\u002F\u002F CRITICAL: Always set table width for consistent rendering\n\u002F\u002F CRITICAL: Use ShadingType.CLEAR (not SOLID) to prevent black backgrounds\nconst border = { style: BorderStyle.SINGLE, size: 1, color: \"CCCCCC\" };\nconst borders = { top: border, bottom: border, left: border, right: border };\n\nnew Table({\n  width: { size: 9360, type: WidthType.DXA }, \u002F\u002F Always use DXA (percentages break in Google Docs)\n  columnWidths: [4680, 4680], \u002F\u002F Must sum to table width (DXA: 1440 = 1 inch)\n  rows: [\n    new TableRow({\n      children: [\n        new TableCell({\n          borders,\n          width: { size: 4680, type: WidthType.DXA }, \u002F\u002F Also set on each cell\n          shading: { fill: \"D5E8F0\", type: ShadingType.CLEAR }, \u002F\u002F CLEAR not SOLID\n          margins: { top: 80, bottom: 80, left: 120, right: 120 }, \u002F\u002F Cell padding (internal, not added to width)\n          children: [new Paragraph({ children: [new TextRun(\"Cell\")] })]\n        })\n      ]\n    })\n  ]\n})\n```\n\n**Table width calculation:**\n\nAlways use `WidthType.DXA` — `WidthType.PERCENTAGE` breaks in Google Docs.\n\n```javascript\n\u002F\u002F Table width = sum of columnWidths = content width\n\u002F\u002F US Letter with 1\" margins: 12240 - 2880 = 9360 DXA\nwidth: { size: 9360, type: WidthType.DXA },\ncolumnWidths: [7000, 2360]  \u002F\u002F Must sum to table width\n```\n\n**Width rules:**\n- **Always use `WidthType.DXA`** — never `WidthType.PERCENTAGE` (incompatible with Google Docs)\n- Table width must equal the sum of `columnWidths`\n- Cell `width` must match corresponding `columnWidth`\n- Cell `margins` are internal padding - they reduce content area, not add to cell width\n- For full-width tables: use content width (page width minus left and right margins)\n\n### Images\n\n```javascript\n\u002F\u002F CRITICAL: type parameter is REQUIRED\nnew Paragraph({\n  children: [new ImageRun({\n    type: \"png\", \u002F\u002F Required: png, jpg, jpeg, gif, bmp, svg\n    data: fs.readFileSync(\"image.png\"),\n    transformation: { width: 200, height: 150 },\n    altText: { title: \"Title\", description: \"Desc\", name: \"Name\" } \u002F\u002F All three required\n  })]\n})\n```\n\n### Page Breaks\n\n```javascript\n\u002F\u002F CRITICAL: PageBreak must be inside a Paragraph\nnew Paragraph({ children: [new PageBreak()] })\n\n\u002F\u002F Or use pageBreakBefore\nnew Paragraph({ pageBreakBefore: true, children: [new TextRun(\"New page\")] })\n```\n\n### Hyperlinks\n\n```javascript\n\u002F\u002F External link\nnew Paragraph({\n  children: [new ExternalHyperlink({\n    children: [new TextRun({ text: \"Click here\", style: \"Hyperlink\" })],\n    link: \"https:\u002F\u002Fexample.com\",\n  })]\n})\n\n\u002F\u002F Internal link (bookmark + reference)\n\u002F\u002F 1. Create bookmark at destination\nnew Paragraph({ heading: HeadingLevel.HEADING_1, children: [\n  new Bookmark({ id: \"chapter1\", children: [new TextRun(\"Chapter 1\")] }),\n]})\n\u002F\u002F 2. Link to it\nnew Paragraph({ children: [new InternalHyperlink({\n  children: [new TextRun({ text: \"See Chapter 1\", style: \"Hyperlink\" })],\n  anchor: \"chapter1\",\n})]})\n```\n\n### Footnotes\n\n```javascript\nconst doc = new Document({\n  footnotes: {\n    1: { children: [new Paragraph(\"Source: Annual Report 2024\")] },\n    2: { children: [new Paragraph(\"See appendix for methodology\")] },\n  },\n  sections: [{\n    children: [new Paragraph({\n      children: [\n        new TextRun(\"Revenue grew 15%\"),\n        new FootnoteReferenceRun(1),\n        new TextRun(\" using adjusted metrics\"),\n        new FootnoteReferenceRun(2),\n      ],\n    })]\n  }]\n});\n```\n\n### Tab Stops\n\n```javascript\n\u002F\u002F Right-align text on same line (e.g., date opposite a title)\nnew Paragraph({\n  children: [\n    new TextRun(\"Company Name\"),\n    new TextRun(\"\\tJanuary 2025\"),\n  ],\n  tabStops: [{ type: TabStopType.RIGHT, position: TabStopPosition.MAX }],\n})\n\n\u002F\u002F Dot leader (e.g., TOC-style)\nnew Paragraph({\n  children: [\n    new TextRun(\"Introduction\"),\n    new TextRun({ children: [\n      new PositionalTab({\n        alignment: PositionalTabAlignment.RIGHT,\n        relativeTo: PositionalTabRelativeTo.MARGIN,\n        leader: PositionalTabLeader.DOT,\n      }),\n      \"3\",\n    ]}),\n  ],\n})\n```\n\n### Multi-Column Layouts\n\n```javascript\n\u002F\u002F Equal-width columns\nsections: [{\n  properties: {\n    column: {\n      count: 2,          \u002F\u002F number of columns\n      space: 720,        \u002F\u002F gap between columns in DXA (720 = 0.5 inch)\n      equalWidth: true,\n      separate: true,    \u002F\u002F vertical line between columns\n    },\n  },\n  children: [\u002F* content flows naturally across columns *\u002F]\n}]\n\n\u002F\u002F Custom-width columns (equalWidth must be false)\nsections: [{\n  properties: {\n    column: {\n      equalWidth: false,\n      children: [\n        new Column({ width: 5400, space: 720 }),\n        new Column({ width: 3240 }),\n      ],\n    },\n  },\n  children: [\u002F* content *\u002F]\n}]\n```\n\nForce a column break with a new section using `type: SectionType.NEXT_COLUMN`.\n\n### Table of Contents\n\n```javascript\n\u002F\u002F CRITICAL: Headings must use HeadingLevel ONLY - no custom styles\nnew TableOfContents(\"Table of Contents\", { hyperlink: true, headingStyleRange: \"1-3\" })\n```\n\n### Headers\u002FFooters\n\n```javascript\nsections: [{\n  properties: {\n    page: { margin: { top: 1440, right: 1440, bottom: 1440, left: 1440 } } \u002F\u002F 1440 = 1 inch\n  },\n  headers: {\n    default: new Header({ children: [new Paragraph({ children: [new TextRun(\"Header\")] })] })\n  },\n  footers: {\n    default: new Footer({ children: [new Paragraph({\n      children: [new TextRun(\"Page \"), new TextRun({ children: [PageNumber.CURRENT] })]\n    })] })\n  },\n  children: [\u002F* content *\u002F]\n}]\n```\n\n### Critical Rules for docx-js\n\n- **Set page size explicitly** - docx-js defaults to A4; use US Letter (12240 x 15840 DXA) for US documents\n- **Landscape: pass portrait dimensions** - docx-js swaps width\u002Fheight internally; pass short edge as `width`, long edge as `height`, and set `orientation: PageOrientation.LANDSCAPE`\n- **Never use `\\n`** - use separate Paragraph elements\n- **Never use unicode bullets** - use `LevelFormat.BULLET` with numbering config\n- **PageBreak must be in Paragraph** - standalone creates invalid XML\n- **ImageRun requires `type`** - always specify png\u002Fjpg\u002Fetc\n- **Always set table `width` with DXA** - never use `WidthType.PERCENTAGE` (breaks in Google Docs)\n- **Tables need dual widths** - `columnWidths` array AND cell `width`, both must match\n- **Table width = sum of columnWidths** - for DXA, ensure they add up exactly\n- **Always add cell margins** - use `margins: { top: 80, bottom: 80, left: 120, right: 120 }` for readable padding\n- **Use `ShadingType.CLEAR`** - never SOLID for table shading\n- **Never use tables as dividers\u002Frules** - cells have minimum height and render as empty boxes (including in headers\u002Ffooters); use `border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: \"2E75B6\", space: 1 } }` on a Paragraph instead. For two-column footers, use tab stops (see Tab Stops section), not tables\n- **TOC requires HeadingLevel only** - no custom styles on heading paragraphs\n- **Override built-in styles** - use exact IDs: \"Heading1\", \"Heading2\", etc.\n- **Include `outlineLevel`** - required for TOC (0 for H1, 1 for H2, etc.)\n\n---\n\n## Editing Existing Documents\n\n**Follow all 3 steps in order.**\n\n### Step 1: Unpack\n```bash\npython scripts\u002Foffice\u002Funpack.py document.docx unpacked\u002F\n```\nExtracts XML, pretty-prints, merges adjacent runs, and converts smart quotes to XML entities (`&#x201C;` etc.) so they survive editing. Use `--merge-runs false` to skip run merging.\n\n### Step 2: Edit XML\n\nEdit files in `unpacked\u002Fword\u002F`. See XML Reference below for patterns.\n\n**Use \"Claude\" as the author** for tracked changes and comments, unless the user explicitly requests use of a different name.\n\n**Use the Edit tool directly for string replacement. Do not write Python scripts.** Scripts introduce unnecessary complexity. The Edit tool shows exactly what is being replaced.\n\n**CRITICAL: Use smart quotes for new content.** When adding text with apostrophes or quotes, use XML entities to produce smart quotes:\n```xml\n\u003C!-- Use these entities for professional typography -->\n\u003Cw:t>Here&#x2019;s a quote: &#x201C;Hello&#x201D;\u003C\u002Fw:t>\n```\n| Entity | Character |\n|--------|-----------|\n| `&#x2018;` | ‘ (left single) |\n| `&#x2019;` | ’ (right single \u002F apostrophe) |\n| `&#x201C;` | “ (left double) |\n| `&#x201D;` | ” (right double) |\n\n**Adding comments:** Use `comment.py` to handle boilerplate across multiple XML files (text must be pre-escaped XML):\n```bash\npython scripts\u002Fcomment.py unpacked\u002F 0 \"Comment text with &amp; and &#x2019;\"\npython scripts\u002Fcomment.py unpacked\u002F 1 \"Reply text\" --parent 0  # reply to comment 0\npython scripts\u002Fcomment.py unpacked\u002F 0 \"Text\" --author \"Custom Author\"  # custom author name\n```\nThen add markers to document.xml (see Comments in XML Reference).\n\n### Step 3: Pack\n```bash\npython scripts\u002Foffice\u002Fpack.py unpacked\u002F output.docx --original document.docx\n```\nValidates with auto-repair, condenses XML, and creates DOCX. Use `--validate false` to skip.\n\n**Auto-repair will fix:**\n- `durableId` >= 0x7FFFFFFF (regenerates valid ID)\n- Missing `xml:space=\"preserve\"` on `\u003Cw:t>` with whitespace\n\n**Auto-repair won't fix:**\n- Malformed XML, invalid element nesting, missing relationships, schema violations\n\n### Common Pitfalls\n\n- **Replace entire `\u003Cw:r>` elements**: When adding tracked changes, replace the whole `\u003Cw:r>...\u003C\u002Fw:r>` block with `\u003Cw:del>...\u003Cw:ins>...` as siblings. Don't inject tracked change tags inside a run.\n- **Preserve `\u003Cw:rPr>` formatting**: Copy the original run's `\u003Cw:rPr>` block into your tracked change runs to maintain bold, font size, etc.\n\n---\n\n## XML Reference\n\n### Schema Compliance\n\n- **Element order in `\u003Cw:pPr>`**: `\u003Cw:pStyle>`, `\u003Cw:numPr>`, `\u003Cw:spacing>`, `\u003Cw:ind>`, `\u003Cw:jc>`, `\u003Cw:rPr>` last\n- **Whitespace**: Add `xml:space=\"preserve\"` to `\u003Cw:t>` with leading\u002Ftrailing spaces\n- **RSIDs**: Must be 8-digit hex (e.g., `00AB1234`)\n\n### Tracked Changes\n\n**Insertion:**\n```xml\n\u003Cw:ins w:id=\"1\" w:author=\"Claude\" w:date=\"2025-01-01T00:00:00Z\">\n  \u003Cw:r>\u003Cw:t>inserted text\u003C\u002Fw:t>\u003C\u002Fw:r>\n\u003C\u002Fw:ins>\n```\n\n**Deletion:**\n```xml\n\u003Cw:del w:id=\"2\" w:author=\"Claude\" w:date=\"2025-01-01T00:00:00Z\">\n  \u003Cw:r>\u003Cw:delText>deleted text\u003C\u002Fw:delText>\u003C\u002Fw:r>\n\u003C\u002Fw:del>\n```\n\n**Inside `\u003Cw:del>`**: Use `\u003Cw:delText>` instead of `\u003Cw:t>`, and `\u003Cw:delInstrText>` instead of `\u003Cw:instrText>`.\n\n**Minimal edits** - only mark what changes:\n```xml\n\u003C!-- Change \"30 days\" to \"60 days\" -->\n\u003Cw:r>\u003Cw:t>The term is \u003C\u002Fw:t>\u003C\u002Fw:r>\n\u003Cw:del w:id=\"1\" w:author=\"Claude\" w:date=\"...\">\n  \u003Cw:r>\u003Cw:delText>30\u003C\u002Fw:delText>\u003C\u002Fw:r>\n\u003C\u002Fw:del>\n\u003Cw:ins w:id=\"2\" w:author=\"Claude\" w:date=\"...\">\n  \u003Cw:r>\u003Cw:t>60\u003C\u002Fw:t>\u003C\u002Fw:r>\n\u003C\u002Fw:ins>\n\u003Cw:r>\u003Cw:t> days.\u003C\u002Fw:t>\u003C\u002Fw:r>\n```\n\n**Deleting entire paragraphs\u002Flist items** - when removing ALL content from a paragraph, also mark the paragraph mark as deleted so it merges with the next paragraph. Add `\u003Cw:del\u002F>` inside `\u003Cw:pPr>\u003Cw:rPr>`:\n```xml\n\u003Cw:p>\n  \u003Cw:pPr>\n    \u003Cw:numPr>...\u003C\u002Fw:numPr>  \u003C!-- list numbering if present -->\n    \u003Cw:rPr>\n      \u003Cw:del w:id=\"1\" w:author=\"Claude\" w:date=\"2025-01-01T00:00:00Z\"\u002F>\n    \u003C\u002Fw:rPr>\n  \u003C\u002Fw:pPr>\n  \u003Cw:del w:id=\"2\" w:author=\"Claude\" w:date=\"2025-01-01T00:00:00Z\">\n    \u003Cw:r>\u003Cw:delText>Entire paragraph content being deleted...\u003C\u002Fw:delText>\u003C\u002Fw:r>\n  \u003C\u002Fw:del>\n\u003C\u002Fw:p>\n```\nWithout the `\u003Cw:del\u002F>` in `\u003Cw:pPr>\u003Cw:rPr>`, accepting changes leaves an empty paragraph\u002Flist item.\n\n**Rejecting another author's insertion** - nest deletion inside their insertion:\n```xml\n\u003Cw:ins w:author=\"Jane\" w:id=\"5\">\n  \u003Cw:del w:author=\"Claude\" w:id=\"10\">\n    \u003Cw:r>\u003Cw:delText>their inserted text\u003C\u002Fw:delText>\u003C\u002Fw:r>\n  \u003C\u002Fw:del>\n\u003C\u002Fw:ins>\n```\n\n**Restoring another author's deletion** - add insertion after (don't modify their deletion):\n```xml\n\u003Cw:del w:author=\"Jane\" w:id=\"5\">\n  \u003Cw:r>\u003Cw:delText>deleted text\u003C\u002Fw:delText>\u003C\u002Fw:r>\n\u003C\u002Fw:del>\n\u003Cw:ins w:author=\"Claude\" w:id=\"10\">\n  \u003Cw:r>\u003Cw:t>deleted text\u003C\u002Fw:t>\u003C\u002Fw:r>\n\u003C\u002Fw:ins>\n```\n\n### Comments\n\nAfter running `comment.py` (see Step 2), add markers to document.xml. For replies, use `--parent` flag and nest markers inside the parent's.\n\n**CRITICAL: `\u003Cw:commentRangeStart>` and `\u003Cw:commentRangeEnd>` are siblings of `\u003Cw:r>`, never inside `\u003Cw:r>`.**\n\n```xml\n\u003C!-- Comment markers are direct children of w:p, never inside w:r -->\n\u003Cw:commentRangeStart w:id=\"0\"\u002F>\n\u003Cw:del w:id=\"1\" w:author=\"Claude\" w:date=\"2025-01-01T00:00:00Z\">\n  \u003Cw:r>\u003Cw:delText>deleted\u003C\u002Fw:delText>\u003C\u002Fw:r>\n\u003C\u002Fw:del>\n\u003Cw:r>\u003Cw:t> more text\u003C\u002Fw:t>\u003C\u002Fw:r>\n\u003Cw:commentRangeEnd w:id=\"0\"\u002F>\n\u003Cw:r>\u003Cw:rPr>\u003Cw:rStyle w:val=\"CommentReference\"\u002F>\u003C\u002Fw:rPr>\u003Cw:commentReference w:id=\"0\"\u002F>\u003C\u002Fw:r>\n\n\u003C!-- Comment 0 with reply 1 nested inside -->\n\u003Cw:commentRangeStart w:id=\"0\"\u002F>\n  \u003Cw:commentRangeStart w:id=\"1\"\u002F>\n  \u003Cw:r>\u003Cw:t>text\u003C\u002Fw:t>\u003C\u002Fw:r>\n  \u003Cw:commentRangeEnd w:id=\"1\"\u002F>\n\u003Cw:commentRangeEnd w:id=\"0\"\u002F>\n\u003Cw:r>\u003Cw:rPr>\u003Cw:rStyle w:val=\"CommentReference\"\u002F>\u003C\u002Fw:rPr>\u003Cw:commentReference w:id=\"0\"\u002F>\u003C\u002Fw:r>\n\u003Cw:r>\u003Cw:rPr>\u003Cw:rStyle w:val=\"CommentReference\"\u002F>\u003C\u002Fw:rPr>\u003Cw:commentReference w:id=\"1\"\u002F>\u003C\u002Fw:r>\n```\n\n### Images\n\n1. Add image file to `word\u002Fmedia\u002F`\n2. Add relationship to `word\u002F_rels\u002Fdocument.xml.rels`:\n```xml\n\u003CRelationship Id=\"rId5\" Type=\"...\u002Fimage\" Target=\"media\u002Fimage1.png\"\u002F>\n```\n3. Add content type to `[Content_Types].xml`:\n```xml\n\u003CDefault Extension=\"png\" ContentType=\"image\u002Fpng\"\u002F>\n```\n4. Reference in document.xml:\n```xml\n\u003Cw:drawing>\n  \u003Cwp:inline>\n    \u003Cwp:extent cx=\"914400\" cy=\"914400\"\u002F>  \u003C!-- EMUs: 914400 = 1 inch -->\n    \u003Ca:graphic>\n      \u003Ca:graphicData uri=\"...\u002Fpicture\">\n        \u003Cpic:pic>\n          \u003Cpic:blipFill>\u003Ca:blip r:embed=\"rId5\"\u002F>\u003C\u002Fpic:blipFill>\n        \u003C\u002Fpic:pic>\n      \u003C\u002Fa:graphicData>\n    \u003C\u002Fa:graphic>\n  \u003C\u002Fwp:inline>\n\u003C\u002Fw:drawing>\n```\n\n---\n\n## Dependencies\n\n- **pandoc**: Text extraction\n- **docx**: `npm install -g docx` (new documents)\n- **LibreOffice**: PDF conversion (auto-configured for sandboxed environments via `scripts\u002Foffice\u002Fsoffice.py`)\n- **Poppler**: `pdftoppm` for images\n",{"name":5,"description":7},"main","6184979e01f673905139589c194eab38198db2f7",".opencode\u002Fskills\u002Fdocx",1,"https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE","https:\u002F\u002Fruake.github.io\u002FAWARE","https:\u002F\u002Fgithub.com\u002Fruake","2026-11-15 04:27:27",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add ruake\u002FAWARE --skill docx",{"tool":37,"command":38},"bunx","bunx skills add ruake\u002FAWARE --skill docx",{"tool":40,"command":41},"pnpm","pnpm dlx skills add ruake\u002FAWARE --skill docx","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fdocx\u002FSKILL.md",true,[],[46,52,59,66,73,79],{"skillNo":47,"name":48,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M75BPBYT89TEE87CGBDX2KF5","xlsx","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fxlsx\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":18},"01M75BPA000S9MTH5MY7CZNYYQ","writing-plans","Write comprehensive implementation plans assuming the engineer has zero context for our codebase and questionable taste.","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fwriting-plans\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":18},"01M75BP80ETH9GYVRH8A7QPCSG","web-design-guidelines","Review files for compliance with Web Interface Guidelines.","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fweb-design-guidelines\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":18},"01M75BP5XG8SX5Q2WWZB6QRVFT","web-component-design","Build reusable, maintainable UI components using modern frameworks with clean composition patterns and styling approache","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fweb-component-design\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":18},"01M75BP4B1FC4V81QR1VB56H1E","web-artifacts-builder","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fweb-artifacts-builder\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":18},"01M75BP1XVRW8WQ2XXAJBAYV2V","vueuse-functions","This skill is a decision-and-implementation guide for VueUse composables in Vue.js \u002F Nuxt projects. It maps requirements","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fvueuse-functions\u002FSKILL.md",[],[]]