[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-05f72abd-a3cb-41ac-b060-12c63ce14bb0":3,"$fFe0CPSuDjCkQezjcvyT20JJ3koNbPhIa35HJcIYpvc0":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"05f72abd-a3cb-41ac-b060-12c63ce14bb0","docx-official","用户可能要求您创建、编辑或分析.docx文件的内容。.docx文件本质上是一个包含XML文件和其他资源的ZIP存档，您可以读取或编辑。您有不同工具和工作流程可供不同任务使用。","cat_prod_document","mod_productivity","sickn33,productivity","---\nname: docx-official\ndescription: \"A user may ask you to create, edit, or analyze the contents of a .docx file. A .docx file is essentially a ZIP archive containing XML files and other resources that you can read or edit. You have different tools and workflows available for different tasks.\"\nrisk: unknown\nsource: community\ndate_added: \"2026-02-27\"\n---\n\n# DOCX creation, editing, and analysis\n\n## Overview\n\nA user may ask you to create, edit, or analyze the contents of a .docx file. A .docx file is essentially a ZIP archive containing XML files and other resources that you can read or edit. You have different tools and workflows available for different tasks.\n\n## Workflow Decision Tree\n\n### Reading\u002FAnalyzing Content\nUse \"Text extraction\" or \"Raw XML access\" sections below\n\n### Creating New Document\nUse \"Creating a new Word document\" workflow\n\n### Editing Existing Document\n- **Your own document + simple changes**\n  Use \"Basic OOXML editing\" workflow\n\n- **Someone else's document**\n  Use **\"Redlining workflow\"** (recommended default)\n\n- **Legal, academic, business, or government docs**\n  Use **\"Redlining workflow\"** (required)\n\n## Reading and analyzing content\n\n### Text extraction\nIf you just need to read the text contents of a document, you should convert the document to markdown using pandoc. Pandoc provides excellent support for preserving document structure and can show tracked changes:\n\n```bash\n# Convert document to markdown with tracked changes\npandoc --track-changes=all path-to-file.docx -o output.md\n# Options: --track-changes=accept\u002Freject\u002Fall\n```\n\n### Raw XML access\nYou need raw XML access for: comments, complex formatting, document structure, embedded media, and metadata. For any of these features, you'll need to unpack a document and read its raw XML contents.\n\n#### Unpacking a file\n`python ooxml\u002Fscripts\u002Funpack.py \u003Coffice_file> \u003Coutput_directory>`\n\n#### Key file structures\n* `word\u002Fdocument.xml` - Main document contents\n* `word\u002Fcomments.xml` - Comments referenced in document.xml\n* `word\u002Fmedia\u002F` - Embedded images and media files\n* Tracked changes use `\u003Cw:ins>` (insertions) and `\u003Cw:del>` (deletions) tags\n\n## Creating a new Word document\n\nWhen creating a new Word document from scratch, use **docx-js**, which allows you to create Word documents using JavaScript\u002FTypeScript.\n\n### Workflow\n1. **MANDATORY - READ ENTIRE FILE**: Read [`docx-js.md`](docx-js.md) (~500 lines) completely from start to finish. **NEVER set any range limits when reading this file.** Read the full file content for detailed syntax, critical formatting rules, and best practices before proceeding with document creation.\n2. Create a JavaScript\u002FTypeScript file using Document, Paragraph, TextRun components (You can assume all dependencies are installed, but if not, refer to the dependencies section below)\n3. Export as .docx using Packer.toBuffer()\n\n## Editing an existing Word document\n\nWhen editing an existing Word document, use the **Document library** (a Python library for OOXML manipulation). The library automatically handles infrastructure setup and provides methods for document manipulation. For complex scenarios, you can access the underlying DOM directly through the library.\n\n### Workflow\n1. **MANDATORY - READ ENTIRE FILE**: Read [`ooxml.md`](ooxml.md) (~600 lines) completely from start to finish. **NEVER set any range limits when reading this file.** Read the full file content for the Document library API and XML patterns for directly editing document files.\n2. Unpack the document: `python ooxml\u002Fscripts\u002Funpack.py \u003Coffice_file> \u003Coutput_directory>`\n3. Create and run a Python script using the Document library (see \"Document Library\" section in ooxml.md)\n4. Pack the final document: `python ooxml\u002Fscripts\u002Fpack.py \u003Cinput_directory> \u003Coffice_file>`\n\nThe Document library provides both high-level methods for common operations and direct DOM access for complex scenarios.\n\n## Redlining workflow for document review\n\nThis workflow allows you to plan comprehensive tracked changes using markdown before implementing them in OOXML. **CRITICAL**: For complete tracked changes, you must implement ALL changes systematically.\n\n**Batching Strategy**: Group related changes into batches of 3-10 changes. This makes debugging manageable while maintaining efficiency. Test each batch before moving to the next.\n\n**Principle: Minimal, Precise Edits**\nWhen implementing tracked changes, only mark text that actually changes. Repeating unchanged text makes edits harder to review and appears unprofessional. Break replacements into: [unchanged text] + [deletion] + [insertion] + [unchanged text]. Preserve the original run's RSID for unchanged text by extracting the `\u003Cw:r>` element from the original and reusing it.\n\nExample - Changing \"30 days\" to \"60 days\" in a sentence:\n```python\n# BAD - Replaces entire sentence\n'\u003Cw:del>\u003Cw:r>\u003Cw:delText>The term is 30 days.\u003C\u002Fw:delText>\u003C\u002Fw:r>\u003C\u002Fw:del>\u003Cw:ins>\u003Cw:r>\u003Cw:t>The term is 60 days.\u003C\u002Fw:t>\u003C\u002Fw:r>\u003C\u002Fw:ins>'\n\n# GOOD - Only marks what changed, preserves original \u003Cw:r> for unchanged text\n'\u003Cw:r w:rsidR=\"00AB12CD\">\u003Cw:t>The term is \u003C\u002Fw:t>\u003C\u002Fw:r>\u003Cw:del>\u003Cw:r>\u003Cw:delText>30\u003C\u002Fw:delText>\u003C\u002Fw:r>\u003C\u002Fw:del>\u003Cw:ins>\u003Cw:r>\u003Cw:t>60\u003C\u002Fw:t>\u003C\u002Fw:r>\u003C\u002Fw:ins>\u003Cw:r w:rsidR=\"00AB12CD\">\u003Cw:t> days.\u003C\u002Fw:t>\u003C\u002Fw:r>'\n```\n\n### Tracked changes workflow\n\n1. **Get markdown representation**: Convert document to markdown with tracked changes preserved:\n   ```bash\n   pandoc --track-changes=all path-to-file.docx -o current.md\n   ```\n\n2. **Identify and group changes**: Review the document and identify ALL changes needed, organizing them into logical batches:\n\n   **Location methods** (for finding changes in XML):\n   - Section\u002Fheading numbers (e.g., \"Section 3.2\", \"Article IV\")\n   - Paragraph identifiers if numbered\n   - Grep patterns with unique surrounding text\n   - Document structure (e.g., \"first paragraph\", \"signature block\")\n   - **DO NOT use markdown line numbers** - they don't map to XML structure\n\n   **Batch organization** (group 3-10 related changes per batch):\n   - By section: \"Batch 1: Section 2 amendments\", \"Batch 2: Section 5 updates\"\n   - By type: \"Batch 1: Date corrections\", \"Batch 2: Party name changes\"\n   - By complexity: Start with simple text replacements, then tackle complex structural changes\n   - Sequential: \"Batch 1: Pages 1-3\", \"Batch 2: Pages 4-6\"\n\n3. **Read documentation and unpack**:\n   - **MANDATORY - READ ENTIRE FILE**: Read [`ooxml.md`](ooxml.md) (~600 lines) completely from start to finish. **NEVER set any range limits when reading this file.** Pay special attention to the \"Document Library\" and \"Tracked Change Patterns\" sections.\n   - **Unpack the document**: `python ooxml\u002Fscripts\u002Funpack.py \u003Cfile.docx> \u003Cdir>`\n   - **Note the suggested RSID**: The unpack script will suggest an RSID to use for your tracked changes. Copy this RSID for use in step 4b.\n\n4. **Implement changes in batches**: Group changes logically (by section, by type, or by proximity) and implement them together in a single script. This approach:\n   - Makes debugging easier (smaller batch = easier to isolate errors)\n   - Allows incremental progress\n   - Maintains efficiency (batch size of 3-10 changes works well)\n\n   **Suggested batch groupings:**\n   - By document section (e.g., \"Section 3 changes\", \"Definitions\", \"Termination clause\")\n   - By change type (e.g., \"Date changes\", \"Party name updates\", \"Legal term replacements\")\n   - By proximity (e.g., \"Changes on pages 1-3\", \"Changes in first half of document\")\n\n   For each batch of related changes:\n\n   **a. Map text to XML**: Grep for text in `word\u002Fdocument.xml` to verify how text is split across `\u003Cw:r>` elements.\n\n   **b. Create and run script**: Use `get_node` to find nodes, implement changes, then `doc.save()`. See **\"Document Library\"** section in ooxml.md for patterns.\n\n   **Note**: Always grep `word\u002Fdocument.xml` immediately before writing a script to get current line numbers and verify text content. Line numbers change after each script run.\n\n5. **Pack the document**: After all batches are complete, convert the unpacked directory back to .docx:\n   ```bash\n   python ooxml\u002Fscripts\u002Fpack.py unpacked reviewed-document.docx\n   ```\n\n6. **Final verification**: Do a comprehensive check of the complete document:\n   - Convert final document to markdown:\n     ```bash\n     pandoc --track-changes=all reviewed-document.docx -o verification.md\n     ```\n   - Verify ALL changes were applied correctly:\n     ```bash\n     grep \"original phrase\" verification.md  # Should NOT find it\n     grep \"replacement phrase\" verification.md  # Should find it\n     ```\n   - Check that no unintended changes were introduced\n\n\n## Converting Documents to Images\n\nTo visually analyze Word documents, convert them to images using a two-step process:\n\n1. **Convert DOCX to PDF**:\n   ```bash\n   soffice --headless --convert-to pdf document.docx\n   ```\n\n2. **Convert PDF pages to JPEG images**:\n   ```bash\n   pdftoppm -jpeg -r 150 document.pdf page\n   ```\n   This creates files like `page-1.jpg`, `page-2.jpg`, etc.\n\nOptions:\n- `-r 150`: Sets resolution to 150 DPI (adjust for quality\u002Fsize balance)\n- `-jpeg`: Output JPEG format (use `-png` for PNG if preferred)\n- `-f N`: First page to convert (e.g., `-f 2` starts from page 2)\n- `-l N`: Last page to convert (e.g., `-l 5` stops at page 5)\n- `page`: Prefix for output files\n\nExample for specific range:\n```bash\npdftoppm -jpeg -r 150 -f 2 -l 5 document.pdf page  # Converts only pages 2-5\n```\n\n## Code Style Guidelines\n**IMPORTANT**: When generating code for DOCX operations:\n- Write concise code\n- Avoid verbose variable names and redundant operations\n- Avoid unnecessary print statements\n\n## Dependencies\n\nRequired dependencies (install if not available):\n\n- **pandoc**: `sudo apt-get install pandoc` (for text extraction)\n- **docx**: `npm install -g docx` (for creating new documents)\n- **LibreOffice**: `sudo apt-get install libreoffice` (for PDF conversion)\n- **Poppler**: `sudo apt-get install poppler-utils` (for pdftoppm to convert PDF to images)\n- **defusedxml**: `pip install defusedxml` (for secure XML parsing)\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,138,1256,"2026-05-16 13:15:57",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"效率工具","productivity","mdi-lightning-bolt-outline","文档处理、数据分析、自动化工作流",4,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"文档处理","document","mdi-file-document-outline","PDF\u002FWord\u002FExcel\u002FPPT 处理",1,23,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"ed8f5ad4-5f0b-4597-8367-a57ef0ef53b0","1.0.0","docx-official.zip",171610,"uploads\u002Fskills\u002F05f72abd-a3cb-41ac-b060-12c63ce14bb0\u002Fdocx-official.zip","7ef7b889edf9824202c95dccecd90e3a354cf444ed492fe2a7a8fb5ad173de03","[{\"path\":\"LICENSE.txt\",\"isDirectory\":false,\"size\":1467},{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":10480},{\"path\":\"docx-js.md\",\"isDirectory\":false,\"size\":16509},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fdml-chart.xsd\",\"isDirectory\":false,\"size\":74984},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fdml-chartDrawing.xsd\",\"isDirectory\":false,\"size\":6956},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fdml-diagram.xsd\",\"isDirectory\":false,\"size\":51302},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fdml-lockedCanvas.xsd\",\"isDirectory\":false,\"size\":624},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fdml-main.xsd\",\"isDirectory\":false,\"size\":152039},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fdml-picture.xsd\",\"isDirectory\":false,\"size\":1231},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fdml-spreadsheetDrawing.xsd\",\"isDirectory\":false,\"size\":8862},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fdml-wordprocessingDrawing.xsd\",\"isDirectory\":false,\"size\":14795},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fpml.xsd\",\"isDirectory\":false,\"size\":83612},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fshared-additionalCharacteristics.xsd\",\"isDirectory\":false,\"size\":1269},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fshared-bibliography.xsd\",\"isDirectory\":false,\"size\":7328},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fshared-commonSimpleTypes.xsd\",\"isDirectory\":false,\"size\":6382},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fshared-customXmlDataProperties.xsd\",\"isDirectory\":false,\"size\":1248},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fshared-customXmlSchemaProperties.xsd\",\"isDirectory\":false,\"size\":880},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fshared-documentPropertiesCustom.xsd\",\"isDirectory\":false,\"size\":2608},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fshared-documentPropertiesExtended.xsd\",\"isDirectory\":false,\"size\":3507},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fshared-documentPropertiesVariantTypes.xsd\",\"isDirectory\":false,\"size\":7507},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fshared-math.xsd\",\"isDirectory\":false,\"size\":23313},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fshared-relationshipReference.xsd\",\"isDirectory\":false,\"size\":1367},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fsml.xsd\",\"isDirectory\":false,\"size\":242277},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fvml-main.xsd\",\"isDirectory\":false,\"size\":26148},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fvml-officeDrawing.xsd\",\"isDirectory\":false,\"size\":25279},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fvml-presentationDrawing.xsd\",\"isDirectory\":false,\"size\":535},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fvml-spreadsheetDrawing.xsd\",\"isDirectory\":false,\"size\":5712},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fvml-wordprocessingDrawing.xsd\",\"isDirectory\":false,\"size\":4010},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fwml.xsd\",\"isDirectory\":false,\"size\":171367},{\"path\":\"ooxml\u002Fschemas\u002FISO-IEC29500-4_2016\u002Fxml.xsd\",\"isDirectory\":false,\"size\":4646},{\"path\":\"ooxml\u002Fschemas\u002Fecma\u002Ffouth-edition\u002Fopc-contentTypes.xsd\",\"isDirectory\":false,\"size\":1963},{\"path\":\"ooxml\u002Fschemas\u002Fecma\u002Ffouth-edition\u002Fopc-coreProperties.xsd\",\"isDirectory\":false,\"size\":2515},{\"path\":\"ooxml\u002Fschemas\u002Fecma\u002Ffouth-edition\u002Fopc-digSig.xsd\",\"isDirectory\":false,\"size\":2856},{\"path\":\"ooxml\u002Fschemas\u002Fecma\u002Ffouth-edition\u002Fopc-relationships.xsd\",\"isDirectory\":false,\"size\":1344},{\"path\":\"ooxml\u002Fschemas\u002Fmce\u002Fmc.xsd\",\"isDirectory\":false,\"size\":3127},{\"path\":\"ooxml\u002Fschemas\u002Fmicrosoft\u002Fwml-2010.xsd\",\"isDirectory\":false,\"size\":26549},{\"path\":\"ooxml\u002Fschemas\u002Fmicrosoft\u002Fwml-2012.xsd\",\"isDirectory\":false,\"size\":3745},{\"path\":\"ooxml\u002Fschemas\u002Fmicrosoft\u002Fwml-2018.xsd\",\"isDirectory\":false,\"size\":901},{\"path\":\"ooxml\u002Fschemas\u002Fmicrosoft\u002Fwml-cex-2018.xsd\",\"isDirectory\":false,\"size\":1778},{\"path\":\"ooxml\u002Fschemas\u002Fmicrosoft\u002Fwml-cid-2016.xsd\",\"isDirectory\":false,\"size\":1002},{\"path\":\"ooxml\u002Fschemas\u002Fmicrosoft\u002Fwml-sdtdatahash-2020.xsd\",\"isDirectory\":false,\"size\":600},{\"path\":\"ooxml\u002Fschemas\u002Fmicrosoft\u002Fwml-symex-2015.xsd\",\"isDirectory\":false,\"size\":745},{\"path\":\"ooxml\u002Fscripts\u002Fpack.py\",\"isDirectory\":false,\"size\":5596},{\"path\":\"ooxml\u002Fscripts\u002Funpack.py\",\"isDirectory\":false,\"size\":2495},{\"path\":\"ooxml\u002Fscripts\u002Fvalidate.py\",\"isDirectory\":false,\"size\":1959},{\"path\":\"ooxml\u002Fscripts\u002Fvalidation\u002F__init__.py\",\"isDirectory\":false,\"size\":336},{\"path\":\"ooxml\u002Fscripts\u002Fvalidation\u002Fbase.py\",\"isDirectory\":false,\"size\":39892},{\"path\":\"ooxml\u002Fscripts\u002Fvalidation\u002Fdocx.py\",\"isDirectory\":false,\"size\":9996},{\"path\":\"ooxml\u002Fscripts\u002Fvalidation\u002Fpptx.py\",\"isDirectory\":false,\"size\":12327},{\"path\":\"ooxml\u002Fscripts\u002Fvalidation\u002Fredlining.py\",\"isDirectory\":false,\"size\":11179},{\"path\":\"ooxml.md\",\"isDirectory\":false,\"size\":23572},{\"path\":\"scripts\u002F__init__.py\",\"isDirectory\":false,\"size\":65},{\"path\":\"scripts\u002Fdocument.py\",\"isDirectory\":false,\"size\":50409},{\"path\":\"scripts\u002Ftemplates\u002Fcomments.xml\",\"isDirectory\":false,\"size\":2635},{\"path\":\"scripts\u002Ftemplates\u002FcommentsExtended.xml\",\"isDirectory\":false,\"size\":2643},{\"path\":\"scripts\u002Ftemplates\u002FcommentsExtensible.xml\",\"isDirectory\":false,\"size\":2739},{\"path\":\"scripts\u002Ftemplates\u002FcommentsIds.xml\",\"isDirectory\":false,\"size\":2651},{\"path\":\"scripts\u002Ftemplates\u002Fpeople.xml\",\"isDirectory\":false,\"size\":147},{\"path\":\"scripts\u002Futilities.py\",\"isDirectory\":false,\"size\":13694}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]