| name | pdf |
| description | Read, extract, and analyze PDF documents. Triggers: pdf, read pdf, extract from pdf, analyze pdf, .pdf file path. |
| effort | medium |
| context | inline |
/pdf — PDF Processing
Extract and analyze PDF documents. Always respond in the user's language.
Algorithm
1. Determine Input
$ARGUMENTS = path to PDF → go to step 2
$ARGUMENTS = empty or "find" → search for PDFs first:
Glob "**/*.pdf"
List found PDFs with file sizes. Ask which to process.
2. Read PDF
Read file.pdf # small PDFs (<10 pages)
Read file.pdf pages="1-5" # large PDFs, chunk by 5-20 pages
Important: Maximum 20 pages per Read request.
3. Analyze Structure
Report immediately:
- Total page count
- Document structure (sections, headings)
- Content type (technical doc, requirements, API spec, report, legal)
4. Process Content
Based on content type, extract:
| Content Type | Extract |
|---|
| Technical doc | Key concepts, architecture decisions, API endpoints |
| Requirements | User stories, acceptance criteria, constraints |
| API spec | Endpoints, request/response schemas, auth |
| Report | Findings, metrics, recommendations |
| Legal/Contract | Key terms, dates, obligations |
5. Present and Suggest Next Steps
Based on content type, suggest:
- Technical doc → "Create reference file? Save to project memory?"
- Requirements → "Create tasks with
/plan?"
- API spec → "Generate types/interfaces?"
- Report → "Summarize findings? Extract data tables?"
- Tabular data → "Export with
/excel?"
Operations
| Command | Action |
|---|
/pdf file.pdf | Read and summarize |
/pdf file.pdf 1-5 | Read specific pages |
/pdf analyze file.pdf | Deep analysis with extraction |
Rules
- Always report page count and document structure first
- For large PDFs (>10 pages), ask before reading all pages
- Preserve table structures when extracting data
- Offer to convert to markdown for easier reference
- Suggest next:
/plan for requirements, /excel for tabular data, /docs for technical content
Gotchas
- Max 20 pages per Read request — always chunk large PDFs. Reading 100 pages at once will fail.
- Scanned PDFs (images, not text) return empty content. The Read tool handles OCR for images but quality varies.
- Tables in PDFs often lose structure — offer to reconstruct as markdown or export via
/excel.