できること
このスキルは、PDFファイルを扱う方法をエージェントに教えます。テキストの読み取り、ファイルの結合や分割、新しいPDFの作成など、手作業をせずにPDFを扱いたい人向けです。
使う場面
- ✓PDFをアップロードして、テキストや表を取り出したいとき。
- ✓PDFのページを結合、分割、回転したり、透かしを加えたりしたいとき。
- ✓新しいPDFを作成したり、PDFのフォームに入力したりする必要があるとき。
スキルのリンク
https://github.com/HKUDS/DeepTutor/blob/main/deeptutor/skills/builtin/pdf/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“このPDFから表を取り出して、一覧にして見せてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、PDFファイルを読み取り、変更できる既成のPythonツールを使います。作業はサンドボックスで行われ、完成したファイルを返します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)を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), (
よくある質問
スキャンされたPDFを読めますか?
スキルはスキャンされたPDFのOCRには触れていないため、スキャンのページはテキストとして取り出せない場合があります。
PDFのフォームに入力できますか?
はい。PDFのフォーム欄に入力できます。フィールドのない平らなフォームには、オーバーレイを使えます。
パスワードをかけられますか?
はい。PDFの暗号化と復号、透かし、メタデータに対応しています。
詳細
作者による元の説明
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
人気
- GitHubのスター
- 54k
- ランキング
- #3369
- ライセンス
- Apache-2.0
- 更新日
- 2026/10/31
コメント
- …
このリポジトリの他のスキル
deeptutor-cli
54kエージェントが、学習プラットフォームDeepTutorのセットアップと実行を、コマンドラインから行えるよう支援します。知識ベース、ノートブック、Webアプリを含みます。
docx
54kエージェントが、Wordの.docxファイルを読んだり作成したり編集したりできるよう支援します。レポート、表、検索と置換、変更履歴とコメントを含みます。
pptx
54kエージェントが、PowerPointのスライドのテキスト、スピーカーノート、グラフ、画像を含むプレゼンテーションを作成、読み取り、編集できるよう支援します。
skill-creator
54kエージェントが、DeepTutorのスキル、すなわち特定のタスクをAIに教える短い指示のパッケージを作成、改善できるよう支援します。
似ているスキル
feishu-doc
394kテキスト、画像、表を含むFeishuのクラウドドキュメントを、ドキュメントツールを使って読み、作成し、編集するようエージェントを支援します。
feishu-drive
394kボットと共有されたFeishuのクラウドフォルダ内のファイルを閲覧、整理、コメントできるようエージェントを支援します。
feishu-perm
394kFeishuのファイルにアクセスできる人を確認し、変更するようエージェントを支援します。依頼を満たす最小の権限を選びます。