What it does
It teaches your agent how to work with PDF files, such as reading their text, combining or splitting them, and making new ones. It is for anyone who needs to handle PDFs without doing it by hand.
When to use it
- ✓When you upload a PDF and want the text or tables pulled out.
- ✓When you want to merge, split, rotate, or add a watermark to PDF pages.
- ✓When you need a new PDF created or a PDF form filled in.
Skill link
https://github.com/HKUDS/DeepTutor/blob/main/deeptutor/skills/builtin/pdf/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Can you pull the tables out of this PDF and put them in a list for me?”
5 new skills a week. 1 minute to read.
How it works
The agent uses ready-made Python tools that can read and change PDF files. It runs the work in a sandbox and then returns the finished file.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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 / metadata →
pypdf. - Fill forms →
pypdf(fillable AcroForm fields) or annotation overlay (flat forms). - Create from scratch →
reportlab.
Use exec with complete Python source (language: python). Prefer creating,
reopening, and validating the PDF in one call; later calls can revise the same
relative filename. Follow the turn's User workspace instructions for
locating inputs, output boundaries, and presenting the finished file.
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 → Excel (one worksheet per table):
import pdfplumber
from openpyxl import Workbook
workbook = Workbook()
workbook.remove(workbook.active)
table_number = 0
with pdfplumber.open("in.pdf") as pdf:
for page_number, page in enumerate(pdf.pages, 1):
for table in page.extract_tables():
if not table:
continue
table_number += 1
sheet = workbook.create_sheet(f"p{page_number}_table{table_number}"[:31])
for row in table:
sheet.append([cell or "" for cell in row])
if table_number:
workbook.save("tables.xlsx")
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)
For very large PDFs where you only need raw text, pypdf's page.extract_text() is lighter.
Scanned / image-only PDFs (be honest)
If extract_text() returns empty or garbage (e.g. (cid:NN) runs) the page is scanned. No OCR engine (tesseract) is installed and network is off, so you cannot recover that text. Say so plainly and stop — do not fabricate content or attempt pip install.
Merge / split / rotate / crop / metadata (pypdf)
from pypdf import PdfReader, PdfWriter
# Merge
w = PdfWriter()
for f in ["a.pdf", "b.pdf"]:
for p in PdfReader(f).pages:
w.add_page(p)
w.write("merged.pdf")
# Split: one file per page
r = PdfReader("in.pdf")
for i, p in enumerate(r.pages, 1):
w = PdfWriter()
w.add_page(p)
w.write(f"page_{i}.pdf")
# Rotate page 0 by 90 degrees clockwise
r = PdfReader("in.pdf")
w = PdfWriter()
r.pages[0].rotate(90)
w.add_page(r.pages[0])
w.write("rotated.pdf")
- Metadata:
PdfReader("in.pdf").metadata(.title,.author, ...). - Crop: set
page.mediabox.left/bottom/right/top(points, origin y=0 at bottom). - Encrypt:
w = PdfWriter(clone_from=PdfReader("in.pdf")); w.encrypt("userpw", "ownerpw"); w.write("enc.pdf"). - Decrypt:
r = PdfReader("enc.pdf"); r.decrypt("pw")ifr.is_encrypted, then read/copy pages.
Watermark (stamp one page over every page):
from pypdf import PdfReader, PdfWriter
wm = PdfReader("stamp.pdf").pages[0]
r = PdfReader("in.pdf")
w = PdfWriter()
for p in r.pages:
p.merge_page(wm)
w.add_page(p)
w.write("stamped.pdf")
Create PDFs (reportlab)
Flowing document (preferred for text/reports/tables — handles pagination):
from reportlab.lib.pagesizes import letter
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.lib import colors
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle
styles = getSampleStyleSheet()
story = [
Paragraph("Report Title", styles["Title"]),
Spacer(1, 12),
Paragraph("Body text. " * 20, styles["Normal"]),
]
data = [["Product", "Q1", "Q2"], ["Widgets", "120", "135"]]
tbl = Table(data)
tbl.setStyle(
TableStyle(
[
("BACKGROUND", (0, 0), (
FAQ
Can it read a scanned PDF?
The skill does not mention OCR for scanned PDFs, so scanned pages may not come out as text.
Can it fill in a PDF form?
Yes. It can fill form fields in a PDF, and it can use an overlay for flat forms without fields.
Can it password-protect a PDF?
Yes. The skill covers encrypting and decrypting PDFs, along with watermarks and metadata.
Details
Original description by the author
Read, extract (text/tables), create, merge/split/rotate, watermark, encrypt, fill, and render-to-image .pdf files. Use whenever the user uploads a .pdf or asks to produce, edit, or pull data out of one.
repo: HKUDS/DeepTutor
Popularity
- GitHub stars
- 54k
- Ranking position
- #3369
- License
- Apache-2.0
- Updated
- 10/31/2026
Comments
- …
More skills from this repository
deeptutor-cli
54kHelps your agent set up and run DeepTutor, a learning platform, through its command line, including knowledge bases, notebooks, and the web app.
docx
54kHelps your agent read, create, and edit Word .docx files, including reports, tables, find-and-replace, and tracked changes with comments.
pptx
54kLets your agent create, read, and edit PowerPoint decks, including slide text, speaker notes, charts, and images.
skill-creator
54kTeaches your agent to write or improve DeepTutor skills, the short instruction packages that teach an AI a specific task.
Similar skills
feishu-doc
394kHelps your agent read, create, and edit Feishu cloud documents, including text, images, and tables, using the document tool.
feishu-drive
394kLets your agent browse, organize, and comment on files in a Feishu cloud folder that has been shared with the bot.
feishu-perm
394kHelps your agent check and change who can access a Feishu file, choosing the smallest permission that meets your request.