docx
Skill này làm gì
Skill này làm việc với file Microsoft Word, từ đọc cấu trúc đến chỉnh sửa và tạo mới. Skill dành cho bất kỳ ai cần thay đổi hoặc tạo tài liệu Word và muốn giữ nguyên kiểu dáng.
Khi nào nên dùng
- ✓Khi bạn có một file Word và cần lấy văn bản hoặc cấu trúc của nó ra.
- ✓Khi bạn cần chỉnh sửa tài liệu Word nhưng vẫn giữ kiểu dáng và bố cục.
- ✓Khi bạn muốn tạo một tài liệu Word mới từ một bản brief.
Liên kết skill
https://github.com/TokenRhythm/opensquilla/blob/main/src/opensquilla/skills/bundled/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ể cập nhật giá trong hợp đồng Word này và giữ định dạng như cũ không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent xem cấu trúc của file trước để biết bên trong có gì, rồi chỉnh sửa nội dung ngay trong file để kiểu dáng và bố cục được giữ nguyên. Với tài liệu mới, nó tạo file từ brief của bạn.
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.
docx
Work with Microsoft Word .docx files. The format is OOXML — a zip container
holding XML parts (word/document.xml, styles.xml, numbering.xml, headers,
footers, relationships). Treat structure as primary; rendered text is a view.
Decide the path first
Pick one path up front. The right path depends only on what is on disk before you start.
| You have | Goal | Path |
|---|---|---|
Existing .docx |
Read text/structure | A. Inspect |
Existing .docx |
Modify content while keeping styles | B. Edit-in-place |
| Nothing or a brief | Build a new doc | C. Create from scratch |
If the user hands you a doc and asks for changes, default to path B and treat the input as the visual style baseline. Only choose path C when the user says "start fresh" or there is no input.
Path A: Inspect
Dump structure as JSON for inspection without mutating anything.
python {baseDir}/scripts/inspect_docx.py /path/to/doc.docx
Output schema:
{
"paragraphs": [{"index": 0, "text": "...", "style": "Heading 1"}, ...],
"tables": [[["row0,col0", "row0,col1"], ...], ...],
"sections": 1,
"has_tracked_changes": false
}
Use this whenever you need to see what is in the doc before deciding how to edit. The output is stable and machine-readable — diff two inspect outputs to verify a round-trip preserved everything you intended.
Path B: Edit in place
Two sub-strategies; pick by how invasive the edit is.
B1. Run-level text replacement (preferred)
When the change is "swap this string" or "fill these placeholders": mutate runs in place. This preserves all theme/style/font settings.
python {baseDir}/scripts/edit_docx.py input.docx ops.json --out output.docx
ops.json is a list of operations:
[
{"op": "replace_run", "para": 0, "run": 0, "text": "Q3 Review"},
{"op": "replace_text", "find": "{{CLIENT}}", "with": "Acme Corp"}
]
Edit at the run level, not the paragraph level — replacing whole paragraph text drops formatting. If a placeholder spans multiple runs (often happens when the original template applied bold/italic mid-word), the helper script collapses runs into the first one and clears the rest.
B2. Structural edits (sections / page layout / numbering)
python-docx exposes paragraphs, tables, and runs but has limited support for
page layout, numbering definitions, and tracked changes. For those, unzip the
.docx, patch word/document.xml and adjacent parts, and repack:
mkdir _unpacked && (cd _unpacked && unzip -q ../input.docx)
# edit _unpacked/word/document.xml
(cd _unpacked && zip -q -r ../output.docx . -x "*.DS_Store")
Rules when patching XML:
- Use
defusedxml.ElementTreeorlxml, not stdlibxml.etree.ElementTree. ET drops or rewrites namespace prefixes (w:,r:) in ways Word refuses to load. - Preserve
xml:space="preserve"on<w:t>elements that hold leading or trailing whitespace. [Content_Types].xmlmust list every part type. Removing a header without also removing its override entry yields a "repair" prompt in Word.- Numbering definitions live in
numbering.xml; bullet/number changes must patch the numbering ID, not just the visible text.
When done, validate by opening in LibreOffice headless before declaring success — silent failures are common.
Path C: Create from scratch
For a simple Markdown source, run the export script with the Markdown on stdin:
python {baseDir}/scripts/export_markdown_docx.py --out out.docx < draft.md
For structured content, use a JSON specification:
python {baseDir}/scripts/create_docx.py spec.json --out out.docx
spec.json describes content declaratively:
{
"metadata": {"title": "Q3 Review", "author": "Wei E."},
"body": [
{"kind": "heading", "level": 1, "text": "Q3 Review"},
{"kind": "paragraph", "text": "Revenue +18% YoY."},
{"kind": "table", "rows": [["Metric", "Value"], ["Revenue", "$2.1M"]]}
]
}
For programmatic use call python-docx directly:
from docx import Document
doc = Document()
doc.add_heading("Q3 Review", level=1)
doc.add_paragraph("Revenue +18% YoY.")
table = doc.add_table(rows=2, cols=2)
table.rows[0].cells[0].text = "Metric"
doc.save("out.docx")
See references/python_docx.md for paragraphs, styles, numbering, tables, headers/footers, and section breaks.
Tracked changes
Tracked changes are stored in `word/document
Câu hỏi thường gặp
Skill có giữ định dạng của tôi không?
Có. Khi chỉnh sửa, skill xem file hiện có là chuẩn kiểu dáng và giữ nguyên.
Skill có xử lý thay đổi đang theo dõi không?
Có. Skill bao gồm việc xem lại các thay đổi đang được theo dõi trong file Word.
Nếu tôi muốn một file mới thì sao?
Nếu bạn nói bắt đầu lại hoặc không có file đầu vào, skill sẽ tạo một tài liệu mới.
Chi tiết
Mô tả gốc của tác giả
Read, inspect, edit, or create Microsoft Word `.docx` documents, including structured text extraction, style-preserving edits, tracked-change review, and generation from a brief.
repo: TokenRhythm/opensquilla
Độ phổ biến
- Sao GitHub
- 7.1k
- Vị trí xếp hạng
- #13588
- Giấy phép
- Apache-2.0
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
browser-use
7.1kCho phép agent của bạn mở, đọc và thao tác với các trang web trong trình duyệt thanh bên của OpenSquilla Desktop, gồm biểu mẫu và kiểm tra trực quan.
deep-research
7.1kDạy agent của bạn nghiên cứu nhiều vòng với kế hoạch đã lưu, nguồn được theo dõi và một báo cáo dài có trích dẫn.
html-coder
7.1kGiúp agent của bạn viết trang HTML sạch, có cấu trúc ngữ nghĩa, biểu mẫu dễ tiếp cận, phương tiện và tính năng HTML5, rồi mở xem trước trên web.
pdf-toolkit
7.1kGiúp agent của bạn trích xuất văn bản và bảng từ PDF, gộp hoặc tách file, điền trường biểu mẫu và tạo PDF mới từ dữ liệu.
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.