officecli-docx
What it does
This skill guides the AI agent in working with .docx Word files through the officecli tool. It is for people who write, format or revise Word documents.
When to use it
- βWhen you want a Word report, letter, memo or proposal written as a .docx file.
- βWhen you need to read or pull text out of an existing Word file.
- βWhen you want to edit a template, add a table of contents or work with comments.
Skill link
https://github.com/iOfficeAI/OfficeCLI/blob/main/skills/officecli-docx/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βCan you write a one-page letter as a Word file and add page numbers in the footer?β
5 new skills a week. 1 minute to read.
How it works
The agent uses officecli to read the document structure and make edits to the content, styles, headers and footers, then checks the result.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
OfficeCLI DOCX Skill
Setup
If officecli is missing:
- macOS / Linux:
curl -fsSL https://d.officecli.ai/install.sh | bash - Windows (PowerShell):
irm https://d.officecli.ai/install.ps1 | iex
Verify with officecli --version (open a new terminal if PATH hasn't picked up). If install fails, download a binary from https://github.com/iOfficeAI/OfficeCLI/releases.
β οΈ Help-First Rule
This skill teaches what good docx looks like, not every command flag. When a property name, enum value, or alias is uncertain, consult help BEFORE guessing.
officecli help docx # List all docx elements
officecli help docx <element> # Full element schema (e.g. paragraph, field, numbering, watermark, toc)
officecli help docx <verb> <element> # Verb-scoped (e.g. add field, set section)
officecli help docx <element> --json # Machine-readable schema
Help is pinned to the installed CLI version. When this skill and help disagree, help is authoritative.
Mental Model
A .docx is a ZIP of XML parts (document.xml, styles.xml, numbering.xml, header*.xml, footer*.xml, comments.xml, β¦). Everything the user sees β headings, tables, page numbers, TOC, tracked changes β is XML inside that ZIP. officecli gives you a semantic-path API (/body/p[1]/r[2]) over it, so you almost never touch raw XML; when you must, use raw-set (see the XML appendix).
Shell & Execution Discipline
docx paths contain []; some prop values contain $. Both are shell metacharacters. Escaping happens at three layers β keep them separate.
- Shell. ALWAYS quote element paths:
"/body/p[1]", not/body/p[1](zsh/bash glob[N]). Single-quote any value containing$:--prop text='$50M'β at any length, the whole value inside one pair of single quotes. Unquoted$50Mis stripped toM; mixing'β¦$varβ¦'and"β¦$50β¦"on one long string is where the$50silently vanishes. - CLI (
text=). The two-char escapes\n,\vand\tARE interpreted in--prop text=(same rule as pptx):\nstarts a new paragraph (each new<w:p>inherits the source paragraph's style),\vis a soft line break within one paragraph (<w:br/>),\ta<w:tab/>. Double the backslash (\\n) for a literal backslash-n (rarely wanted). Row-level table shortcutsc1β¦cNare the exception: there\nis a<w:br/>line break inside the cell (see recipe (e)). - JSON (batch). Batch does NOT interpret the two-char escapes β a JSON
"\\n"or"\\v"lands as literal text. Use JSON escapes for the real characters:"\n"(a newline) starts a new paragraph,"\u000b"is a soft line break.
If in doubt, view text after writing and compare character-for-character.
Incremental execution. officecli mutates the file on every call. Run commands one at a time and check each exit code β a 50-command script that fails at command 3 cascades silently. After any structural op (new style, table, TOC, section break) run get on it before stacking more.
Open/save lifecycle: officecli open <file> at the start, officecli save <file> at the end to flush to disk β save only writes and leaves the resident warm for follow-up edits; reach for officecli close <file> only to release the resident on a one-shot handoff. Both are always safe (never error or lose work). For many paragraphs of one style, use batch (one pass for the whole array). Flush only at the non-officecli boundary: officecli's own reads always see your edits; run save/close only before a non-officecli program reads the file (python-docx, Word, a renderer, delivery).
$FILE convention. All commands use "$FILE" β set it once (FILE="your-doc.docx"). Never copy a literal doc.docx / review.docx into output β always substitute your actual target.
Requirements for Outputs
Deliverable standards every document MUST meet β know these before reaching for a command.
Clear hierarchy. Every non-trivial document has Title β Heading 1 β Heading 2 β body, not a wall of unstyled Normal paragraphs. If view outline shows one flat list, the hierarchy is missing.
Explicit heading sizes (Word default style sizes drift between templates): H1 β₯ 18pt (20pt for long reports), H2 = 14pt bold, H3 = 12pt bold, body = 11β12pt, line spacing 1.15β1.5x. Prefer style=Heading1 over inline sizes so a retheme touches the definition once β but set explicit sizes when you can't trus
FAQ
Do I need Word installed?
No. The skill says officecli works without Microsoft Office.
Can it handle tracked changes?
Yes. The skill covers tracked changes and comments.
Where does help come from?
The skill points to the officecli help command for exact property names.
Details
Original description by the author
Use this skill any time a .docx file is involved -- as input, output, or both. This includes: creating Word documents, reports, letters, memos, or proposals; reading, parsing, or extracting text from any .docx file; editing, modifying, or updating existing documents; working with templates, tracked changes, comments, headers/footers, or tables of contents. Trigger whenever the user mentions 'Word doc', 'document', 'report', 'letter', 'memo', or references a .docx filename.
repo: iOfficeAI/OfficeCLI
Popularity
- GitHub stars
- 33k
- Ranking position
- #9132
- License
- Apache-2.0
- Updated
- 10/30/2026
Comments
- β¦
More skills from this repository
officecli
33kLets your agent create, read, check and edit Word, Excel and PowerPoint files with the officecli tool, without needing Office installed.
morph-ppt-3d
33kHelps your agent build a PowerPoint deck with a 3D GLB model and smooth Morph transitions between slides.
morph-ppt
33kHelps your agent make a PowerPoint file with smooth Morph transitions, where shapes move, grow or rotate between slides.
officecli-academic-paper
33kHelps your agent format a research paper, thesis or manuscript as a Word file with citations, equations and journal-style layout.
Similar skills
feishu-doc
394kHelps your agent read, create, and edit Feishu cloud documents, including text, images, and tables, using the document tool.
feishu-drive
394kLets your agent browse, organize, and comment on files in a Feishu cloud folder that has been shared with the bot.
feishu-perm
394kHelps your agent check and change who can access a Feishu file, choosing the smallest permission that meets your request.