CommunityCodierung & Entwicklunggithub.com

docx

Erstellen, Lesen, Bearbeiten und Analysieren von Word-Dokumenten (.docx) und Word-Vorlagen (.dotx) mit Formatierung wie Inhaltsverzeichnissen, Kopfzeilen, Seitenzahlen und vielem mehr.

Was ist docx?

Dieses Skill ermöglicht die umfassende Arbeit mit Microsoft Word-Dokumenten im .docx- und .dotx-Format. Es unterstützt die Erstellung neuer Dokumente mittels der vorinstallierten npm-Bibliothek „docx“ (docx-js), das direkte Bearbeiten vorhandener Dokumente durch Entpacken und Editieren der XML-Dateien sowie das Auslesen von Inhalten über „pandoc“. Der Skill behandelt typische Fallstricke der docx-js-API, wie korrekte Seitengrößen, Tabellenformatierung, Aufzählungszeichen, Kommentare und nachverfolgte Änderungen. Für die Bearbeitung vorhandener Dokumente werden Hilfsskripte bereitgestellt, die XML-Runs zusammenführen, die Ausgabe validieren und Änderungen verfolgen. Kommentare können ebenfalls über ein Hilfsskript hinzugefügt werden. Die Ausgabe kann zur visuellen Prüfung in PDF konvertiert werden. Der Skill ist für die Verwendung mit Claude Code, Cursor und Codex konzipiert und bietet eine vollständige Pipeline vom Entwurf bis zum validierten Word-Dokument.

Funktioniert mit~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/anthropics/skills/tree/main/skills/docx

Installed? Explore more Codierung & Entwicklung skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Erstellung, Bearbeitung und Analyse von DOCX-Dateien

Eine .docx-Datei ist ein ZIP-Archiv mit XML-Dateien. Wählen Sie Ihren Ansatz je nach Aufgabe:

AufgabeAnsatz
Erstellen eines neuen DokumentsEin docx-Skript (npm) schreiben – siehe Fallstricke unten
Bearbeiten eines vorhandenen Dokumentsunzip → word/document.xml bearbeiten → zip (docx-js kann keine vorhandenen Dateien öffnen)
Lesen von Inhaltenpandoc -t markdown datei.docx

Skriptpfade unten sind relativ zum Verzeichnis dieses Skills.

Erstellen mit docx-js – Fallstricke

docx ist vorinstalliert – führen Sie nicht npm install aus; schreiben Sie das Skript und verwenden Sie require('docx') direkt. Nur wenn dieser require fehlschlägt: npm install docx. Das Modell kennt die API; hier sind die typischen Stolpersteine:

  • Seitengröße standardmäßig A4. Für US Letter setzen Sie page: { size: { width: 12240, height: 15840 } } (DXA; 1440 = 1″).
  • Querformat: Übergeben Sie die Hochformatmaße und orientation: PageOrientation.LANDSCAPE – docx-js vertauscht Breite/Höhe intern.
  • Tabellen benötigen doppelte Breitenangaben: Setzen Sie columnWidths auf der Tabelle UND width auf jeder Zelle, beide in WidthType.DXA (PERCENTAGE funktioniert in Google Docs nicht). Spaltenbreiten müssen in der Summe der Tabellenbreite entsprechen.
  • Tabellenhintergrund: Verwenden Sie ShadingType.CLEAR, niemals SOLID (ergibt schwarz).
  • Listen: Fügen Sie niemals wörtlich • ein; verwenden Sie eine numbering-Konfiguration mit LevelFormat.BULLET.
  • ImageRun benötigt type: ("png", "jpg", …).
  • PageBreak muss innerhalb eines Paragraph stehen.
  • Verwenden Sie niemals \n – verwenden Sie separate Paragraph-Elemente.
  • Inhaltsverzeichnis: Überschriften müssen die integrierten HeadingLevel.* verwenden; benutzerdefinierte Überschriftenformate benötigen ein gesetztes outlineLevel, sonst erscheinen sie nicht.
  • Verwenden Sie keine Tabelle als horizontale Linie – verwenden Sie stattdessen einen unteren Absatzrand.
  • Punktführer / rechtsbündig in derselben Zeile: Verwenden Sie PositionalTab (alignment: PositionalTabAlignment.RIGHT, leader: PositionalTabLeader.DOT) innerhalb eines TextRun, nicht wörtliche . oder Leerzeichen.

Ausgabe überprüfen

Nach dem Schreiben einer .docx-Datei rendern Sie diese und sehen Sie sie an:

python scripts/office/soffice.py --headless --convert-to pdf ausgabe.docx
pdftoppm -jpeg -r 100 ausgabe.pdf seite
ls seite-*.jpg   # dann die Bilder lesen

pdftoppm füllt Seitennummern mit Nullen auf die Breite der Gesamtseitenzahl auf (seite-01.jpg…seite-12.jpg).

Vorhandene Dokumente bearbeiten

Ältere .doc-Dateien müssen zuerst konvertiert werden: python scripts/office/soffice.py --headless --convert-to docx datei.doc.

unzip -q doc.docx -d entpackt/
find entpackt -type l -delete   # Symlink-Einträge entfernen – docx von externen Parteien ist nicht vertrauenswürdig
python scripts/merge_runs.py entpackt/   # fragmentierte Runs zusammenführen, damit Text auffindbar ist
# entpackt/word/document.xml direkt bearbeiten – NICHT neu formatieren oder hübsch drucken
(cd entpackt && rm -f ../out.docx && zip -Xr ../out.docx .)
python scripts/office/validate.py out.docx --original doc.docx   # XSD-Prüfungen; --auto-repair behebt häufige Probleme
# Änderungen verfolgen? --author "<der Name, unter dem Sie Änderungen vorgenommen haben>" hinzufügen, um zu prüfen, dass jede Bearbeitung nachverfolgt wird

