Logo von Docx

Docx

Organisation
okou-ai
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 with XSD validation gate-check. 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 an editable Word document, use this skill. Use ../pdf/SKILL.md for a standalone PDF.

Übersicht

Herausgeberokou-ai
Repositoryokou-skills
Skill-Namedocx
Sterne
81
Forks
19
Mitgelieferte Dateien
79
LizenzMIT
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • Mitgelieferte Dateien: 79

    Skripte, Vorlagen und Referenzmaterial, die das Modell bei der Arbeit lesen kann. Die Dateien sind schreibgeschützt und werden niemals ausgeführt.

  • Open Source

    Von okou-ai auf GitHub veröffentlicht. Prüfen Sie vor der Installation die Quelldateien.

Installation

Installieren Sie den KI-Skill Docx in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner. Dabei liest die App SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/okou-ai/okou-skills/tree/main/office/docx
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill hinzufügen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format unterstützt, kann diesen Skill nutzen. Kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/okou-ai/okou-skills.git /tmp/okou-skills
mkdir -p .claude/skills
cp -r /tmp/okou-skills/office/docx .claude/skills/docx
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie Docx in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt Docx automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist Docx nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Schlüsseln.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

docx

Create, edit, and format DOCX documents via CLI tools or direct C# scripts built on OpenXML SDK (.NET).

Setup

Paths below are relative to this skill directory. Set SKILL_DIR to the absolute directory containing this file; do not assume the task's working directory.

First operation in session: bash "$SKILL_DIR/scripts/env_check.sh". This checks DOCX authoring dependencies. If required dependencies are missing, run bash "$SKILL_DIR/scripts/setup.sh" --minimal (Windows: powershell -File "$SKILL_DIR/scripts/setup.ps1" -Minimal). Reuse the installed SDK and built CLI for subsequent operations.

For PDF output, .doc conversion, or a user-requested rendered preview or visual review, run bash "$SKILL_DIR/scripts/env_check.sh" --with-rendering. This probes Writer by converting a minimal DOCX to PDF. If that probe fails, run the full setup.sh (Windows: setup.ps1) without the minimal flag.

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:

Create a regular console project once, referencing the bundled SDK project:

bash
dotnet new console --framework net8.0 --output generated/docx-task
dotnet add generated/docx-task reference "$SKILL_DIR/scripts/dotnet/Docx.Core/Docx.Core.csproj"
# Put the C# below in generated/docx-task/Program.cs.
dotnet run --project generated/docx-task
csharp
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 entry point

The wrapper uses the built CLI without rebuilding on every call:

bash
bash "$SKILL_DIR/scripts/docx.sh" --help

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: bash "$SKILL_DIR/scripts/doc_to_docx.sh" input.doc output_dir/

Preview before editing (avoids reading raw XML): bash "$SKILL_DIR/scripts/docx_preview.sh" document.docx

Analyze structure for editing scenarios: bash "$SKILL_DIR/scripts/docx.sh" analyze --input document.docx

Scenario A: Create

Read references/scenario_a_create.md, then the selected recipe and the samples needed for this document. Read typography/design references when making those decisions, and references/cjk_typography.md for CJK. Load relevant sections, not the entire sample library. User-supplied templates and explicit style choices take precedence over recipe defaults; HBR's 11 pt body text must not be changed to satisfy an unrelated 12 pt default.

