- Skill ID
- minimax-ai/skills/minimax-docx
- Publisher
- minimax-ai
- Repository
- skills
- Installs
- 0
- Files
- 75
- License
- MIT
- Synced
- Sep 23, 2026
Open any RiverX project, open the Skills panel in the chat, and search for this identifier. The files are fetched from the source repository at install time.
minimax-ai/skills/minimax-docxInstalls these files- .gitignore
- LICENSE
- SKILL.md
- assets/styles/academic_styles.xml
- assets/styles/corporate_styles.xml
- assets/styles/default_styles.xml
- assets/xsd/aesthetic-rules.xsd
- assets/xsd/business-rules.xsd
- assets/xsd/common-types.xsd
- assets/xsd/wml-subset.xsd
- 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
- references/xsd_validation_guide.md
- scripts/doc_to_docx.sh
- scripts/docx_preview.sh
- 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/Commands/ValidateCommand.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
- scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/StyleAnalyzer.cs
- scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/TrackChangesHelper.cs
- scripts/dotnet/MiniMaxAIDocx.Core/OpenXml/UnitConverter.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch1.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch2.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch3.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/AestheticRecipeSamples_Batch4.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/CharacterFormattingSamples.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/DocumentCreationSamples.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/FieldAndTocSamples.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/FootnoteAndCommentSamples.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/HeaderFooterSamples.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/ImageSamples.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/ListAndNumberingSamples.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/ParagraphFormattingSamples.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/StyleSystemSamples.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/TableSamples.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Samples/TrackChangesSamples.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Typography/CjkHelper.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Typography/FontDefaults.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Typography/PageSizes.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Validation/BusinessRuleValidator.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Validation/GateCheckValidator.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Validation/ValidationResult.cs
- scripts/dotnet/MiniMaxAIDocx.Core/Validation/XsdValidator.cs
- scripts/dotnet/MiniMaxAIDocx.slnx
- scripts/env_check.sh
- scripts/setup.ps1
- scripts/setup.sh
What this skill tells the agent
minimax-docx
Create, edit, and format DOCX documents via CLI tools or direct C# scripts built on OpenXML SDK (.NET).
Setup
First time: bash scripts/setup.sh (or powershell scripts/setup.ps1 on Windows, --minimal to skip optional deps).
First operation in session: scripts/env_check.sh — do not proceed if NOT READY. (Skip on subsequent operations within the same session.)
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:
dotnet run --project scripts/dotnet/MiniMaxAIDocx.Cli --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.mdIf the request spans multiple pipelines, run them sequentially (e.g., Create then Format-Apply).
Pre-processing
Convert .doc → .docx if needed: scripts/doc_to_docx.sh input.doc output_dir/
Preview before editing (avoids reading raw XML): scripts/docx_preview.sh 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 document type — do not invent formatting values. For CJK, also read references/cjk_typography.md.
Choose your path:
- Simple (plain text, minimal formatting): use CLI —
$CLI create --type report --output out.docx --config content.json - Structural (custom styles, multi-section, TOC, images, complex tables): write C# directly. Read the relevant
Samples/*.csfirst.
CLI options: --type (report|letter|memo|academic), --title, --author, --page-size (letter|a4|legal|a3), --margins (standard|narrow|wide), --header, --footer, --page-numbers, --toc, --content-json.
Then run the validation pipeline (below).
Scenario B: Edit / Fill
Read references/scenario_b_edit_content.md first. Preview → analyze → edit → validate.
Choose your path:
- Simple (text replacement, placeholder fill): use CLI subcommands.
- Structural (add/reorganize sections, modify styles, manipulate tables, insert images): write C# directly. Read
references/openxml_element_order.mdand the relevantSamples/*.cs.
Available CLI edit subcommands:
replace-text --find "X" --replace "Y"fill-placeholders --data '{"key":"value"}'fill-table --data table.jsoninsert-section,remove-section,update-header-footer
$CLI edit replace-text --input in.docx --output out.docx --find "OLD" --replace "NEW"
$CLI edit fill-placeholders --input in.docx --output out.docx --data '{"name":"John"}'Then run the validation pipeline. Also run diff to verify minimal changes:
$CLI diff --before in.docx --after out.docxScenario C: Apply Template
Read references/scenario_c_apply_template.md first. Preview and analyze both source and template.
$CLI apply-template --input source.docx --template template.docx --output out.docxFor complex template operations (multi-template merge, per-section headers/footers, style merging), write C# directly — see Critical Rules below for required patterns.
Run the validation pipeline, then the hard gate-check:
$CLI validate --input out.docx --gate-check assets/xsd/business-rules.xsdGate-check is a hard requirement. Do NOT deliver until it passes. If it fails: diagnose, fix, re-run.
Also diff to verify content preservation: $CLI diff --before source.docx --after out.docx
Validation pipeline
Run after every write operation. For Scenario C the full pipeline is mandatory; for A/B it is recommended (skip only if the operation was trivially simple).
$CLI merge-runs --input doc.docx # 1. consolidate runs
$CLI validate --input doc.docx --xsd assets/xsd/wml-subset.xsd # 2. XSD structure
$CLI validate --input doc.docx --business # 3. business rulesIf XSD fails, auto-repair and retry:
$CLI fix-order --input doc.docx
$CLI validate --input doc.docx --xsd assets/xsd/wml-subset.xsdIf XSD still fails, fall back to business rules + preview:
$CLI validate --input doc.docx --business
scripts/docx_preview.sh doc.docx
# Verify: font contamination=0, table count correct, drawing count correct, sectPr count correctFinal preview: scripts/docx_preview.sh doc.docx
Critical rules
These prevent file corruption — OpenXML is strict about element ordering.
Element order (properties always first):
| Parent | Order |
|---|---|
w:p | pPr → runs |
w:r | rPr → t/br/tab |
w:tbl | tblPr → tblGrid → tr |
w:tr | trPr → tc |
w:tc | tcPr → p (min 1 <w:p/>) |
w:body | block content → sectPr (LAST child) |
Direct format contamination: When copying content from a source document, inline rPr (fonts, color) and pPr (borders, shading, spacing) override template styles. Always strip direct formatting — keep only pStyle reference and t text. Clean tables too (including pPr/rPr inside cells).
Track changes: <w:del> uses <w:delText>, never <w:t>. <w:ins> uses <w:t>, never <w:delText>.
Font size: w:sz = points × 2 (12pt → sz="24"). Margins/spacing in DXA (1 inch = 1440, 1cm ≈ 567).
Heading styles MUST have OutlineLevel: When defining heading styles (Heading1, ThesisH1, etc.), always include new OutlineLevel { Val = N } in StyleParagraphProperties (H1→0, H2→1, H3→2). Without this, Word sees them as plain styled text — TOC and navigation pane won't work.
Multi-template merge: When given multiple template files (font, heading, breaks), read references/scenario_c_apply_template.md section "Multi-Template Merge" FIRST. Key rules:
- Merge styles from all templates into one styles.xml. Structure (sections/breaks) comes from the breaks template.
More from minimax-ai
Use this skill in a project
Open any RiverX project, search the Skills panel for minimax-ai/skills/minimax-docx, and install it in one click.
