$npx -y skills add openai/skills --skill pdfUse when tasks involve reading, creating, or reviewing PDF files where rendering and layout matter; prefer visual checks by rendering pages (Poppler) and use Python tools such as reportlab, pdfplumber, and pypdf for generation and extraction.
| 1 | # PDF Skill |
| 2 | |
| 3 | ## When to use |
| 4 | - Read or review PDF content where layout and visuals matter. |
| 5 | - Create PDFs programmatically with reliable formatting. |
| 6 | - Validate final rendering before delivery. |
| 7 | |
| 8 | ## Workflow |
| 9 | 1. Prefer visual review: render PDF pages to PNGs and inspect them. |
| 10 | - Use `pdftoppm` if available. |
| 11 | - If unavailable, install Poppler or ask the user to review the output locally. |
| 12 | 2. Use `reportlab` to generate PDFs when creating new documents. |
| 13 | 3. Use `pdfplumber` (or `pypdf`) for text extraction and quick checks; do not rely on it for layout fidelity. |
| 14 | 4. After each meaningful update, re-render pages and verify alignment, spacing, and legibility. |
| 15 | |
| 16 | ## Temp and output conventions |
| 17 | - Use `tmp/pdfs/` for intermediate files; delete when done. |
| 18 | - Write final artifacts under `output/pdf/` when working in this repo. |
| 19 | - Keep filenames stable and descriptive. |
| 20 | |
| 21 | ## Dependencies (install if missing) |
| 22 | Prefer `uv` for dependency management. |
| 23 | |
| 24 | Python packages: |
| 25 | ``` |
| 26 | uv pip install reportlab pdfplumber pypdf |
| 27 | ``` |
| 28 | If `uv` is unavailable: |
| 29 | ``` |
| 30 | python3 -m pip install reportlab pdfplumber pypdf |
| 31 | ``` |
| 32 | System tools (for rendering): |
| 33 | ``` |
| 34 | # macOS (Homebrew) |
| 35 | brew install poppler |
| 36 | |
| 37 | # Ubuntu/Debian |
| 38 | sudo apt-get install -y poppler-utils |
| 39 | ``` |
| 40 | |
| 41 | If installation isn't possible in this environment, tell the user which dependency is missing and how to install it locally. |
| 42 | |
| 43 | ## Environment |
| 44 | No required environment variables. |
| 45 | |
| 46 | ## Rendering command |
| 47 | ``` |
| 48 | pdftoppm -png $INPUT_PDF $OUTPUT_PREFIX |
| 49 | ``` |
| 50 | |
| 51 | ## Quality expectations |
| 52 | - Maintain polished visual design: consistent typography, spacing, margins, and section hierarchy. |
| 53 | - Avoid rendering issues: clipped text, overlapping elements, broken tables, black squares, or unreadable glyphs. |
| 54 | - Charts, tables, and images must be sharp, aligned, and clearly labeled. |
| 55 | - Use ASCII hyphens only. Avoid U+2011 (non-breaking hyphen) and other Unicode dashes. |
| 56 | - Citations and references must be human-readable; never leave tool tokens or placeholder strings. |
| 57 | |
| 58 | ## Final checks |
| 59 | - Do not deliver until the latest PNG inspection shows zero visual or formatting defects. |
| 60 | - Confirm headers/footers, page numbering, and section transitions look polished. |
| 61 | - Keep intermediate files organized or remove them after final approval. |