pdf-extract-template
БесплатноЗапускает вложенные скриптыНе проверенExtract a template skill from a PDF 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 PDF
Input: one .pdf. Output: a loadable skill package whose instructions and
resources match the selected reuse scope.
If the original .docx exists, use ../docx/SKILL.md instead. For slide PDFs,
use ../presentation/SKILL.md unless the user requested a document template.
Run every command below from extract-template/pdf/.
Create page images to inspect the document's layout, typography and fillable areas, then choose the reuse scope. Keep the original for text and geometry. Reuse existing source captures; otherwise render once at the original page proportions:
node ../scripts/render-document.mjs --input <source.pdf> --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.pdf. Write package/SKILL.md with the
slot map and filling instructions from the shared guide. For each slot,
record its page, meaning and filling format. Use an existing PDF form field's
name where available; otherwise record the blank's rectangle and text
appearance from the page.
Instruct the skill to fill a copy of template.pdf through its form fields or
place text within the recorded blank areas. Keep the original page content
and artwork intact; do not reconstruct the page or replace its fixed prose.
Render the filled copy to verify the values fit and everything outside the
slots remains unchanged. Continue at Publish the source package.
Structure and expression reuse
Copy the source to package/example.pdf. Write package/SKILL.md with the
structure and writing rules from the shared guide, including source examples
of the phrasing, tone and information order to reuse.
Record the layout of the blocks a new document needs, with their typography, spacing and repeat-or-omit rules. Extract reusable artwork into the package when needed. A PDF is a visual and writing example, not an editable paragraph tree: tell the skill how to compose new content into that layout using the example and packaged assets, allowing the recorded parts to grow or repeat. Identify any wording that stays fixed. Render the result and compare both its layout and expression with the example. Continue at Publish the source package.
Publish the source package
node ../scripts/cover-page.mjs --input <the original .pdf> --out cover.png
npx --yes --package="${CLI_PKG_URL}" okou user-template publish \
--title "<user-visible template name>" \
--kind document \
--source <the original .pdf> \
--cover cover.png \
--page-count <pageCount from cover-page.mjs> \
--package package
Keep the source copy in package/; --source supplies the catalog document
and does not replace the files a later run needs. Publish without --cover
and --page-count only when cover-page.mjs failed; report what it said.
Say the template exists only after the command succeeds, then stop.
Style extraction
Prerequisites
pip install pymupdf
python3 scripts/ensure_pandoc.py --dir ./vendor # then run the export PATH line it prints
1. Analyse
python3 scripts/analyze_pdf.py <source.pdf> --json styles.json
Read the report:
[structure tree]present → take the heading levels in step 3 from it.- "No text layer" → OCR the PDF first, then restart.
[body candidates]→ the chosen group must be running prose. If its sample is a table header, an index or a caption, re-run with--body <rank>.
2. Declare the column count
Inspect the source page images. Re-run step 1 with --columns N.
3. Map the heading levels
Under [inferred styles], decide each group's role from its sample text and
write the map:
--map 1=Heading1,2=Title,3=Heading2
Right side: Title, Subtitle, Heading1..Heading9 or skip. The
largest group is usually the document title, not Heading1.
4. Settle the margins
Use the suggested row. Where measured disagrees with it by more than
rounding, measure the page yourself and pass --top, --right or --left
in cm. The bottom margin is never measured. Pass --bottom as:
- the
measuredbound, when some page is full to the bottom; - for a Typst source with a footer,
(page height − footer baseline − 0.73 × footer size) / 0.7, in cm; - otherwise the mirror of the top, which
suggestedalready holds.
On a two-column document the two columns must come out the same width.
5. Build
python3 scripts/build_reference.py styles.json reference.docx \
--map 1=Heading1,2=Title,3=Heading2 [--bottom 2.2 ...]
--map keys are the # column of [inferred styles]. Map every g
Установить pdf-extract-template в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл pdf-extract-template?
Extract a template skill from a PDF document for filling slots, reusing structure and expression, or applying its visual style. Use when asked to extract a PDF template or its styles, turn a PDF into a Word template, or analyse a PDF's layout.
Как установить скилл pdf-extract-template?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pdf-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