officecli-docx
Skill này làm gì
Skill này hướng dẫn agent AI làm việc với tệp Word .docx qua công cụ officecli. Skill dành cho người viết, định dạng hoặc chỉnh sửa tài liệu Word.
Khi nào nên dùng
- ✓Khi bạn muốn viết một báo cáo, thư, bản ghi nhớ hoặc đề xuất Word dưới dạng tệp .docx.
- ✓Khi bạn cần đọc hoặc lấy văn bản từ một tệp Word có sẵn.
- ✓Khi bạn muốn chỉnh sửa một mẫu, thêm mục lục hoặc làm việc với nhận xét.
Liên kết skill
https://github.com/iOfficeAI/OfficeCLI/blob/main/skills/officecli-docx/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể viết một lá thư một trang thành tệp Word và thêm số trang vào chân trang không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent dùng officecli để đọc cấu trúc tài liệu, chỉnh sửa nội dung, kiểu dáng, đầu trang và chân trang, rồi kiểm tra kết quả.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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
Câu hỏi thường gặp
Tôi có cần cài Word không?
Không. Skill cho biết officecli hoạt động mà không cần Microsoft Office.
Có xử lý được theo dõi thay đổi không?
Có. Skill bao gồm theo dõi thay đổi và nhận xét.
Tìm trợ giúp ở đâu?
Skill chỉ đến lệnh trợ giúp của officecli để tra cứu tên thuộc tính chính xác.
Chi tiết
Mô tả gốc của tác giả
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
Độ phổ biến
- Sao GitHub
- 33k
- Vị trí xếp hạng
- #9132
- Giấy phép
- Apache-2.0
- Cập nhật
- 30/10/2026
Bình luận
- …
Thêm skill từ kho mã này
officecli
33kCho phép agent của bạn tạo, đọc, kiểm tra và chỉnh sửa tệp Word, Excel và PowerPoint bằng công cụ officecli, không cần cài Office.
morph-ppt-3d
33kGiúp agent của bạn tạo bộ slide PowerPoint có mô hình 3D GLB và chuyển cảnh Morph mượt giữa các slide.
morph-ppt
33kGiúp agent của bạn tạo tệp PowerPoint với chuyển cảnh Morph mượt, nơi các hình có thể di chuyển, phóng to hoặc xoay giữa các slide.
officecli-academic-paper
33kGiúp agent của bạn định dạng bài nghiên cứu, luận văn hoặc bản thảo thành tệp Word, với trích dẫn, công thức và bố cục theo chuẩn tạp chí.
Skill tương tự
feishu-doc
394kGiúp agent của bạn đọc, tạo và sửa tài liệu đám mây Feishu, gồm văn bản, hình ảnh và bảng, bằng công cụ tài liệu.
feishu-drive
394kCho phép agent của bạn duyệt, sắp xếp và bình luận các file trong một thư mục đám mây Feishu đã được chia sẻ với bot.
feishu-perm
394kGiúp agent của bạn kiểm tra và thay đổi ai có quyền truy cập một file Feishu, chọn quyền nhỏ nhất đáp ứng yêu cầu của bạn.