docx
Professional DOCX document creation, editing, and formatting using OpenXML SDK (.NET). Three pipelines: (A) create new documents from scratch, (B) fill/edit…
от rongxinzy★ 163 звезды на GitHub
Установить docx в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
docx
Create, edit, and format DOCX documents via CLI tools or direct C# scripts built on OpenXML SDK (.NET).
Setup
ZhiYuan/Pi execution
When this skill is run inside ZhiYuan, use the run_skill_script tool for every bundled
.py, .mjs, or .ps1 script. Do not invoke bash, powershell, python3, or node
through a hand-built shell command. The application resolves the packaged Python, PowerShell,
and Node runtimes and reports the exact unavailable runtime when one is missing.
Markdown remains the source/intermediate format: create or edit the .md with Pi's file tools,
then run the conversion script through the same tool.
Example:
{
"skillId": "docx",
"script": "scripts/markdown_to_docx.mjs",
"args": ["content.md", "output.docx"]
}
First time (CLI reference): python3 scripts/setup.py (or powershell scripts/setup.ps1 on Windows, --minimal to skip optional deps). Inside ZhiYuan, run the corresponding setup script with run_skill_script.
First operation in session: python3 scripts/env_check.py. Do not proceed if NOT READY. LIMITED means that the bundled local Markdown converter can create a simple DOCX without downloads, but structural editing and template operations still require .NET 8+. (Skip on subsequent operations within the same session.)
Capability routing
- Full OpenXML path: use the pipelines below when .NET 8+ is available; it supports structural editing and templates.
- Bundled Markdown fallback: when the environment check reports
LIMITED, use only for a new, simple document. Write the content to Markdown, then runscripts/markdown_to_docx.mjs content.md output.docxthroughrun_skill_script. It supports headings, paragraphs, basic inline emphasis, lists, quotes, code blocks, and simple tables. Do not use it for preserving an existing document's formatting, filling templates, tracked changes, or images. Previews are optional when useful to the task.
Quick Start: Direct C# Path
When the task requires structural document manipulation (custom styles, complex tables, multi-section layouts, headers/footers, TOC, images), write C# directly instead of wrestling with CLI limitations. Use this scaffold:
// File: scripts/dotnet/task.csx (or a new .cs in a Console project)
// dotnet run --project scripts/dotnet/MiniMaxAIDocx.Cli -- run-script task.csx
#r "nuget: DocumentFormat.OpenXml, 3.2.0"
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
using var doc = WordprocessingDocument.Create("output.docx", WordprocessingDocumentType.Document);
var mainPart = doc.AddMainDocumentPart();
mainPart.Document = new Document(new Body());
// --- Your logic here ---
// Read the relevant Samples/*.cs file FIRST for tested patterns.
// See Samples/ table in References section below.
Before writing any C#, read the relevant Samples/*.cs file — they contain compilable, SDK-version-verified patterns. The Samples table in the References section below maps topics to files.
CLI shorthand
All CLI commands below use $CLI as shorthand for:
python3 scripts/cli.py
cli.py prefers the bundled self-contained runtime (runtime/MiniMaxAIDocx.Cli.exe, needs no
.NET installed) and falls back to dotnet run on developer machines. Inside ZhiYuan, run it
through run_skill_script like any other bundled script.
Pipeline routing
Route by checking: does the user have an input .docx file?
User task
├─ No input file → Pipeline A: CREATE
│ signals: "write", "create", "draft", "generate", "new", "make a report/proposal/memo"
│ → Read references/scenario_a_create.md
│
└─ Has input .docx
├─ Replace/fill/modify content → Pipeline B: FILL-EDIT
│ signals: "fill in", "replace", "update", "change text", "add section", "edit"
│ → Read references/scenario_b_edit_content.md
│
└─ Reformat/apply style/template → Pipeline C: FORMAT-APPLY
signals: "reformat", "apply template", "restyle", "match this format", "套模板", "排版"
├─ Template is pure style (no content) → C-1: OVERLAY (apply styles to source)
└─ Template has structure (cover/TOC/example sections) → C-2: BASE-REPLACE
(use template as base, replace example content with user content)
→ Read references/scenario_c_apply_template.md
If the request spans multiple pipelines, run them sequentially (e.g., Create then Format-Apply).
Pre-processing
Convert .doc → .docx if needed: python3 scripts/doc_to_docx.py input.doc output_dir/
Preview before editing (avoids reading raw XML): node scripts/docx_preview.mjs document.docx
Analyze structure for editing scenarios: $CLI analyze --input document.docx
Scenario A: Create
Read references/scenario_a_create.md, references/typography_guide.md, and references/design_principles.md first. Pick an aesthetic recipe from Samples/AestheticRecipeSamples.cs that matches the do
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- .gitignore
- LICENSE
- assets/styles/academic_styles.xml
- assets/styles/corporate_styles.xml
- assets/styles/default_styles.xml
- references/cjk_typography.md
- references/cjk_university_template_guide.md
- references/comments_guide.md
- references/design_good_bad_examples.md
- references/design_principles.md
- references/openxml_element_order.md
- references/openxml_encyclopedia_part1.md
- references/openxml_encyclopedia_part2.md
- references/openxml_encyclopedia_part3.md
- references/openxml_namespaces.md
- references/openxml_units.md
- references/scenario_a_create.md
- references/scenario_b_edit_content.md
- references/scenario_c_apply_template.md
- references/track_changes_guide.md
- references/troubleshooting.md
- references/typography_guide.md
- scripts/cli.py
- scripts/doc_to_docx.py
- scripts/docx_preview.mjs
- scripts/docx_to_text.mjs
- scripts/dotnet/MiniMaxAIDocx.Cli/MiniMaxAIDocx.Cli.csproj
- scripts/dotnet/MiniMaxAIDocx.Cli/Program.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Commands/AnalyzeCommand.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Commands/ApplyTemplateCommand.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Commands/CreateCommand.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Commands/DiffCommand.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Commands/EditContentCommand.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Commands/FixOrderCommand.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Commands/MergeRunsCommand.cs
- scripts/dotnet/MiniMaxAIDocx.Core/MiniMaxAIDocx.Core.csproj
- scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/CommentSynchronizer.cs
- scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/ElementOrder.cs
- scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/NamespaceConstants.cs
- scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/RunMerger.cs
FAQ
Что делает скилл docx?
Professional DOCX document creation, editing, and formatting using OpenXML SDK (.NET). Three pipelines: (A) create new documents from scratch, (B) fill/edit content in existing documents, (C) apply template formatting. MUST use this skill whenever the user wants to produce, modify, or format a Word document — including when they say "write a report", "draft a proposal", "make a contract", "fill in this form", "reformat to match this template", or any task whose final output is a .docx file. Even if the user doesn't mention "docx" explicitly, if the task implies a printable/formal document, use this skill.
Как установить скилл docx?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл docx запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
docx
AnthropicUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
xlsx
AnthropicUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
pptx
AnthropicUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…