I built a skill for Claude Code and Codex that rebuilds scanned pages and phone photos as new PDFs: real text, vector diagrams and charts, and the original layout. It doesn't put an OCR layer on top of the image; it redraws the page.
I wanted to know whether it actually helps, so I measured it. I generated synthetic pages with known ground truth (worksheets, tables, charts, flowcharts, forms and two-column articles), half of them phone photos taken at an angle with shadows. Each model got the same short request twice, with and without the skill. On two 9-page documents the skill had never been tuned on:
- Haiku 5.5: 0.841 → 0.997
- Fable 5.1: 0.837 → 0.997
- Sonnet 5.5: 0.994 → 0.998, and 37% faster
- Opus 5.5: 0.993 → 0.998
The score combines text F1, layout overlap, figure overlap and vector share; 1.0 is perfect. Timings come from just two documents per model, so treat them as indicative: Haiku's time barely changed, and Opus and Fable took longer with the skill. On shorter 3-page packets (an earlier version), Sonnet and Opus were already near the ceiling and the gain was within noise.
My first version was just detailed instructions, and it made Sonnet faster but no better. What helped was taking over the steps where agents go wrong:
- They see a downscaled page, so positions and small digits are guesses. A script now measures everything in scan pixels, and the agent reads doubtful words from one enlarged contact sheet per page.
- They don't notice what they missed. Every rebuild is overlaid on the scan, and the report lists what is still missing, page by page.
- They cut corners. One command drafts every page, and fixing a word is one line in a JSON file.
Some later bugs are worth knowing about, and they're all in the README. In v3 a photo-proportion bug cost Sonnet two pages, which v4 fixed. v6 fixed the handling of shadowed photo corners and a skew bug on dark photos. Each version was tested on pages it hadn't been tuned on.
Limits: the benchmark is synthetic printed English, and the OCR step runs Tesseract's English model, so other scripts aren't supported yet and handwriting is harder. It also takes minutes of agent time per page, so if you only need searchable text, OCRmyPDF is the better tool.
You can install it as a Claude Code plugin with /plugin marketplace add 3351666087/scan-to-vector-skill followed by /plugin install scan-to-vector@scan-to-vector-skill, or with a one-line installer that also covers Codex. It's MIT licensed, and the benchmark code is in the repo if you want to try other models.