document-skills-pdf
Create, extract, transform, or analyze PDF documents. Use this Skill whenever a .pdf file is the input or output - generating reports, one-pagers, posters or…
от MiniMax-AI★ 30 звёзд на GitHub
Установить document-skills-pdf в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
PDF workbench
PDF tasks fail when the agent mixes incompatible libraries or generates pages as screenshots. Route by job, use one tool per job, verify the artifact.
Step 0 - Check the toolchain
python -c "import reportlab, pypdf, fitz; print('reportlab', reportlab.Version, '| pypdf ok | pymupdf ok')"
reportlab- creation (preferred: selectable text, controlled layout).pypdf- page-level transforms: split, merge, rotate, encrypt, form fields.pymupdf(fitz) - extraction (text with coordinates, tables, images), rasterization, page-level inspection.
Missing any -> say so and degrade to the ones present; do not substitute screenshot pipelines.
Step 1 - Pick exactly one tool for the job
| Task | Tool | Reference |
|---|---|---|
| Build a new structured PDF (report, one-pager, letter, checklist) | ReportLab | references/create.md |
| Extract text / tables / images | PyMuPDF | references/extract.md |
| Merge, split, rotate, watermark, encrypt, forms | pypdf | references/transform.md |
| Inspect: page count, sizes, fonts, links, blank-page detection | PyMuPDF | references/inspect.md |
Chaining tools on one artifact is fine (create -> inspect). Using two creation libraries on one file is not.
Step 2 - Shared rules
- Text-first: a generated PDF must contain extractable text. Image-of-text is acceptable only when the user asked for a rasterized look or provides only images.
- Page geometry is explicit: A4 = 595.27 x 841.89 pt, US Letter = 612 x 792 pt. Declare the target size and margins up front; re-check fit after generation.
- Fonts: the standard 14 fonts cover only limited encodings; they do not automatically support arbitrary Unicode. Check that the selected face contains every requested character. If any glyph is unsupported - including CJK, Cyrillic, Arabic, Devanagari, or emoji - embed one or more licensed TTF/OTF fonts with the required coverage and use them for those runs. If no suitable embeddable font is available, report the limitation instead of emitting tofu.
- Overflow is a defect: content that spills past the last page or the margin must be detected in postcheck and fixed (shrink, paginate, or cut), never shipped.
- Write output to a new path; keep inputs untouched unless in-place was requested.
- Accessibility claims require tagged output. ReportLab does not produce a tagged PDF/UA document, so do not describe ordinary ReportLab output as accessible or screen-reader-ready. When PDF/UA or assistive-technology compatibility is required, use a toolchain that can create and validate tags, reading order, structure roles, language, and alternative text. If that toolchain is unavailable, stop and report the limitation; offer an accessible DOCX or HTML deliverable instead of silently returning an untagged PDF.
Step 3 - Postcheck (mandatory)
import os
import fitz
import pypdf
output_path = "output.pdf"
expected_page_count = 1 # set this from the task; do not derive it from the output
password = os.environ.get("PDF_PASSWORD")
r = pypdf.PdfReader(output_path)
if r.is_encrypted:
# Permission-encrypted PDFs commonly have an empty user password and open normally.
if r.decrypt("") == 0:
if not password:
raise RuntimeError("set PDF_PASSWORD so the encrypted output can be postchecked")
if r.decrypt(password) == 0:
raise RuntimeError("PDF_PASSWORD could not decrypt the output")
def require(condition, message):
# Mandatory verification must remain active under python -O.
if not condition:
raise ValueError(message)
page_count = len(r.pages)
require(
page_count == expected_page_count,
f"expected {expected_page_count} pages, got {page_count}",
)
render_doc = fitz.open(output_path)
if render_doc.needs_pass and render_doc.authenticate("") <= 0:
if not password:
raise RuntimeError("set PDF_PASSWORD so encrypted widgets can be rendered")
if render_doc.authenticate(password) <= 0:
raise RuntimeError("PDF_PASSWORD could not decrypt the output for widget rendering")
page_texts = {
number: (page.extract_text() or "").strip()
for number, page in enumerate(r.pages, start=1)
}
def normalized_box(box):
x0, y0, x1, y1 = (float(value) for value in box)
left, right = sorted((x0, x1))
bottom, top = sorted((y0, y1))
return left, bottom, right, top
def normalized_size(box):
left, bottom, right, top = normalized_box(box)
return right - left, top - bottom
def widget_count(page, rendered_page):
# Interactive-only pages can be valid, but hidden metadata widgets are not visible content.
non_viewable_flags = 1 | 2 | 32 # Invisible, Hidden, NoView annotation flags
count = 0
for ref in page.get("/Annots") or []:
widget = ref.get_object()
if widget.get("/Subty
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/create.md
- references/extract.md
- references/inspect.md
- references/transform.md
FAQ
Что делает скилл document-skills-pdf?
Create, extract, transform, or analyze PDF documents. Use this Skill whenever a .pdf file is the input or output - generating reports, one-pagers, posters or structured documents as real selectable-text PDFs; extracting text, tables or images from existing PDFs; merging, splitting, rotating, or watermarking pages; filling forms; checking that a produced PDF has the right page count and extractable text.
Как установить скилл document-skills-pdf?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл document-skills-pdf запускает скрипты?
Нет, скилл состоит только из инструкций (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…