SKILL.md
Document PDF Skill — Quick Reference
Boundary: when the official Anthropic pdf skill is available, prefer it for plain create, merge/split, form fill, and CLI (qpdf/pdftotext) work. Use this skill for its unique lanes: accessibility (PDF/UA-1/UA-2, EAA), real redaction and its evidence gate, metadata scrubbing, pyHanko signing, OCR/table extraction discipline, and PyMuPDF/pdf-lib licensing and maintenance risk.
- EU compliance: scope the product/service and national implementation before applying the EAA to a PDF. Verify that any cited harmonised standard supports the specific applicable legislation in the Official Journal; an EN 301 549 citation under another directive is insufficient. Load references/pdf-accessibility-compliance.md for that scoping step.
- Metadata exists in multiple layers: PDF Info/XMP, filesystem dates, and OS extended attributes. Scrubbing one layer leaves the others available.
Core Decision Rules
- First decide: born-digital PDF (selectable text) vs scanned PDF (images). Scanned PDFs usually require OCR; see
references/pdf-extraction-patterns.md. - If the user needs accessibility/compliance, prefer generating from a source format that supports structure (DOCX/HTML + proper export) rather than “post-fixing” an untagged PDF.
- For deterministic ops (merge/split/rotate/scrub), prefer
scripts/helpers over re-implementing ad hoc. - Never treat black rectangles or overlays as redaction. Real redaction removes the content bytes: PyMuPDF
page.add_redact_annot(rect)thenpage.apply_redactions()per page, then save. Prove it with the redaction evidence gate. - Password protection: pypdf
writer.encrypt(..., algorithm='AES-256')(security handler R6). Omittingalgorithmwrites RC4-128, so always pass it; useAES-256-R5only for a named legacy reader. Permission flags are advisory, not security. See references/pdf-security-redaction.md. - Table extraction is probabilistic, not deterministic: run
pdfplumberfirst and spot-check output against the source page; escalate toCamelotonly when columns/rows are visibly wrong, and always inspect Camelot's per-tableaccuracyscore rather than trusting output blindly. PyMuPDF/fitz(used byscrub_metadata.pyand most redaction/OCR-prep code below) is dual-licensed AGPL-3.0 / commercial. Flag this before shipping it inside a closed-source product or SaaS backend — AGPL's network-use clause can trigger a source-disclosure obligation; get a commercial license from Artifex or substitutepypdf/pdfplumberwhere the required functionality overlaps.pdf-lib(Node): check the upstream package's release activity before depending on it. If it is stale and you need ongoing fixes, evaluate a maintained fork before committing, and pin the dependency either way.