Extract PDF content, rearrange pages, and create documents using operation-specific tools.
npx skills add anthropics/skills --skill pdf What it does
A PDF may contain selectable text, scanned images, forms, or a mixture of them. The PDF skill helps an agent choose a suitable extraction or editing approach before processing the file.
What changes after install
- Separates text extraction, table extraction, and page manipulation.
- Provides examples using pypdf, pdfplumber, ReportLab, and command-line tools.
- Directs form and advanced PDF tasks to supporting reference files.
Install
Run this command with Node.js 22.20 or later and select your agent in the Skills CLI.
npx skills add anthropics/skills --skill pdf Before using PDF
- For Python workflows, make the chosen library available: pypdf for page operations, pdfplumber for extraction, or ReportLab for PDF generation.
- Scanned-page OCR uses pdf2image and pytesseract plus their image-conversion and OCR tools; command-line alternatives such as qpdf and pdftotext require the corresponding executables.
Read the reviewed setup instructions for the selected workflow.
When to use it
- Extracting text or tables from a PDF into a usable deliverable.
- Combining, splitting, rotating, or generating PDF pages.
When not to use it
- Guaranteeing that OCR or a reconstructed table matches the original without review.
- Revising contract language with tracked changes in an editable Word document.
- Maintaining spreadsheet formulas and charts after the PDF tables have been extracted.
A worked example
Give the agent a two-page supplier invoice and this request: “Use the PDF skill to turn invoice.pdf into invoice-lines.xlsx. Keep one row per item, with the description, quantity, unit price, line total, and source page. Flag amounts you cannot read.”
Ask it to inspect both pages first. If the column headings and a sample item are selectable, open the PDF with pdfplumber and call extract_tables() on each page. Match the cells to the printed headings. On page two, check whether the first row repeats the headings or continues an item before dropping anything.
Use pandas to combine the item rows and write the workbook. Keep the printed subtotal out of the item rows so it can serve as an independent check. Open the workbook beside the invoice and compare the line total column row by row, especially the first amount after the page break.
Suppose the last line on page one ends with “replacement pump” and page two begins with “assembly” above the next item number. Check the printed item number, quantity and amount to decide whether the description continues. If it does, join the two fragments in the original item’s description and record both source pages. If the association is unclear, flag those cells for review before including that row in the subtotal.
Troubleshooting
- A dependency is missing. If Python reports
ModuleNotFoundErrorfor pdfplumber, install pdfplumber in the environment running the extraction. Retry the import there before processing the invoice again. - The agent cannot find the skill. In Claude Code, check whether the document-skills bundle from anthropics/skills is installed and enabled. Ask the agent to use the PDF skill by name and give it the file path.
- A scan produces empty text. Open the affected page and try selecting a printed word. If the page contains only an image, render it with pdf2image and pass the image to pytesseract.
How it chooses an approach
For selectable paragraphs, use pdftotext to produce a text file. For a price list, each amount belongs to a particular item. Use pdfplumber to extract the rows and columns together.
For image-only pages, convert each page to an image before OCR. In a mixed document, keep the embedded text on pages where it reads correctly.
When to use another skill
- For an editable contract with tracked revisions, use DOCX.
- To calculate tax or discounts from extracted invoice rows, use XLSX.
- To chart monthly spending across several invoices, give the combined table to XLSX.
What to check after it runs
- Count the item rows on each source page and compare them with the workbook. Look for a duplicated header or a description split across two rows.
- Add the line totals and compare the result with the printed subtotal before tax. Recheck decimal points, minus signs, and flagged cells against the page image.
- Pick two adjacent rows with different amounts and trace each amount back to its printed item number. Swapping their amounts would leave the subtotal unchanged. This extra check catches a column alignment error that a perfectly balanced invoice would otherwise conceal.
Related workflows
FAQ
- Can I process a long scanned PDF a few pages at a time?
- Yes. Split the PDF into smaller page ranges with qpdf, then render and OCR one range at a time. Keep the original page numbers with the recognized text so you can check each passage against the scan.
- Does installing the skill install every PDF dependency?
- No. The instruction files describe several possible libraries and command-line tools. Install the dependencies for your chosen operation and environment.
- Why did Claude Code use Python without loading the PDF skill?
- Claude Code can run PDF libraries independently. Check that the document-skills bundle from the anthropics/skills marketplace is enabled, then ask for the PDF skill explicitly and name the input file.
- Why does filling a three-state checkbox fail with a missing checked_value?
- The form guide expects a checked and an unchecked value. Inspect the extracted field information. If those values are missing for a three-state checkbox, flag the field for manual review instead of guessing which value to write.