Choose your path:

  • Simple (plain text, minimal formatting): use CLI — bash "$SKILL_DIR/scripts/docx.sh" create --type report --output out.docx --content-json content.json
  • Structural (custom styles, multi-section, TOC, images, complex tables): write C# directly. Read the relevant Samples/*.cs first.

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.md and the relevant Samples/*.cs.

Available CLI edit subcommands:

  • replace-text --search "X" --replace "Y"
  • fill-placeholders --mapping values.json
  • fill-table --csv table.csv
  • insert-paragraph, update-field, list-placeholders
bash
bash "$SKILL_DIR/scripts/docx.sh" edit replace-text --input in.docx --output out.docx --search "OLD" --replace "NEW"
bash "$SKILL_DIR/scripts/docx.sh" edit fill-placeholders --input in.docx --output out.docx --mapping values.json

Then run the validation pipeline. Also run diff to verify minimal changes:

bash
bash "$SKILL_DIR/scripts/docx.sh" diff --before in.docx --after out.docx

Scenario C: Apply Template

Read references/scenario_c_apply_template.md first. Preview and analyze both source and template.

bash
bash "$SKILL_DIR/scripts/docx.sh" apply-template --input source.docx --template template.docx --output out.docx

For 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:

bash
bash "$SKILL_DIR/scripts/docx.sh" validate --input out.docx --gate-check template.docx

Gate-check is a hard requirement. Do NOT deliver until it passes. If it fails: diagnose, fix, re-run.

Also diff to verify content preservation: bash "$SKILL_DIR/scripts/docx.sh" diff --before source.docx --after out.docx

Validation pipeline

Run on the completed document, and again after changes that affect it.

bash
bash "$SKILL_DIR/scripts/docx.sh" validate --input doc.docx --business

validate always runs the OpenXML SDK validator on all package parts. It checks structure and relationships without forcing a particular font size or recipe.

The bundled wml-subset.xsd is an optional check of a curated subset, not full OOXML coverage. Use --xsd "$SKILL_DIR/assets/xsd/wml-subset.xsd" only for documents intentionally restricted to that subset. A schema limitation is not permission to remove valid document features. Do not replace a failed package check with a text preview. Repair the reported defect, then rerun the affected validation.

Use fix-order only for diagnosed ordering errors and merge-runs only when consolidation is needed; do not mutate a document as a routine validation step.

PDF export and visual review

When delivering a PDF version of a Word document, export that DOCX once:

bash
python3 "$SKILL_DIR/scripts/render_docx.py" doc.docx --out output/doc.pdf

For a user-requested rendered preview or visual review, add --pages preview/pages and inspect the images.

Critical rules

These prevent file corruption — OpenXML is strict about element ordering.

Element order (properties always first):

ParentOrder
w:ppPr → runs
w:rrPr → t/br/tab
w:tbltblPr → tblGrid → tr
w:trtrPr → tc
w:tctcPr → p (min 1 <w:p/>)
w:bodyblock 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.
  • Each content paragraph must appear exactly ONCE — never duplicate when inserting section breaks.
  • NEVER insert empty/blank paragraphs as padding or section separators. Output paragraph count must equal input. Use section break properties (w:sectPr inside w:pPr) and style spacing (w:spacing before/after) for visual separation.
  • Insert oddPage section breaks before EVERY chapter heading, not just the first. Even if a chapter has dual-column content, it MUST start with oddPage; use a second continuous break after the heading for column switching.
  • Dual-column chapters need THREE section breaks: (1) oddPage in preceding para's pPr, (2) continuous+cols=2 in the chapter HEADING's pPr, (3) continuous+cols=1 in the last body para's pPr to revert.
  • Copy titlePg settings from the breaks template for EACH section. Abstract and TOC sections typically need titlePg=true.

Multi-section headers/footers: Templates with 10+ sections (e.g., Chinese thesis) have DIFFERENT headers/footers per section (Roman vs Arabic page numbers, different header text per zone). Rules:

  • Use C-2 Base-Replace: copy the TEMPLATE as output base, then replace body content. This preserves all sections, headers, footers, and titlePg settings automatically.
  • NEVER recreate headers/footers from scratch — copy template header/footer XML byte-for-byte.
  • NEVER add formatting (borders, alignment, font size) not present in the template header XML.
  • Non-cover sections MUST have header/footer XML files (at least empty header + page number footer).
  • See references/scenario_c_apply_template.md section "Multi-Section Header/Footer Transfer".

References

Load as needed — don't load all at once. Pick the most relevant files for the task.

The C# samples and design references below are the project's knowledge base ("encyclopedia"). When writing OpenXML code, ALWAYS read the relevant sample file first — it contains compilable, SDK-version-verified patterns that prevent common errors. When making aesthetic decisions, read the design principles and recipe files — they encode tested, harmonious parameter sets from authoritative sources (IEEE, ACM, APA, Nature, etc.), not guesses.

Scenario guides (read first for each pipeline)

FileWhen
references/scenario_a_create.mdPipeline A: creating from scratch
references/scenario_b_edit_content.mdPipeline B: editing existing content
references/scenario_c_apply_template.mdPipeline C: applying template formatting

C# code samples (compilable, heavily commented — read when writing code)

FileTopic
Samples/DocumentCreationSamples.csDocument lifecycle: create, open, save, streams, doc defaults, settings, properties, page setup, multi-section
Samples/StyleSystemSamples.csStyles: Normal/Heading chain, character/table/list styles, DocDefaults, latentStyles, CJK 公文, APA 7th, import, resolve inheritance
Samples/CharacterFormattingSamples.csRunProperties: fonts, size, bold/italic, all underlines, color, highlight, strike, sub/super, caps, spacing, shading, border, emphasis marks
Samples/ParagraphFormattingSamples.csParagraphProperties: justification, indentation, line/paragraph spacing, keep/widow, outline level, borders, tabs, numbering, bidi, frame
Samples/TableSamples.csTables: borders, grid, cell props, margins, row height, header repeat, merge (H+V), nested, floating, three-line 三线表, zebra striping
Samples/HeaderFooterSamples.csHeaders/footers: page numbers, "Page X of Y", first/even/odd, logo image, table layout, 公文 "-X-", per-section
Samples/ImageSamples.csImages: inline, floating, text wrapping, border, alt text, in header/table, replace, SVG fallback, dimension calc
Samples/ListAndNumberingSamples.csNumbering: bullets, multi-level decimal, custom symbols, outline→headings, legal, Chinese 一/(一)/1./(1), restart/continue
Samples/FieldAndTocSamples.csFields: TOC, SimpleField vs complex field, DATE/PAGE/REF/SEQ/MERGEFIELD/IF/STYLEREF, TOC styles
Samples/FootnoteAndCommentSamples.csFootnotes, endnotes, comments (4-file system), bookmarks, hyperlinks (internal + external)
Samples/TrackChangesSamples.csRevisions: insertions (w:t), deletions (w:delText!), formatting changes, accept/reject all, move tracking
Samples/AestheticRecipeSamples.cs13 aesthetic recipes from authoritative sources: ModernCorporate, AcademicThesis, ExecutiveBrief, ChineseGovernment (GB/T 9704), MinimalModern, IEEE Conference, ACM sigconf, APA 7th, MLA 9th, Chicago/Turabian, Springer LNCS, Nature, HBR — each with exact values from official style guides

Note: Samples/ path is relative to scripts/dotnet/Docx.Core/.

Markdown references (read when you need specifications or design rules)

FileWhen
references/openxml_element_order.mdXML element ordering rules (prevents corruption)
references/openxml_units.mdUnit conversion: DXA, EMU, half-points, eighth-points
references/openxml_encyclopedia_part1.mdDetailed C# encyclopedia: document creation, styles, character & paragraph formatting
references/openxml_encyclopedia_part2.mdDetailed C# encyclopedia: page setup, tables, headers/footers, sections, doc properties
references/openxml_encyclopedia_part3.mdDetailed C# encyclopedia: TOC, footnotes, fields, track changes, comments, images, math, numbering, protection
references/typography_guide.mdFont pairing, sizes, spacing, page layout, table design, color schemes
references/cjk_typography.mdCJK fonts, 字号 sizes, RunFonts mapping, GB/T 9704 公文 standard
references/cjk_university_template_guide.mdChinese university thesis templates: numeric styleIds (1/2/3 vs Heading1), document zone structure (cover→abstract→TOC→body→references), font expectations, common mistakes
references/design_principles.mdAesthetic foundations: 6 design principles (white space, contrast/scale, proximity, alignment, repetition, hierarchy) — teaches WHY, not just WHAT
references/design_good_bad_examples.mdGood vs Bad comparisons: 10 categories of typography mistakes with OpenXML values, ASCII mockups, and fixes
references/track_changes_guide.mdRevision marks deep dive
references/troubleshooting.mdSymptom-driven fixes: 13 common problems indexed by what you SEE (headings wrong, images missing, TOC broken, etc.) — search by symptom, find the fix

Mitgelieferte Dateien

Das Modell liest diese Dateien bei Bedarf, während der Skill geladen ist. Sie werden als lesbare Dateien bereitgestellt und niemals ausgeführt.

Weitere Dateien: 19.

Häufig gestellte Fragen

Was macht der KI-Skill 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 with XSD validation gate-check. 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 implie...

Warum Docx in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. Docx besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich Docx in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/okou-ai/okou-skills/tree/main/office/docx ein. TypingMind liest die Datei SKILL.md, bündelt die zugehörigen Dateien und installiert alles als Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können Docx nutzen?

Jedes Modell, das Sie mit TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit Docx verwenden?

So viele Sie möchten. In TypingMind können Sie Docx mit jedem Modell verwenden, das Skills unterstützt, etwa mit GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama. Dabei nutzen Sie Ihre eigenen API-Schlüssel.

Ist der KI-Skill Docx kostenlos?

Ja. Der Skill wird von okou-ai auf GitHub unter der Lizenz MIT veröffentlicht. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: Die Datei SKILL.md enthält den Namen und die Beschreibung des Skills. Hinzu kommen bei Bedarf Skripte, Vorlagen oder Referenzdateien für das Modell. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und kommen daher ohne Server, API-Schlüssel und Laufzeitumgebung aus. Sie funktionieren mit jedem Modell.

Alle anzeigen

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