docx
Work with Microsoft Word `.docx` files using the installed `paper-docx` distribution, which imports as `docx` and extends `python-docx` with inspection…
от mudler★ 50 644 звезды на GitHub
Установить docx в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
DOCX with paper-docx
The tools named here are installed in the guest image of the sandbox add-on (gVisor or a virtual machine). The host backend does not have them: check that the import works before you rely on it.
Write the scripts you use to build or check a file in the chat's work folder, where the shell starts and that
"$WORK"holds (the note of the turn names it too), for examplepython3 "$WORK/build.py", or run a one-off script inline withpython3 - <<'EOF'. Quote every path with double quotes. Save only the file the user asked for, where they asked or in their home, and nowhere else.
paper-docx is an upgraded distribution of python-docx. It keeps the familiar import and ordinary API:
from docx import Document
document = Document(source_path)
Use your existing knowledge of python-docx for normal paragraphs, runs, styles, tables, sections, pictures, headers, and footers. The fork adds public APIs where ordinary python-docx is weak: finding text across fragmented runs and document stories, editing revisions and review structures, targeting bookmarks/fields/content controls, composing documents, inspecting package changes, and refusing operations it cannot perform safely.
paper-docx is installed under the docx import.
The Paper API companion maps Paper-specific capabilities to their public symbols. The generated API reference covers the complete public API, including the surface inherited from python-docx, with one page per module. It is large; search by symbol and read only the relevant section.
Package behavior
Paper's targets are live. A successful text-changing replacement consumes its Span or Block; an Anchor is location evidence rather than a mutation target. Contextual ranking is inspection-only.
Opening a document can refuse. paper-docx validates the package on intake and rejects an archive with more than one reading, so a hand-rezipped or tool-mangled file may raise MalformedPackageError where upstream python-docx opened it. Saving applies the same check to its own output. Report the refusal and its message rather than working around it; each such refusal matches what Word itself does with that file. Use docx.package.diagnose(path) to triage a file before opening it, since it reports rather than raises.
A docx.errors.PaperRefusal means paper-docx cannot guarantee the attempted operation through its guarded API. The concrete subclass and message identify the condition that caused the refusal; DocumentProtectedError has a documented override in acknowledge_protection(document). In rare cases an ordinary python-docx mutation or direct package editing may be appropriate when unguarded serialization is intentionally acceptable and its effects on the document's package and its revision, comment, and numbering structures are understood. Verify the resulting document carefully; the intake refusal above is not covered.
Precise ZIP/OOXML work is still available when it is genuinely the narrowest operation, the exact package member and schema are understood, and the edit does not cross an ownership boundary that Paper is protecting. Work on a separate candidate, preserve the source, and keep the changed-member budget explicit.
Saving
Document.save() uses ordinary serialization. docx.package.patch_save() retains the original bytes of unchanged package parts and returns change evidence.
Build and check a document
You cannot see a document by reading its code. Build it in the office sandbox profile, which has LibreOffice Writer and fonts, and look at every page before you say it is done.
- Switch first. Call
sandbox_profilewith actionuseand profileofficebefore you write anything. Switching restarts the sandbox: the files stay, but installed packages and running processes are lost. So switch before you build, and build the whole document inoffice. If the switch fails orofficeis not listed, say so and tell the user that the look of the document was not checked. - Build it with the library, as above, and save it.
- Render and look.
sh /usr/local/lib/localai/document-skills/docx/render.sh document.docx [outdir] [dpi]converts the document to a PDF with LibreOffice and writespage-<n>.pngfor each page (default folder: the document's name plus-render, default 80 dpi). It prints the paths. It stops after 180 seconds (RENDER_TIMEOUTchanges that). Open every PNG with the file reader and look at it. Check that text is not cut off or overlapping, that tables and images fit the page, that headings, lists and page breaks are where you meant them to be, and that no page is empty by accident. Fix what you see, and render again. - Say what you checked. Tell the user how many pages you looked at. The render is LibreOffice's, not Word's: fonts, spacing and page breaks can differ a
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- notice.txt
- references/api-001.md
- references/api-002.md
- references/api-003.md
- references/api-004.md
- references/paper-api.md
FAQ
Что делает скилл docx?
Work with Microsoft Word `.docx` files using the installed `paper-docx` distribution, which imports as `docx` and extends `python-docx` with inspection, guarded edits, review structures, composition, diffs, and byte-preserving saves.
Как установить скилл docx?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл docx запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
AnthropicUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
xlsx
AnthropicUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
pptx
AnthropicUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…