RepoDaily · 2026-07-27 · Security tool

book-to-skill Turns Technical PDFs Into Queryable Agent Skills

#11 Security tool Python +358 virgiliojr94/book-to-skill Open repository

Converts technical PDFs into on-demand Agent Skills for Claude Code, Copilot CLI, and Amp. Local extraction, prompt-injection scanning, and 24x-51x measured token savings over raw context dumps.

Repo typeSecurity tool
Best forDevelopers who want their AI coding agent to answer from a technical book's actual content without hallucinating or burning tokens on full-text context dumps.
Risk levelMedium — requires an Agent Skills-compatible host and optional system dependencies; several hardening features remain unreleased.
Time to evaluate30 minutes

Primary question: Does your AI coding agent support the open Agent Skills standard (SKILL.md)?

89/100

RepoDaily adoption score

RepoDaily rates this as 89/100 (strong) for adoption: evidence, installation path, production risk, differentiation, license clarity, and AI/agent fit are scored from the article sources and adoption notes.

Directional score from RepoDaily sources and adoption notes, not a benchmark.Risk: Medium
100Evidence quality

5 source(s) across 3 source category/categories, plus a RepoDaily-specific evidence module when available.

100Installability

5 workflow step(s), 4 next-action step(s), and 4 command/install signal(s) were detected.

62Maintenance confidence

Trending momentum is +358 stars, with maintenance/release/issue signals counted when present.

94Production readiness

Risk is marked medium, with 7 security note(s) and 3 explicit skip condition(s).

100Differentiation

3 opportunity lens item(s), 3 alternative(s), and 3 type-specific section(s) support differentiation.

68License clarity

License source or license wording is present.

78Agent / AI fit

5 AI/agent-related signal(s) were detected in the article text and metadata.

Project overview

book-to-skill is a Python converter that takes a technical book — typically a PDF, but also EPUB, DOCX, HTML, Markdown, RTF, or MOBI — and distills it into a structured Agent Skill stored as a SKILL.md file plus per-chapter reference files. Once installed in your agent's skills directory, the agent loads only the relevant chapter when you ask a question, answering from the actual book content instead of hallucinating.

The tool targets a specific pain point: you read a 300-page technical book once, and three months later you cannot remember which chapter covered the concept you need. Searching the PDF returns pages, not answers. Asking your AI agent about the book produces hallucinations or a refusal. book-to-skill bridges that gap by creating named frameworks, decision rules, and anti-patterns that the agent retrieves on demand.

What makes this noteworthy for security-conscious users is the local-only extraction pipeline. The tool does not upload files, run a network service, or phone home. The recent changelog entries add a dependency-free prompt-injection scanner that flags instruction-override phrases, model control tags, invisible Unicode, and exfiltration-shaped content in generated skills before they are accepted or published. The DOCX extractor blocks XML external-entity and Billion Laughs attacks, and subprocess argument-injection hardening prevents filenames starting with a hyphen from being interpreted as command-line options.

The token efficiency claim is concrete and measured: 24x-51x fewer tokens than dumping the full book into context to answer a single question, benchmarked on real books using tools/discovery_tax.py. The per-chapter file structure means a 200-page book costs tokens proportional to the question, not the page count.

Problem it solves

  • Technical books are read once and forgotten — chapter 7's framework is invisible three months later.
  • PDF search returns a list of pages, not answers to a specific question.
  • Asking an AI agent about a book it has not ingested produces hallucinations or a refusal.
  • Dumping an entire book into the context window is expensive, slow, and imprecise — the agent drowns in unrelated chapters.
  • Manual notes become a 200-line document that is never opened again.

