pdf

A set of instructions for working with PDF files, which are documents designed to keep the same layout across devices and when printed.

In plain words
What is it for?
It helps read text and tables, create PDFs, merge or split pages, rotate, crop, watermark, encrypt, fill forms, and turn pages into images.
Why use it?
It provides a clear way to extract content or change PDF files without choosing tools and procedures from scratch.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/hkuds/deeptutor/pdf
Any agent
npx skills add HKUDS/DeepTutor --skill pdf
Clone the repo
git clone --depth 1 https://github.com/HKUDS/DeepTutor

Made for: Claude Code, Codex.

Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,847 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00054 $0.02847
Opus 5 $0.00027 $0.01424
Sonnet 5 $0.00011 $0.00569
Haiku 4.5 $0.00005 $0.00285

Measured today against content hash 1452ca537104, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

pdf scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

deeptutor/skills/builtin/pdf/SKILL.md · 271 lines

How it starts

The opening of the file, as written. The whole thing — 271 lines — stays where its author put it; the contents beside it link to each section on GitHub.

PDF

Work PDFs in the sandbox with preinstalled Python libs. Pick the library by task:

  • Extract text/tables/layout/word-coordinates → pdfplumber; quick raw text or page ops → pypdf.
  • Merge / split / rotate / crop / watermark / encrypt / metadatapypdf.
  • Fill formspypdf (fillable AcroForm fields) or annotation overlay (flat forms).
  • Create from scratchreportlab.

Write complete Python source and run it via code_execution. Save outputs to the workspace dir. After execution, refer to the PDF exactly as the Generated artifacts list names it. Use exec only for a genuinely shell-only command; never put this source in python -c or a heredoc. Preserve an explicitly requested quantity (such as 500 words) and verify the count in the output before finishing. If execution fails or the artifact is missing, diagnose stderr/root cause and change strategy; do not retry identical code or reduce the requested scope without asking.

Extract text and tables (pdfplumber)

import pdfplumber

with pdfplumber.open("in.pdf") as pdf:
    for i, page in enumerate(pdf.pages, 1):
        print(f"--- page {i} ---")
        print(page.extract_text() or "")  # layout-aware text
        for t in page.extract_tables():  # list of tables; each is list[row]
            for row in t:
                print(row)

Tables → DataFrame/Excel:

import pdfplumber, pandas as pd

frames = []
with pdfplumber.open("in.pdf") as pdf:
    for page in pdf.pages:
        for t in page.extract_tables():
            if t and len(t) > 1:
                frames.append(pd.DataFrame(t[1:], columns=t[0]))
if frames:
    pd.concat(frames, ignore_index=True).to_excel("tables.xlsx", index=False)

Messy tables: pass strategies, or crop a region with page.within_bbox((x0, top, x1, bottom)) first:

ts = {
    "vertical_strategy": "lines",
    "horizontal_strategy": "lines",
    "snap_tolerance": 3,
    "intersection_tolerance": 15,
}
page.extract_tables(ts)

Read the full file on GitHub · 271 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today Changed · +1 lines 1452ca537104
  2. 3d ago First seen · 270 lines · 54 tokens per session scan A 93875b10b751

Subscribe to this mod's changes

pdf is a skill published in the GitHub repository HKUDS/DeepTutor (38,271 stars, last pushed today), licensed Apache-2.0. It adds 54 tokens to every session and 2,847 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.