Word Document Skill
When someone needs an actual .docx — a report, proposal, contract, or formal letter they'll edit in
Word — markdown won't do. This skill produces a real Word file by writing and running a python-docx
script: proper heading styles (so the navigation pane and a TOC work), clean body text, tables, and
page structure — a document that looks authored, not exported.
Environment: produces a binary file, so it needs code execution — Claude Code, the
API code-execution tool, or Claude.ai. In the browser playground, the existing Word/PDF export
turns any skill's markdown into a document; this skill is for a built-to-spec .docx.
Required Inputs
Ask for these only if they aren't already provided:
- Document type — report, proposal, contract, SOP, letter, whitepaper — and its purpose/audience.
- The content — the material (or a brief to expand), and the required sections/structure.
- Formatting needs — headings/TOC, tables, numbered clauses (contracts), a cover page, letterhead/brand.
- Length & tone.
Process
- Outline the structure — the section hierarchy (H1/H2/H3), and where tables or numbered clauses go. Confirm structure for formal docs (contracts, proposals).
- Write a
python-docx script that:
- Uses real heading styles (
Heading 1/2/3) — not bold body text — so the nav pane, cross-refs, and a generated TOC work.
- Sets clean body styling (font, size, spacing), adds tables with proper headers where needed, and page elements (title/cover, page numbers, sections) as required.
- For contracts/formal docs: numbered headings/clauses and consistent defined-term formatting.
- Saves to a clearly named
.docx.
- Run it, then summarise the document and note anything the user must fill (signatures, figures, brand assets).
Output Format
- The generated
.docx file.
- A short contents summary (the section structure) and a list of placeholders/fields the user needs to complete.
Quality Checks
Anti-Patterns
Based On
Document-production practice (style-based formatting, structured headings, TOC-ready) implemented with python-docx.
Programmatic Helper
This skill ships scripts/docx_tool.py — zero-dependency (stdlib zip+XML) production of real .docx files:
# Markdown-lite → Word (#/##/### headings, - bullets, 1. numbered, **bold**, *italic*)
python3 scripts/docx_tool.py create out.docx --text-file doc.md
# Fill {{placeholders}} through an existing .docx (body, headers, footers) —
# handles Word splitting a placeholder across formatting runs
python3 scripts/docx_tool.py fill template.docx out.docx --values '{"client":"Acme","date":"2026-07-03"}'
# Verify what a .docx actually says (plain-text extraction)
python3 scripts/docx_tool.py extract out.docx
Write the document first (per this skill), then create it as a real file. Honest limits: the markdown subset above with default styling; complex templates keep their formatting except in paragraphs where a placeholder spanned runs.
1---2name: word-document-23description: "Build a real, formatted Word (.docx) document — headings, styles, tables, TOC-ready. Use when asked to produce a Word doc, a .docx, a formatted report/contract/proposal/letter as an actual file (not markdown). Produces an actual .docx via a generated python-docx script with proper heading styles, body text, tables, and page structure. Requires a code-execution environment (Claude Code, the API code tool, or Claude.ai)."4homepage: https://mohitagw15856.github.io/pm-claude-skills/skill/word-document.html5metadata:6 source: https://skillmd.com/skills/mohitagw15856/word-document-27 openclaw:8 emoji: 📄9---1011# Word Document Skill1213When someone needs an actual `.docx` — a report, proposal, contract, or formal letter they'll edit in14Word — markdown won't do. This skill produces a real Word file by **writing and running a `python-docx`15script**: proper heading styles (so the navigation pane and a TOC work), clean body text, tables, and16page structure — a document that looks authored, not exported.1718> **Environment:** produces a binary file, so it needs code execution — **Claude Code**, the19> **API code-execution tool**, or **Claude.ai**. In the browser playground, the existing Word/PDF export20> turns any skill's markdown into a document; this skill is for a built-to-spec `.docx`.2122## Required Inputs2324Ask for these only if they aren't already provided:2526- **Document type** — report, proposal, contract, SOP, letter, whitepaper — and its purpose/audience.27- **The content** — the material (or a brief to expand), and the required sections/structure.28- **Formatting needs** — headings/TOC, tables, numbered clauses (contracts), a cover page, letterhead/brand.29- **Length & tone**.3031## Process32331. **Outline the structure** — the section hierarchy (H1/H2/H3), and where tables or numbered clauses go. Confirm structure for formal docs (contracts, proposals).342. **Write a `python-docx` script** that:35 - Uses **real heading styles** (`Heading 1/2/3`) — not bold body text — so the nav pane, cross-refs, and a generated TOC work.36 - Sets clean body styling (font, size, spacing), adds **tables** with proper headers where needed, and page elements (title/cover, page numbers, sections) as required.37 - For contracts/formal docs: numbered headings/clauses and consistent defined-term formatting.38 - Saves to a clearly named `.docx`.393. **Run it**, then summarise the document and note anything the user must fill (signatures, figures, brand assets).4041## Output Format4243- The **generated `.docx` file**.44- A short **contents summary** (the section structure) and a list of placeholders/fields the user needs to complete.4546## Quality Checks4748- [ ] Headings use real Word heading **styles** (not bold paragraphs) — TOC/nav pane work49- [ ] Body text, spacing, and tables are consistently formatted50- [ ] Structure matches the document type (e.g. numbered clauses for a contract)51- [ ] The script runs and the file opens cleanly in Word/Pages/Docs52- [ ] Placeholders the user must complete are clearly flagged5354## Anti-Patterns5556- [ ] Do not fake headings with bold text — use heading styles, or the document's structure breaks57- [ ] Do not dump unstructured text — apply the section hierarchy the doc type needs58- [ ] Do not hand-format what a style should do — consistent styles beat per-paragraph fiddling59- [ ] Do not invent contract/legal terms silently — mark drafted clauses and recommend review for anything legal60- [ ] Do not claim a file was produced without code execution — fall back to the markdown export instead6162## Based On6364Document-production practice (style-based formatting, structured headings, TOC-ready) implemented with python-docx.6566## Programmatic Helper6768This skill ships `scripts/docx_tool.py` — **zero-dependency** (stdlib zip+XML) production of real `.docx` files:6970```bash71# Markdown-lite → Word (#/##/### headings, - bullets, 1. numbered, **bold**, *italic*)72python3 scripts/docx_tool.py create out.docx --text-file doc.md7374# Fill {{placeholders}} through an existing .docx (body, headers, footers) —75# handles Word splitting a placeholder across formatting runs76python3 scripts/docx_tool.py fill template.docx out.docx --values '{"client":"Acme","date":"2026-07-03"}'7778# Verify what a .docx actually says (plain-text extraction)79python3 scripts/docx_tool.py extract out.docx80```8182Write the document first (per this skill), then `create` it as a real file. Honest limits: the markdown subset above with default styling; complex templates keep their formatting except in paragraphs where a placeholder spanned runs.