Word verteilt Text über viele <w:r>-Runs (Revisions-IDs, Rechtschreibmarkierungen), sodass ein im Dokument sichtbarer Ausdruck im XML oft nicht als zusammenhängende Zeichenfolge existiert. merge_runs.py führt benachbarte, identisch formatierte Runs in word/document.xml zusammen, ohne Inhalt oder Darstellung zu ändern; es akzeptiert auch eine .docx-Datei direkt (python scripts/merge_runs.py doc.docx -o merged.docx).

Nachverfolgte Änderungen: Validieren Sie beim Überarbeiten mit --author "<der Name, unter dem Sie Änderungen vorgenommen haben>" (benötigt --original) – es meldet jeden Text, den Sie ohne umschließendes <w:ins>/<w:del> geändert haben, was leicht versehentlich passiert und in der akzeptierten Ansicht unsichtbar ist. Umschließen Sie Runs mit <w:ins>/<w:del> und den Attributen w:id, w:author, w:date. Innerhalb von <w:del> lautet das Textelement <w:delText>, nicht <w:t>. Ein gelöschtes Absatzzeichen (<w:pPr><w:rPr><w:del w:id=".." w:author=".." w:date=".."/></w:rPr></w:pPr>) bedeutet „diesen Absatz mit dem nächsten zusammenführen“ – einen Absatz komplett zu löschen besteht daher aus diesem Element plus einem <w:del> um jeden Run. Das <w:del/> muss vor den anderen Kindern des rPr kommen; ihre Reihenfolge ist schemaerzwungen.

Um eine saubere Kopie mit allen akzeptierten Änderungen zu erstellen: python scripts/accept_changes.py in.docx out.docx.

Das Akzeptieren eines gelöschten Absatzzeichens sollte diesen Absatz mit dem darunterliegenden verbinden, sodass ein Absatz, dessen Runs alle gelöscht sind, verschwindet. Word macht das; accept_changes.py und pandoc --track-changes=accept tun es nicht immer. Beide scheitern auf die gleiche Weise – sie entfernen den gelöschten Text, lassen aber den leeren Absatz zurück, der sich bei automatischer Nummerierung als unerwartetes leeres Aufzählungszeichen liest:

  • pandoc --track-changes=accept verbindet die Absätze nie.
  • accept_changes.py (LibreOffice) verbindet sie korrekt, außer wenn der gelöschte Absatz von einem leeren Abstandsabsatz gefolgt wird.

Ein leeres Aufzählungszeichen in einer der beiden Ansichten ist ein Artefakt dieser Ansicht, kein Fehler im Dokument. Überprüfen Sie Absatzlöschungen im XML.

Kommentare

Kommentare erfordern sechs miteinander verknüpfte Dateien. Verwenden Sie das Hilfsskript – Verzeichnismodus, wenn Sie auch document.xml bearbeiten (spart einen Entpack-/Wiederverpackungszyklus), andernfalls im .docx-Direktmodus:

# Gegen ein bereits entpacktes Verzeichnis (bevorzugt, wenn auch Marker gesetzt werden)
python scripts/comment.py entpackt/ "Gebühren- & Ausgabendeckel ist zu niedrig"
python scripts/comment.py entpackt/ "Einverstanden" --parent 0

# Gegen eine .docx-Datei direkt
python scripts/comment.py vertrag.docx "Dieser Deckel ist zu niedrig" -o annotiert.docx

Das Skript schreibt comments.xml, commentsExtended.xml, commentsIds.xml, commentsExtensible.xml, die Beziehungen und die Content-Type-Überschreibungen. Kommentar-IDs werden automatisch vergeben. Dann gibt es den <w:commentRangeStart>-/<w:commentRangeEnd>-/<w:commentReference>-Ausschnitt aus, der zu word/document.xml hinzugefügt werden muss, damit der Kommentar an einem bestimmten Text verankert wird – bis Sie diese Marker platzieren, existiert der Kommentar, ist aber nicht sichtbar.

Abhängigkeiten

docx (npm, vorinstalliert – nur installieren, wenn require('docx') fehlschlägt) · pandoc · LibreOffice (soffice) · pdftoppm (Poppler)

Individual skills in this repo

This repo contains 19 individual skills — each has its own dedicated page.

academy-guide

Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content.

algorithmic-art

Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists

anthropics/template-skill

Replace with description of the skill and when Claude should use it.

brand-guidelines

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

canvas-design

Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists

claude-api

|-

discernment-nudge

After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals, or emails, estimates or projections, analysis or interpretation of data, factual claims they may rely on, or a multi-step argument — invoke this skill BEFORE finalizing your reply and then, if it applies, append 2-3 short follow-up questions, each tied to something specific in what you just produced, that help the user check key facts, probe the reasoning or assumptions, and notice missing context. Do this at most once per conversation. Skip it when the user asked a trivial how-to or simple lookup, wants a purely educational explanation, asked you only to format, convert, or assemble a file from content they provided, is writing code they will run, is doing creative writing or casual chat, or already asked you to double-check, cite, or review — the skill file explains these boundaries and the exact output format.

doc-coauthoring

Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.

frontend-design

Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.

internal-comms

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

mcp-builder

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

pdf

Use 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 PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.

pptx

Use 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 presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.

skill-creator

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill

slack-gif-creator

Knowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like

theme-factory

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

web-artifacts-builder

Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.

xlsx

Use 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 .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.

Verwandte Skills