Repo Dev Tools

virgiliojr94/book-to-skill

Converts technical books, doc folders, or source collections into structured agent skills that load chapters on demand, for Claude Code, Copilot CLI, Amp, and more.

  • 39k GitHub stars
  • Python
  • ⚖️ MIT
  • 🎯 Beginner

Last verified: repo last pushed

npx skills add virgiliojr94/book-to-skill
virgiliojr94/book-to-skill preview image

What it is

book-to-skill is a converter made of a deterministic Python extractor and a spec-driven generator, where your agent follows SKILL.md. It turns a book (PDF, EPUB, DOCX, MD, HTML, RTF, MOBI), a folder, or a glob into a structured skill with a core SKILL.md, per-chapter files, a glossary, patterns, and a cheatsheet. The agent loads chapters on demand and answers from the real content. It works with hosts that support the open Agent Skills standard.

Who it's for

  • Developers who want to query technical books from inside their coding agent instead of searching PDFs
  • Teams wanting to fold internal docs, runbooks, brand guidelines, specs, or research papers into a queryable skill
  • Users of GitHub Copilot CLI, Amp, Claude Code, Hermes Agent, OpenCode, or OpenClaw

Requirements

Requirements

  • Python 3 (the extractor is run with python3 scripts/extract.py)
  • An agent host that supports the Agent Skills standard (Copilot CLI, Amp, Claude Code, Hermes Agent, OpenCode, OpenClaw)
  • A format-specific extractor for the input, e.g. pdftotext, pypdf, pdfminer.six, or docling for PDF; ebooklib + beautifulsoup4 for EPUB; Calibre ebook-convert for MOBI/AZW/AZW3
  • OCR (e.g. ocrmypdf) first for scanned PDFs with no text layer

Setup

  1. Install via the cross-agent skills CLI

    One command that works for any host.

    bash
    npx skills add virgiliojr94/book-to-skill
  2. Or install manually by cloning into your skills folder

    This registers /book-to-skill. The path shown is for Claude Code. Copilot CLI uses ~/.copilot/skills/, and Amp/cross-agent uses ~/.agents/skills/.

    bash
    git clone https://github.com/virgiliojr94/book-to-skill.git ~/.claude/skills/book-to-skill
  3. Check which extractors are installed

    Prints which extractors are installed for every format and the exact command to install anything missing. No input file is needed.

    bash
    python3 scripts/extract.py --check

Examples

Convert a book into a skill

Prompt
prompt
/book-to-skill ./my-book.pdf

Expected output: Points the converter at a file. The README says you can also pass a folder, glob, or list of files, with an optional [skill-name].

Query the generated skill

Prompt
prompt
/my-book replication

Expected output: After conversion, the agent reads the relevant chapter file and answers from the book's actual content.

Run OCR on a scanned PDF first

bash
bash
ocrmypdf input.pdf output.pdf

What it does: Scanned PDFs have no text layer, so the extractor stops. Run OCR first, then convert the result.

Install a PDF extractor for technical books

bash
bash
pip3 install docling

What it does: Docling is the documented choice for technical PDFs with code, tables, and formulas, and runs at about 1.5s/page. pdftotext is faster for prose-only books.

Pros & cons

Pros

  • Pro:Claims 24×–51× fewer tokens than dumping the book into context, measured on real books
  • Pro:Chapter files load on demand, so only the relevant content enters context
  • Pro:Supports many input formats (PDF, EPUB, DOCX, MD, HTML, RTF, MOBI) and also non-book sources like internal docs, specs, and research papers
  • Pro:Extraction runs locally, and the repo ships no book content

Cons

  • Con:Scanned PDFs need OCR first, because the extractor stops when there is no text layer
  • Con:Different formats and book types need different optional extractors, such as docling for technical PDFs and Calibre for MOBI
  • Con:Sharing a generated skill of a copyrighted work can infringe rights, so skills of third-party books should stay private

Images