docx-extract-template
БесплатноЗапускает вложенные скриптыНе проверенExtract a template skill from a Word document for filling slots, reusing structure and expression, or applying its visual style. Use when asked to extract a…
от okou-ai★ 81 звезда на GitHubОб этом скилле
Extract a template package from a docx
Input: one .docx. Output: a loadable skill package whose instructions and
resources match the selected reuse scope.
Run every command below from extract-template/docx/.
For .doc or WPS-authored .docx input, first save a separate .docx copy from
Word and keep the supplied original.
Create page images to inspect the document's layout, typography and fillable areas, then choose the reuse scope. Keep the original for its editable structure and styles. Reuse existing source captures; otherwise render once at the original page proportions:
node ../scripts/render-document.mjs --input <source.docx> --out source-render
Inspect the returned page images; the returned PDF is also available for reference. Use a new output directory for each render.
Choose the reuse scope
Read ../document-reuse.md, choose from representative
rendered pages and the user's purpose, then use the matching section below.
For style extraction, continue at Style extraction.
Slot filling
Copy the source to package/template.docx. Write package/SKILL.md with the
slot map and filling instructions from the shared guide. Locate each slot in
the document's XML and record enough context to distinguish repeated blanks.
Tell the generated skill to edit only those slots in a copy of template.docx.
Replace their text inside <w:t> while preserving run and paragraph
properties. Slots may use non-text XML such as an underlined <w:tab/>.
Record their blank area and how to insert a value while preserving fixed
labels, alignment and underline extent. Replacing a tab outright can move
the text that follows it; verify the filled rendering.
Patch the affected XML entries in the ZIP; preserve all other entries as they are. Opening and saving through python-docx or LibreOffice can rewrite parts outside the slots. Render the filled copy and verify the values fit and the rest of the document is unchanged. Continue at Publish the source package.
Structure and expression reuse
Copy the source to package/example.docx. Write package/SKILL.md with the
structure and writing rules from the shared guide, grounded in the source's
actual wording. Include where each kind of new content belongs, what may vary
in length or number, and which passages remain fixed.
Instruct the skill to draft content using those rules and edit a copy of
example.docx. Preserve the formatting of each kind of block. Add or remove
repeating items by copying or deleting the matching paragraph, table row or
section as a whole, keeping its formatting and required XML relationships.
Include separator paragraphs in the copied group when they provide its spacing.
Preserve run boundaries; clear unused fragments, including superscript text.
Regenerate identifiers that must be unique in cloned blocks.
Let text reflow and items grow within the recorded layout rules. Render the
result to check the layout, content organization and expression. Continue at
Publish the source package.
Locate editable text when needed
After choosing the scope, locate text across the document, headers and footers:
python3 scripts/inspect_docx.py <source.docx> --slots
python3 scripts/inspect_docx.py <source.docx> --slots --json
It does not classify the document or identify which text may change. It lists
runs containing <w:t>, so check the rendered pages and XML for gaps without
text, such as underlined tabs. Do not treat a field's cached result as editable
text; Word recomputes it.
Address edits by the part and node path, checking the old text before replacing it. Use the paragraph text to group split runs; retain their individual formatting and whitespace. Inspect linked placeholders and empty separator paragraphs.
For a filled content control, remove w:showingPlcHdr so its value is treated
as content. Preserve its placeholder definition for future empty values.
If it has w:dataBinding, update the referenced custom XML value as well;
do not leave the displayed value and its binding inconsistent.
Publish the source package
Before publishing, follow the package's own recipe on a disposable copy with sample content. Verify repeated values in the body, header and footer; exercise an added and removed item only where the selected scope permits it. Render all pages and compare the formatting, artwork, spacing and content with the original. Fix the recipe and repeat this check if it changes.
node ../scripts/cover-page.mjs --input <the original .docx> --out cover.png
npx --yes --package="${CLI_PKG_URL}" okou user-template publish \
--title "<user-visible template name>" \
--kind document \
--source <the original .docx> \
--cover cover.png \
--page-count <pageCount from cover-page.mjs> \
--package package
--source and the copy in package/ are both needed: the first is what a
reader opens, the second is the only one a later r
Установить docx-extract-template в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл docx-extract-template?
Extract a template skill from a Word document for filling slots, reusing structure and expression, or applying its visual style. Use when asked to extract a Word template, build a reference.docx, apply a company template to Markdown, or set up --reference-doc.
Как установить скилл docx-extract-template?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл docx-extract-template запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
docx
Use 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…
от Anthropicxlsx
Use 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…
от Anthropicpptx
Use 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…
от Anthropic