book-pdf-to-structured-json
Installation
SKILL.md
Book PDF to Structured JSON
Produce a traceable electronic edition whose hierarchy comes from the printed table of contents and whose remote copy can be proven identical to the reviewed local JSON.
Read the right reference
- Read references/pipeline.md before planning or executing a book conversion.
- Use scripts/compare_tree_export.py after a full remote export. It compares titles, bodies, levels, order, and parent relationships and emits reproducible SHA-256 fingerprints.
Core rules
- Treat the rendered printed TOC as the structural authority. Do not infer the final tree only from OCR body headings.
- Preserve source evidence: page boundaries, source-page mapping, heading-match score, and the original extracted text.
- Separate detection from correction. OCR models and rare-character audits propose candidates; only reviewed, context-safe rules may change text.
- Make the JSON tree the authoritative deliverable. Generate TXT, TSV, chapter files, and upload payloads from that same tree.
- Fail closed on uncertain headings, missing parents, duplicate keys, cycles, unexpected node counts, empty leaf content, or unexplained text loss.
- Never mutate a remote environment until the user has authorized upload and the exact environment, equipment/library ID, and book set are known.
- Export a full remote backup before replacement. Pass credentials through environment variables or standard input; never place tokens in commands, reports, or logs.
- After upload, export full remote bodies and compare normalized content and structure. Counts alone are not acceptance evidence.