Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

docx

БесплатноЗапускает вложенные скриптыНе проверен

Create, read, edit, template, and review Word .docx files.

jiayaoqijiaот jiayaoqijia★ 81 звезда на GitHub

Об этом скилле

Docx Skill

Create, read, edit, and template Microsoft Word .docx files with python-docx via small CLIs. It handles text, styles, lists, tables, images, headers/footers, {{token}} templating, tracked changes (list/accept/reject), comments (list/add/delete), TOC and page-number fields, and package health checks. It does not render documents itself (PDF needs LibreOffice — see Converting to PDF) or edit legacy .doc.

Layout depth that is only needed sometimes lives in references/:

  • Building a designed document from scratch (cover page, shaded tables, repeating header rows, caption pairing, PAGE field footer) plus the render-and-inspect loop: references/python-docx-layout-recipes.md

When to Use

  • The user asks to generate a Word document (report, letter, contract).
  • You need the text, outline, styles, or embedded images of a .docx.
  • You must change an existing .docx: replace text, edit table cells, insert/delete paragraphs, apply styles, merge fragmented runs.
  • You have a .docx template with {{placeholders}} to fill from data.
  • The document has tracked changes to review, accept, or reject.
  • You need to read reviewers' comments, or add/delete comments.
  • A .docx won't open or behaves oddly and you need corruption triage.
  • The document needs a table of contents or "Page X of Y" footers.
  • Not for: .doc (legacy), .odt, or WYSIWYG layout work.

Prerequisites

  • Python 3.10+ with python-docx installed: pip install python-docx (import name is docx; lxml comes with it).
  • Comments add uses the native API on python-docx >= 1.2 and an XML fallback on older versions — both are automatic.
  • For image blocks: the image files must exist locally (PNG/JPEG).

How to Run

All helpers live in scripts/ next to this file. Run them with the terminal tool; each supports --help and prints JSON to stdout.

python scripts/docx_create.py spec.json out.docx
python scripts/docx_read.py out.docx --text
python scripts/docx_edit.py replace out.docx --find old --replace new
python scripts/docx_template.py tpl.docx values.json filled.docx
python scripts/docx_revisions.py list out.docx
python scripts/docx_comments.py list out.docx
python scripts/docx_validate.py out.docx

Quick Reference

Task Command
Create from JSON spec docx_create.py spec.json out.docx
Full text (body+tables+headers/footers) docx_read.py f.docx --text
Heading outline + table shapes docx_read.py f.docx --structure
Styles actually used docx_read.py f.docx --styles
Extract embedded images docx_read.py f.docx --images outdir/
Detect tracked changes/comments docx_read.py f.docx --revisions
Find/replace (formatting kept) docx_edit.py replace f.docx --find A --replace B -o out.docx
Set a table cell docx_edit.py set-cell f.docx --table 0 --row 1 --col 2 --text X
Insert paragraph before index N docx_edit.py insert f.docx --index N --text X --style Normal
Delete paragraph N docx_edit.py delete f.docx --index N
Apply style to paragraph N docx_edit.py style f.docx --index N --style "Heading 1"
Merge equal-format adjacent runs docx_edit.py normalize f.docx -o out.docx
Insert TOC field before para N docx_edit.py toc f.docx --index N -o out.docx
"Page X of Y" footer fields docx_edit.py page-numbers f.docx
Fill {{tokens}} docx_template.py tpl.docx values.json out.docx --strict
List revisions (id/author/date/text) docx_revisions.py list f.docx
Accept / reject all revisions docx_revisions.py accept-all f.docx -o out.docx (or reject-all)
Accept / reject one revision docx_revisions.py accept f.docx --id 3 -o out.docx
List comments (+anchored text) docx_comments.py list f.docx
Add comment anchored to text docx_comments.py add f.docx --target "phrase" --text "note" --author You
Delete comment by id docx_comments.py delete f.docx --id 0
Health-check the package docx_validate.py f.docx (exit 1 on errors)

Procedure

  1. Create. Write a JSON spec with write_file, then run scripts/docx_create.py. The spec supports: page (size + margins in mm), header/footer strings, footer_page_numbers (adds a "Page X of Y" field footer), styles (custom paragraph styles with font, size, bold/italic, hex color), and blocks — heading (level 1-9), paragraph (either text or a runs list where each run may set bold/italic/underline), bullet_list, numbered_list, table (header row rendered bold, rows, optional built-in table style such as Table Grid), image (path, optional width_mm), toc (Table of Contents field), and page_break. The full spec format is documented at the top of scripts/docx_create.py.
  2. Read. Use scripts/docx_read.py with exactly one mode flag. --text returns body paragraphs, all table cell text, and header/footer t
Полный SKILL.md на GitHub

Установить docx в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

LICENSESOURCE.mdTRUST.auto.yamlreferences/python-docx-layout-recipes.mdreferences/revisions-and-comments.mdscripts/docx_comments.pyscripts/docx_common.pyscripts/docx_create.pyscripts/docx_edit.pyscripts/docx_read.pyscripts/docx_revisions.pyscripts/docx_template.pyscripts/docx_validate.pyscripts/pdf_page_fill.py

FAQ

Что делает скилл docx?

Create, read, edit, template, and review Word .docx files.

Как установить скилл docx?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл docx запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить docx с