How it works

  1. Point the tool at a file, folder, or glob: /book-to-skill ./my-book.pdf. The deterministic extractor parses the document locally using stdlib fallbacks or optional dependencies (pdftotext, pypdf, ebook-convert).
  2. The extractor identifies chapter boundaries via pattern matching — Arabic numerals, Roman numerals (Chapter I.), and language-specific headings including Thai. Invisible Unicode characters are stripped before processing.
  3. The spec-driven generator distills each chapter into named frameworks, decision rules, and anti-patterns using the book's exact terminology — structure, not a summary.
  4. Output is written as a SKILL.md manifest plus per-chapter files in your agent's skills directory. The prompt-injection scanner runs before any generated skill is accepted.
  5. In your agent session, type /your-book-slug <topic> and the agent reads only the relevant chapter file, answering from the distilled content.

Architecture: Deterministic Extractor + Spec-Driven Generator

book-to-skill splits into two components. The deterministic extractor handles document parsing: it reads PDFs via pdftotext or pypdf (which replaced the end-of-life PyPDF2 in the pdf extra), EPUBs natively, DOCX with XXE-blocking hardening, and MOBI/AZW through Calibre's ebook-convert. Every parser strips zero-width characters (U+200B, U+200C, U+200D, U+FEFF) and the Unicode tag block (U+E0000-U+E007F) before producing metrics or full_text.txt.

The spec-driven generator produces SKILL.md as the always-loaded converter spec plus per-chapter skill files. SKILL.md defines extraction steps, depth budgets, and quality rules. Contributors are explicitly warned to keep SKILL.md lean because it loads on every run — PRs adding weight without demonstrated benefit are rejected. The CI pipeline runs ruff check, pytest, and python3 tools/validate_skill.py SKILL.md across Python 3.10-3.13.

Benchmarking uses tools/discovery_tax.py, which measures the Discovery Loop Tax — the token cost of answering one question from a book. Results show 24x-51x fewer tokens compared to context-dumping the entire book.

Try-It Path: Two Install Modes

  • Agent skill install: git clone https://github.com/virgiliojr94/book-to-skill.git ~/.claude/skills/book-to-skill — then run /book-to-skill /path/to/book.pdf [skill-name] in your agent session.
  • Standalone CLI: pip install "book-to-skill[pdf,epub,docx]" — gives you book-to-skill /path/to/book.pdf --mode text, but does not register the agent skill.
  • Check your extractors: python3 scripts/extract.py --check shows which optional parsers are active and which system tools (pdftotext, ebook-convert) are available.
  • Development setup: clone, create a venv, pip install pytest ruff, and run the same checks CI runs: ruff check ., pytest -q, python3 tools/validate_skill.py SKILL.md.

