agent-instructions
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when working with PDF files. Covers text and table extraction, merging and splitting, form filling, watermarking, OCR for scanned documents, and generating PDFs.
$ npx -y skills add nimadorostkar/Claude-Skills-collection --skill pdf --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/pdfContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when working with PDF files. Covers text and table extraction, merging and splitting, form filling, watermarking, OCR for scanned documents, and generating PDFs.
name: pdf description: Use when working with PDF files. Covers text and table extraction, merging and splitting, form filling, watermarking, OCR for scanned documents, and generating PDFs. metadata: category: documents version: 1.0.0 tags: [pdf, extraction, ocr, forms, generation]
Read, manipulate, and produce PDFs — including the scanned ones that contain no text at all and the ones whose tables are drawn rather than structured.
1. **Determine whether it has text at all** — Extract from the first page. If nothing comes out, it is a scan, and every text-based approach will silently return nothing. That is the single most important check. 2. **Choose the extractor by the task** — Simple text extraction for prose; a layout-aware extractor for anything where column position carries meaning; a dedicated table extractor for tables. 3. **OCR only when necessary** — It is slow and imperfect. If the PDF has a text layer, use it. 4. **Preserve what matters when editing** — Merging PDFs drops bookmarks, form fields, and annotations unless you carry them across deliberately. 5. **Verify the output** — Open it. A PDF that a library writes without error can still be structurally broken.
**The check that must come first:**
import pdfplumber
with pdfplumber.open("document.pdf") as pdf:
first_page_text = pdf.pages[0].extract_text() or ""
if len(first_page_text.strip()) < 50:
# This is a scan. Every text-based approach will return nothing, silently.
# It is not a corrupt file and it is not an empty document.
text = ocr_pdf("document.pdf")
else:
text = "\n".join((p.extract_text() or "") for p in pdf.pages)**Table extraction, which text extraction cannot do:**
with pdfplumber.open("invoice.pdf") as pdf:
for page in pdf.pages:
# A general text extractor turns this into interleaved gibberish, because
# the "table" is drawn lines and absolutely-positioned text.
for table in page.extract_tables():
header, *rows = table
df = pd.DataFrame(rows, columns=[h.strip() if h else "" for h in header])
yield df**OCR with preprocessing, which matters more than the OCR settings:**
import fitz # PyMuPDF
import pytesseract
from PIL import Image, ImageOps
def ocr_pdf(path: str, dpi: int = 300) -> str:
doc = fitz.open(path)
pages = []
for page in doc:
# 300 DPI is the practical minimum for reliable OCR. 150 halves the accuracy.
pix = page.get_pixmap(dpi=dpi)
img = Image.frombytes("RGB", (pix.width, pix.height), pix.samples)
# Preprocessing is worth more than any OCR engine parameter.
img = ImageOps.grayscale(img)
img = ImageOps.autocontrast(img)
pages.append(pytesseract.image_to_string(img, config="--psm 6"))
return "\n\n".join(pages)A curated library of 137 production-grade skills for Claude and other AI coding agents. Every skill follows one structure, speaks with one voice, and earns its place by changing what the agent does.
Repo: nimadorostkar/Claude-Skills-collection
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when an agent needs state that survives a session or a context compaction. Covers what to persist, file-based memory, structuring notes for retrieval, and…
Use when automating agent behavior with lifecycle hooks. Covers hook events, deterministic enforcement of rules the model should not be trusted to remember,…
Use when packaging skills, commands, hooks, and MCP servers into a distributable plugin. Covers manifest structure, bundling, versioning, testing, and…
Use when writing a new skill for an AI agent. Covers scoping, description writing for reliable triggering, progressive disclosure, and the difference between a…
Use when reviewing or improving an existing agent skill. Covers triggering accuracy, content quality, redundancy with the base model, and measuring whether the…