Agent skill for PDF processing using the zpdf CLI toolkit — works with any
AI coding assistant that consumes a SKILL.md + reference files, including
Claude Code,
OpenAI Codex, and opencode.
A single intelligent skill that loads minimal context for reading tasks, full context for editing tasks.
Key feature: Automatically loads the right reference based on task type:
- Reading PDFs →
read-minimal.md(~400 tokens, 90% less overhead) - Editing PDFs → Additional references as needed (~2,000-8,000 tokens)
cargo install zpdf-cliOr build from the zpdf repository:
cd D:/project/zpdf
cargo build --release -p zpdf-cliWhen user asks to read, analyze, or summarize a PDF, the skill loads only read-minimal.md:
# Check PDF info
zpdf info document.pdf
# Extract text
zpdf text document.pdf -p 1
zpdf text document.pdf --all
# Render to image
zpdf render document.pdf -p 1 -o page1.png --dpi 150
# Search content
zpdf search document.pdf "keyword"Context overhead: ~400 tokens (just 4 commands)
When user needs to modify PDFs, the skill loads additional references:
# Fill form
zpdf fill form.pdf --set name="John" -o filled.pdf
# Merge PDFs
zpdf merge a.pdf b.pdf -o combined.pdf
# Annotate
zpdf annotate doc.pdf -p 1 --kind highlight --rect 100,200,300,220 -o marked.pdf
# Sign
zpdf sign doc.pdf --key key.p8.der --cert cert.der -o signed.pdf
# Optimize
zpdf optimize large.pdf -o small.pdf --max-image-dim 1024Context overhead: ~2,500 tokens (editing-commands.md)
For extracting structured data:
# Extract tables
zpdf tables financial.pdf -p 5 --csv
# Get form fields
zpdf forms application.pdf
# Extract attachments
zpdf attachments invoice.pdf --extract allContext overhead: ~1,500 tokens (analysis-commands.md)
The skill intelligently loads these based on task:
-
read-minimal.md (~50 lines, ~400 tokens)
- For reading tasks: info, text, render, search
- Loaded by default for 90% of PDF work
- Use this first
-
quick-reference.md (~163 lines, ~1,500 tokens)
- Fast lookup for common operations
- Load when user needs multiple command types
-
reading-commands.md (~154 lines, ~1,800 tokens)
- Detailed reading/conversion syntax
- Load for convert, export-pptx commands
-
analysis-commands.md (~201 lines, ~1,500 tokens)
- Tables, forms, signatures, attachments
- Load for structured data extraction
-
editing-commands.md (~305 lines, ~2,500 tokens)
- Fill, merge, split, annotate, sign, optimize
- Load for modification tasks
-
zpdf-commands.md (~845 lines, ~6,000 tokens)
- Complete reference with all commands
- Load for complex multi-operation tasks
Task: "Read this PDF" / "What's in this PDF?"
→ Load read-minimal.md only (~400 tokens)
Task: "Fill this form" / "Merge these PDFs"
→ Load editing-commands.md (~2,500 tokens)
Task: "Extract tables from PDF"
→ Load analysis-commands.md (~1,500 tokens)
Task: "Convert PDF to PowerPoint"
→ Load reading-commands.md (~1,800 tokens)
| Task Type | Reference Loaded | Token Cost | Savings vs Full |
|---|---|---|---|
| Reading PDF | read-minimal.md | ~400 | ~8,000 (95%) |
| Editing PDF | editing-commands.md | ~2,500 | ~6,000 (70%) |
| Extracting tables | analysis-commands.md | ~1,500 | ~7,000 (82%) |
| Converting format | reading-commands.md | ~1,800 | ~6,700 (79%) |
| Complex multi-op | All references | ~8,500 | 0% (needed) |
Reading (6): info, text, render, search, convert, export-pptx
Analysis (9): tables, forms, outline, links, struct, signatures, attachments, validate, compare
Editing (10): fill, merge, split, optimize, annotate, redact, sign, pages, set-meta, stamp, tag
Debug (2): dump, debug-stream
Total: 27 commands
- Pure Rust, zero C dependencies
- Native encryption support (AES-256, RC4)
- CJK font support (Chinese, Japanese, Korean)
- Multiple backends (CPU default, GPU/wgpu for 2-3× speed)
- Structured extraction (tables, forms, links, attachments)
- Format conversion (PDF → Text/Markdown/HTML/PowerPoint)
- Complete editing (fill, merge, annotate, sign, optimize)
- Start minimal: Load read-minimal.md for reading tasks
- Always run
zpdf infofirst: Check pages and encryption status - Search before extracting: On large documents, find relevant pages first
- Choose strategy wisely:
- Text-heavy documents →
zpdf text - Visual/layout-heavy →
zpdf render - Mixed content → Hybrid approach
- Text-heavy documents →
- Password via flag: Use
--password <pw>(interactive prompts fail) - DPI sweet spots: 150 (default), 300 (high detail)
zpdf-skill/
├── SKILL.md # Main skill definition
├── README.md # This file
└── references/
├── read-minimal.md # Minimal reading (4 commands) ← Start here
├── quick-reference.md # Fast lookup
├── reading-commands.md # Reading/conversion details
├── analysis-commands.md # Structured data extraction
├── editing-commands.md # Modification commands
└── zpdf-commands.md # Complete reference
- Skill version: 3.2.0 (intelligent reference loading; synced to zpdf 0.12.x —
tag,validate --profile pdfa-3b|pdfua-2,optimize --pdfa pdfa-3b, PAdESsignflags) - zpdf CLI version: 0.12.x+
MIT License (part of the zpdf project)
zpdf info report.pdf # 25 pages
zpdf search report.pdf "conclusion" # Found on page 23
zpdf text report.pdf -p 23 > conclusion.txtContext used: ~400 tokens (read-minimal.md)
zpdf forms application.pdf # List fields
zpdf fill application.pdf --set name="John Doe" --set email="john@example.com" -o filled.pdf
zpdf sign filled.pdf --key key.p8.der --cert cert.der -o final.pdfContext used: ~2,500 tokens (editing-commands.md)
zpdf info financial.pdf # 50 pages
zpdf search financial.pdf "Q3 revenue" # Found on pages 12, 25
zpdf tables financial.pdf -p 12 --csv > q3_data.csvContext used: ~1,500 tokens (analysis-commands.md)