Security Surface: What Gets Hardened

  • Prompt-injection scanner: dependency-free, flags instruction-override phrases, model control tags, invisible Unicode, authority-widening frontmatter, and exfiltration-shaped content. Findings report rule and file/line location only — never echo attacker text (#73).
  • Invisible-Unicode scrub: all parsers remove U+200B/C/D, U+FEFF, and U+E0000-U+E007F before output; sources with no visible content after scrub are rejected.
  • DOCX XXE / Billion Laughs: the DOCX extractor scans the archive and rejects any XML part declaring a DTD or entities before parsing (#53, #54).
  • Subprocess argument-injection: file paths are absolutised before being passed to pdftotext, pdfinfo, or ebook-convert, so a filename starting with - cannot be treated as a CLI option (#53, #54).
  • Dependency CVE review: a dependency-review CI job flags any new dependency with a moderate-or-higher CVE or a denied license, posting findings as a PR comment. Dependabot covers the pip ecosystem.
  • pypdf replaces PyPDF2: PyPDF2 is end-of-life and receives no security fixes; pypdf is the maintained successor (#54).

Who should pay attention?

Good fit if

  • Developers using Claude Code, GitHub Copilot CLI, or Amp who own technical books they reference repeatedly.
  • Security teams with internal playbooks or standards documents that could become queryable agent skills.
  • Anyone who wants an agent to answer from a book's actual content with zero hallucination and controlled token cost.

Skip for now if

  • Users whose AI agent does not support the Agent Skills standard or SKILL.md format.
  • Readers who need verbatim reproduction of long passages — book-to-skill synthesizes structure, never copies raw text.
  • Anyone processing copyrighted material they do not have the right to convert (the README explicitly addresses copyright and fair use).

Risks and cautions

Medium

The core extraction pipeline is mature and security-hardened, but the project is still adding features and several hardening improvements remain unreleased. Full format coverage requires optional system dependencies.

  • Full format coverage requires system tools: pdftotext (poppler) for PDF, ebook-convert (Calibre) for MOBI/AZW. Without them, extraction falls back to stdlib or pypdf.
  • The prompt-injection scanner, Thai chapter detection, and several hardening fixes are listed under [Unreleased] in the changelog — not yet in a tagged release.
  • Adoption depends on your agent host supporting the Agent Skills standard. Claude Code, Copilot CLI, and Amp are confirmed; other hosts are not.
  • The project is maintained by a single developer with GitHub Sponsors funding — bus factor is a consideration.
  • Local-only: no file upload, no network service, no telemetry (per SECURITY.md scope statement).
  • Generated-skill prompt-injection scan flags instruction overrides, model control tags, invisible Unicode, and exfiltration patterns before acceptance (#73).
  • DOCX extractor blocks XXE and Billion Laughs by rejecting DTDs and entity declarations before parsing (#53, #54).
  • Subprocess argument-injection hardening absolutises paths before passing to pdftotext, pdfinfo, ebook-convert (#53, #54).
  • Invisible Unicode stripped from all parser outputs; sources with no visible content post-scrub are rejected.
  • Dependency-review CI job flags CVEs and denied licenses; pypdf replaces EOL PyPDF2 (#54).
  • Contributing guide: generated skills must synthesize, never reproduce long passages, respecting source licenses.

Alternatives to compare

ApproachWhen to useTrade-off
Raw context-window dump
Your book is short (under 50 pages) and you only need a one-time answer.Free, but 24x-51x more tokens per question and no persistent structure.
LlamaIndex
You want a general-purpose RAG framework with broader document-connector support beyond books.Open source (MIT); requires Python and more setup complexity.
paper-qa
Your sources are academic papers and you need cited multi-document synthesis rather than per-book skill files.Open source; Python-based, heavier dependency stack.

What this trend reveals

Corporate playbook-to-skill pipeline

Security teams with internal standards, threat models, or runbooks stored as PDFs can convert them into agent skills that developers query during incident response or code review.

Run /book-to-skill on one internal standards document and measure whether the generated skill answers test questions correctly compared to manual PDF search.

Multi-book skill library

Convert a shelf of technical books into individual skills that share the same SKILL.md format, giving one agent access to structured knowledge from dozens of sources without loading all of them simultaneously.

Convert three books covering overlapping topics and test whether the agent selects the right skill file for cross-domain questions.

Training material for onboarding

Turn onboarding documentation, architecture decision records, or style guides into skills that new hires can query from their coding agent from day one.

Convert one onboarding document set and measure whether new team members find answers faster than searching a wiki.

Best next action

Convert one trusted technical PDF and test the output

The fastest path to evaluating book-to-skill is to install it as an agent skill, convert one book you already know well, and verify the generated chapter files match the book's actual structure.

  1. Clone into your skills directory: git clone https://github.com/virgiliojr94/book-to-skill.git ~/.claude/skills/book-to-skill
  2. Check available extractors: python3 scripts/extract.py --check
  3. Convert a book: /book-to-skill /path/to/trusted-book.pdf my-test-skill
  4. In your agent, ask /my-test-skill <topic-from-chapter-7> and verify the answer cites the real chapter content, not a hallucination.

RepoDaily verdict

book-to-skill addresses a real gap — turning static PDFs into agent-queryable knowledge with measured token savings and serious input-hardening. The security surface (prompt-injection scanning, XXE blocking, invisible-Unicode stripping) is above average for a conversion tool. Adoption risk is medium: it depends on Agent Skills-compatible hosts, and several hardening features remain unreleased.

Sources