---
name: pdf-summarize
description: Extract the text from a PDF (local file or URL) and summarize it — abstract, key points, and notable figures or numbers. Use when a task references a PDF report, paper, contract, or manual.
metadata:
  homepage: https://github.com/bradflaugher/LFG
---

# pdf-summarize

Pull readable text out of a PDF, then summarize it. Text extraction runs through
`pypdf`, which is preinstalled in the sandbox.

## Workflow

1. **Get the PDF into the workspace** (skip if it's already there):

   ```bash
   python3 -c 'import requests, sys; open("/workspace/doc.pdf","wb").write(requests.get(sys.argv[1], timeout=60).content)' \
       "https://example.com/report.pdf"
   ```

2. **Extract text** with the helper, which prints page-tagged plain text:

   ```bash
   python3 /skills/*/pdf-summarize/scripts/extract.py /workspace/doc.pdf > /workspace/doc.txt
   ```

   Use `--pages 1-10` to limit very long documents, or `--max-chars N` to cap.

3. **Read and summarize.** Skim `/workspace/doc.txt`, then write
   `/workspace/summary.md`:
   - One-paragraph overview of what the document is and its purpose.
   - 3–6 bullet key points (decisions, findings, obligations…).
   - A short list of any important figures, dates, or names, with the page they
     appear on.

## Rules

- If extraction returns little or no text, the PDF is probably scanned images —
  say so; OCR is out of scope here.
- Attribute claims to page numbers when you can (`p.4`).
- Never invent content that isn't in the extracted text. If something is
  ambiguous in the source, flag it rather than guessing.
