Skip to content
Skills Library
Documents & office · Conversion & formats

docx

/docx

Use this skill any time a Word document is the primary input or output. This means any task where the user wants to: create a new .docx from scratch, from an outline, or from other source material; open, read, edit, or fix an existing .docx or .dotx (rewriting sections, restyling, adding tables or images, fixing headings, updating headers and footers); extract text, structure, or comments out of a document; produce a report, letter, contract, or memo as a Word file; or fill a Word template with data. Trigger especially when the user references a document by name or path — even casually (like \

Licence
MIT
Last repository change
12.11.2026

Assessment and security

95/ 100Class: good
Format20 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 12.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Use this skill any time a Word document is the primary input or output. This means any task where the user wants to: create a new .docx from scratch, from an outline, or from other source material; open, read, edit, or fix an existing .docx or .dotx (rewriting sections, restyling, adding tables or images, fixing headings, updating headers and footers); extract text, structure, or comments out of a document; produce a report, letter, contract, or memo as a Word file; or fill a Word template with data. Trigger especially when the user references a document by name or path — even casually (like \

Original author description

Use this skill any time a Word document is the primary input or output. This means any task where the user wants to: create a new .docx from scratch, from an outline, or from other source material; open, read, edit, or fix an existing .docx or .dotx (rewriting sections, restyling, adding tables or images, fixing headings, updating headers and footers); extract text, structure, or comments out of a document; produce a report, letter, contract, or memo as a Word file; or fill a Word template with data. Trigger especially when the user references a document by name or path — even casually (like \

How it works

  1. The one rule that matters most
  2. Gotchas that cost real time
  3. Reading an existing document
  4. Requirements for every document you produce
Original SKILL.md headings · 87 lines, 576 words
SKILL.md preview
---
name: docx
description: "Use this skill any time a Word document is the primary input or output. This means any task where the user wants to: create a new .docx from scratch, from an outline, or from other source material; open, read, edit, or fix an existing .docx or .dotx (rewriting sections, restyling, adding tables or images, fixing headings, updating headers and footers); extract text, structure, or comments out of a document; produce a report, letter, contract, or memo as a Word file; or fill a Word template with data. Trigger especially when the user references a document by name or path — even casually (like \"the contract in my downloads\") — and wants something done to it or produced from it. The deliverable must be a Word file. Do NOT trigger when the primary deliverable is a PDF, a spreadsheet, a slide deck, an HTML page, or a Markdown file, even if prose is involved."
---

# DOCX creation, editing, and extraction

| Task | Approach |
|---|---|
| **Create** or **edit** paragraphs, tables, images | `python-docx` — see gotchas below |
| **Read** text and structure quickly | `markitdown doc.docx` — headings, lists and tables as Markdown |
| **Start from a template** | open the `.docx`/`.dotx` and use its own styles — never hand-build a look |
| **Fill a template repeatedly** | `docxtpl` (Jinja syntax inside the document) |
| **Convert to PDF** | LibreOffice: `soffice --headless --convert-to pdf doc.docx` |

> `python-docx` and `markitdown` are commonly preinstalled — write the script and import directly. Only if the import fails: `pip install python-docx`.

## The one rule that matters most

**Use named styles, never manual formatting.** A heading is `document.add_heading(...)` or `style="Heading 1"` — not 16pt bold text. Styles are what make the navigation pane, the table of contents, cross-references, and the user's own template work. Bold text that merely *looks* like a heading breaks all four, silently.

```python
from docx import Document

doc = Document("template.docx")          # or Document() for the default styles
doc.add_heading("Quarterly results", level=1)
doc.add_paragraph("Revenue grew 25% year on year.")
doc.add_paragraph("Margin improved", style="List Bullet")
doc.save("out.docx")
```

Check what a template actually offers before assuming a style exists:

```python
for s in doc.styles:
    print(s.type, s.name)
```

Referencing a style the document does not define raises `KeyError`.

## Gotchas that cost real time

**A paragraph is made of runs, and formatting lives on the run.** `paragraph.text = "..."` destroys all formatting in it. To change wording while keeping formatting, edit `run.text`.

**Find-and-replace breaks across runs.** Word splits a sentence into runs at every formatting change *and* often mid-word after editing. Searching `paragraph.text` finds the match; the characters may live in three runs. For simple cases, join and rewrite the runs:

```python
if old in paragraph.text:
    for run in paragraph.runs[1:]:
        run.text = ""
    paragraph.runs[0].text = paragraph.text.replace(old, new)
```

That flattens formatting in that paragraph — acceptable for plain body text, wrong for anything styled. Say which you did.

**There is no `delete_paragraph`.** Remove the element:

```python
p = paragraph._element
p.getparent().remove(p)
```

**Tables need their style set explicitly** or they come out with no borders: `doc.add_table(rows=1, cols=3, style="Table Grid")`.

**`add_picture` needs one dimension**, like slides — passing both distorts the image.

**A table of contents cannot be generated.** `python-docx` can insert the TOC *field*, but only Word computes the page numbers; it renders empty until someone opens the document and refreshes. Tell the user rather than shipping a blank page.

**Headers and footers are per-section**, and a new section does not inherit unless you ask: `section.header.is_linked_to_previous = True`.

## Reading an existing document

```python
doc = Document("in.docx")
for p in doc.paragraphs:
    if p.text.strip():
        print(p.style.name, "|", p.text)
for t in doc.tables:
    for row in t.rows:
        print([c.text for c in row.cells])
```

`doc.paragraphs` does **not** include text inside tables, headers, footers, or textboxes. If a document looks half-empty, that is why — iterate `doc.tables` and `section.header.paragraphs` too.

## Requirements for every document you produce

- **Reopen and verify.** Assert the heading structure and paragraph count after saving.
- **Heading levels must nest.** No `Heading 3` directly under `Heading 1`.
- **Keep the template's styles** when one was supplied. If you had to add a style because the template lacked it, say so.
- **Report what will not render until opened** — a TOC field, cross-references, or anything else Word computes at load. Otherwise the user sends a document with a blank contents page.

Versions

RepositoryScoreLicence
This page · adithyanraj03/dsh-skills-pack95MIT
rongxinzy/rongxinai100AGPL-3.0
mateaix/mateclaw100Apache-2.0
neromtoobad/creator-skills100MIT
TerminalSkills/skills100Apache-2.0
okou-ai/okou-skills100MIT
openbmb/pilotdeck100AGPL-3.0
wrongstack/wrongstack100MIT
asgeirtj/system_prompts_leaks100CC0-1.0

Database snapshot: 13.11.2026 · package version ff14fef30f62 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 2 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100docx-generator
    Create, read, and edit Word (.docx) files - styles, tables, images, headers, and templates - using python-docx. Use whenever a deliverable must be a Word document.
  • 100documents
    Create, read, edit, review, comment on, sanitize, render, and validate Microsoft Word DOCX documents. Use whenever a DOCX or Word document is a primary input or deliverable, including reports, proposals, forms, templates, tracked revisions, comments, tables, images, headers,…
  • 95pptx
    Use this skill any time a PowerPoint presentation is the primary input or output. This means any task where the user wants to: create a new .pptx deck from scratch, from an outline, or from other source material (a report, a spreadsheet, notes); open, read, edit, or fix an…
  • 100word-read-write
    Create and read Microsoft Word (.docx) documents. Use this skill when you need to generate reports/letters/templates as .docx or extract readable text from existing .docx files.
  • 100zepi-docx
    Read and edit Word documents with python-docx on the bundled runtime — styles, numbering, tables, headers and footers, page breaks, images, find-and-replace across runs, and merging documents. Use for any task whose input or output is a .docx file, including extracting text or…
  • 100doc-skill-docx
    Creates and edits Word documents with python-docx: styles, tables, headers, footers, track-changes-safe edits. Use when the user asks for docx document skill work, or mentions doc, skill, docx.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.