agentleFS
smith-network-solutionssmith-network-solutions/threadknot/skills/pdf/SKILL.md

pdf

Skill8 starsChanged 4 months agoApache-2.0View on GitHub

Read, create and manipulate PDF files — extract text and tables, merge, split, rotate, reorder and delete pages, read and fill AcroForm fields, add or strip metadata, encrypt and decrypt, and generate new PDFs from HTML or from scratch. Also covers rasterising pages to images so a PDF can actually be looked at, and OCR for scanned documents. Use whenever a .pdf must be produced, inspected or altered.

  • Installs packages

197 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use context7-efficient, file-reading and 9 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • hfzarslanSkill

    context7-efficient

    Token-efficient library documentation fetcher using Context7 MCP with 86.8% token savings through intelligent shell pipeline filtering. Fetches code examples, API references, and best practices for JavaScript, Python, Go, Rust, and other libraries. Use when users ask about library documentation, need code examples, want API usage patterns, are learning a new framework, need syntax reference, or troubleshooting with library-specific information. Triggers include questions like "Show me React hooks", "How do I use Prisma", "What's the Next.js routing syntax", or any request for library/framework documentation.

    Also in 5 projects that use this

  • SeifBenayedSkill

    file-reading

    Use this skill when a file has been uploaded but its content is NOT in your context — only its path at /mnt/user-data/uploads/ is listed in an uploaded_files block. This skill is a router: it tells you which tool to use for each file type (pdf, docx, xlsx, csv, json, images, archives, ebooks) so you read the right amount the right way instead of blindly running cat on a binary. Triggers: any mention of /mnt/user-data/uploads/, an uploaded_files section, a file_path tag, or a user asking about an uploaded file you have not yet read. Do NOT use this skill if the file content is already visible in your context inside a documents block — you already have it.

    Also in 6 projects that use this

  • SeifBenayedSkill

    pdf-reading

    Use this skill when you need to read, inspect, or extract content from PDF files — especially when file content is NOT in your context and you need to read it from disk. Covers content inventory, text extraction, page rasterization for visual inspection, embedded image/attachment/table/form-field extraction, and choosing the right reading strategy for different document types (text-heavy, scanned, slide-decks, forms, data-heavy). Do NOT use this skill for PDF creation, form filling, merging, splitting, watermarking, or encryption — use the pdf skill instead.

    Also in 6 projects that use this

  • yf8578Skill

    market-research-reports

    Generate comprehensive market research reports (50+ pages) in the style of top consulting firms (McKinsey, BCG, Gartner). Features professional LaTeX formatting, extensive visual generation with scientific-schematics and generate-image, deep integration with research-lookup for data gathering, and multi-framework strategic analysis including Porter Five Forces, PESTLE, SWOT, TAM/SAM/SOM, and BCG Matrix.

    Also in 7 projects that use this

  • OpenAISkill

    migrate-to-codex

    Migrate supported instruction files, skills, agents, and MCP config into Codex project and global files.

    Also in 4 projects that use this

  • jjyaoaoSkill

    gift-evaluator

    The PRIMARY tool for Spring Festival gift analysis and social interaction generation. Use this skill when users upload photos of gifts (alcohol, tea, supplements, etc.) to inquire about their value, authenticity, or how to respond socially. Integrates visual perception, market valuation, and HTML card generation.

    Also in 4 projects that use this

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 186 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Avoid PyMuPDF/fitz. It is widely recommended and technically excellent, but it is AGPL-3.0 or paid-commercial, which quietly infects …

    line 19
  2. Very specific:

    If info reports little or no extractable text, the pages are images:

    line 50
  3. Very specific:

    If uv is genuinely unavailable, fall back to a venv — but check for uv first.

    line 76
  4. Very specific:

    Only AcroForm fields can be filled this way.

    line 99

“Common” is measured: kept by at least 6 in 10 of the 186 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

PDF files

Which tool depends on the verb:

TaskTool
Rearrange pages, merge, split, rotate, encrypt, metadata, formspypdf (scripts/pdftool.py)
Extract text, and especially tablespdfplumber (scripts/extract.py)
Make a PDF from HTML/CSSWeasyPrint, or LibreOffice for an Office source
Make a PDF programmatically (precise placement)reportlab
Look at a pagerasterise — scripts/extract.py --png

Avoid PyMuPDF/fitz. It is widely recommended and technically excellent, but it is AGPL-3.0 or paid-commercial, which quietly infects whatever it touches. Everything above is MIT or BSD.

