PDF chapter splitting
/plugin marketplace add jongwony/cc-plugin/plugin install pdf-split@cc-pluginThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/pypdf-guide.mdscripts/extract_toc.pyscripts/split_by_chapters.pySplit PDF documents into individual chapter files based on table of contents or text pattern detection.
This skill handles PDF splitting when:
Install pypdf via uv inline script dependency:
# /// script
# dependencies = ["pypdf"]
# ///
Run scripts/extract_toc.py to analyze the PDF:
uv run ~/.claude/skills/pdf-split/scripts/extract_toc.py <pdf_path>
Output includes:
Based on Phase 1 output, define chapter boundaries as a list of tuples:
chapters = [
(start_page, end_page, "chapter_name"),
# ...
]
If bookmarks exist: Use bookmark page numbers directly.
If no bookmarks:
Run scripts/split_by_chapters.py with the chapter definitions:
uv run ~/.claude/skills/pdf-split/scripts/split_by_chapters.py <pdf_path> <output_dir> --chapters '<json_chapters>'
Example:
uv run ~/.claude/skills/pdf-split/scripts/split_by_chapters.py \
~/book.pdf \
~/book_chapters \
--chapters '[[1,22,"00_Intro"],[23,45,"01_Chapter1"]]'
| Pattern | Regex | Example |
|---|---|---|
| Numbered | Chapter\s+\d+ | "Chapter 1", "Chapter 12" |
| Part + Chapter | Part\s+\w+.*Chapter | "Part One: Chapter 1" |
| Section | Section\s+\d+ | "Section 1.1" |
| Roman numerals | Chapter\s+[IVXLC]+ | "Chapter IV" |
When a detected chapter exceeds 100 pages, verify the boundary:
When no bookmarks or clear patterns exist:
Filter results to keep only actual chapter starts:
output_dir/
├── 00_Front_Matter.pdf
├── 01_Chapter_Name.pdf
├── 02_Chapter_Name.pdf
├── ...
└── Appendix.pdf
Naming convention: {index:02d}_{sanitized_name}.pdf
Split PDFs are suitable for NotebookLM sources:
Chapter-level splitting provides natural semantic boundaries for:
| Script | Purpose |
|---|---|
scripts/extract_toc.py | Analyze PDF, extract bookmarks and detect chapter patterns |
scripts/split_by_chapters.py | Execute split with provided chapter definitions |
references/pypdf-guide.md - pypdf API quick reference for custom operationsCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.