Inspect before you act

scripts/pdftool.py info report.pdf

Page count, per-page size and rotation, metadata, encryption status, whether it has form fields, and whether the pages carry extractable text or are scanned images. The last one decides your whole approach — no text extractor will get anything out of a scan, and the answer is OCR, not a different library.

Extracting text and tables

scripts/extract.py report.pdf                     # all text
scripts/extract.py report.pdf --pages 1-3         # a range
scripts/extract.py report.pdf --tables            # tables as CSV
scripts/extract.py report.pdf --layout            # preserve visual columns

--tables uses pdfplumber's ruling-line detection, which works well on tables that have visible borders and poorly on those laid out with whitespace alone. For the whitespace kind, --layout plus your own parsing is usually faster than fighting the table detector.

Text comes out in the PDF's internal content order, which is not always reading order — multi-column academic papers commonly interleave. --layout reconstructs position-aware text and is the fix.

Scanned documents

If info reports little or no extractable text, the pages are images:

scripts/extract.py scan.pdf --ocr --pages 1-5

Needs tesseract on PATH (apt install tesseract-ocr, brew install tesseract). It rasterises each page and OCRs it. Slow — always scope with --pages while iterating.

Writing your own script

The scripts here declare their dependencies inline (PEP 723) and run under uv, so they work with nothing installed. Do the same for scripts you write rather than pip-installing or building a venv — on a modern distro the system Python is PEP-668 managed and pip install fails outright:

#!/usr/bin/env -S uv run --quiet --script
# /// script
# requires-python = ">=3.10"
# dependencies = ["pypdf[crypto]>=5.0"]
# ///

Then chmod +x build.py && ./build.py, or just uv run --with 'pypdf[crypto]>=5.0' python build.py (quote the spec — > and [ are shell metacharacters). If uv is genuinely unavailable, fall back to a venv — but check for uv first.

Page operations

scripts/pdftool.py merge out.pdf a.pdf b.pdf c.pdf
scripts/pdftool.py split in.pdf outdir/            # one file per page
scripts/pdftool.py extract in.pdf out.pdf --pages 2-5,9
scripts/pdftool.py rotate in.pdf out.pdf --pages 1 --degrees 90
scripts/pdftool.py delete in.pdf out.pdf --pages 3
scripts/pdftool.py meta in.pdf out.pdf --title "Q1 Report" --author "Acme"
scripts/pdftool.py encrypt in.pdf out.pdf --password s3cret
scripts/pdftool.py decrypt in.pdf out.pdf --password s3cret

Page numbers in every command are 1-based and inclusive, matching what a person sees in a viewer. (pypdf's own API is 0-based — the script converts.)

Forms

scripts/pdftool.py fields form.pdf                          # list fields + current values
scripts/pdftool.py fill form.pdf out.pdf --set name=Ada --set agree=Yes

Only AcroForm fields can be filled this way; XFA forms (mostly government LiveCycle documents) cannot, and fields will say so rather than silently filling nothing.

Filled values may not display until a viewer regenerates appearances. fill sets NeedAppearances, which handles most viewers; verify with scripts/extract.py out.pdf --png and look.

Creating a PDF

From HTML — the most controllable route for anything document-shaped, since you get real CSS for layout, page breaks and headers:

from weasyprint import HTML, CSS
HTML(string=html).write_pdf("out.pdf", stylesheets=[CSS(string="@page { size: A4; margin: 2cm }")])

uv run --with weasyprint python … if it is not installed.

From an Office document — build the .docx/.xlsx/.pptx first, then convert with scripts/topdf.py. Usually the right answer when the user's content is a report, spreadsheet or deck.

Programmatically with reportlab, when you need exact placement:

from reportlab.lib.pagesizes import A4
from reportlab.pdfgen import canvas

c = canvas.Canvas("out.pdf", pagesize=A4)
width, height = A4
c.setFont("Helvetica-Bold", 18)
c.drawString(72, height - 72, "Quarterly Report")   # origin is BOTTOM-left
c.showPage()                                         # ends the page
c.save()

reportlab's origin is the bottom left and y grows upward — the opposite of every screen coordinate system, and the reason first attempts draw off the top of the page. Units are points (72/inch).

Verify what you produced

scripts/pdftool.py info out.pdf
scripts/extract.py out.pdf --png --pages 1-2

Look at the images. A PDF is the format people receive and cannot easily fix, so it is the one most worth actually viewing before handing over.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.