# virgiliojr94/book-to-skill architecture

> Architecture diagram of the GitHub repository virgiliojr94/book-to-skill, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/virgiliojr94/book-to-skill
- Repository: https://github.com/virgiliojr94/book-to-skill
- Video tour (about a minute): https://gitdiagram.com/virgiliojr94/book-to-skill/video

## Overview

book-to-skill converts books and other structured prose into an agent-ready skill. The principal workflow is CLI invocation, format-specific text extraction, sanitization and structural analysis, then handing extracted material to the agent-driven skill-generation process. README documents generated chapter, glossary, pattern, and cheatsheet files and support for multiple agent hosts. Source excerpts show the CLI, extraction dispatch, and parser dependencies; unsampled generator and publication behavior is represented only where documented.

Main entry points: [`book_to_skill/utils.py`](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/utils.py) (Extraction coordinator), [`book_to_skill/cli.py`](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/cli.py) (CLI), [`book_to_skill/parsers/html.py`](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/html.py) (HTML extraction), [`book_to_skill/parsers/epub.py`](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/epub.py) (EPUB extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and configuration"]
  node_cli["CLI<br/>[cli.py]"]
  node_settings["Formats and paths<br/>[config.py]"]
  node_dependencies["Dependency checks<br/>[dependencies.py]"]
end

subgraph group_extract["Document extraction"]
  node_extractor["Extraction coordinator<br/>[utils.py]"]
  node_pdf["PDF extraction<br/>[pdf.py]"]
  node_epub["EPUB extraction<br/>[epub.py]"]
  node_html["HTML extraction<br/>[html.py]"]
  node_docx["DOCX extraction<br/>[docx.py]"]
  node_rtf["RTF extraction<br/>[rtf.py]"]
  node_calibre["Calibre conversion<br/>[calibre.py]"]
  node_text["Text decoding<br/>[text.py]"]
  node_pdfinspect["PDF inspection"]
end

subgraph group_prepare["Text preparation"]
  node_sanitize["Text sanitization<br/>[sanitize.py]"]
  node_analysis["Structure and metadata<br/>[utils.py]"]
end

subgraph group_skill["Skill use"]
  node_skill["Generated skill"]
  node_agent(("Agent host"))
end

node_user(("User"))

node_user -->|"invokes"| node_cli
node_cli -->|"runs"| node_extractor
node_cli -->|"installs hook"| node_pdfinspect
node_extractor -->|"uses formats"| node_settings
node_extractor -->|"checks dependencies"| node_dependencies
node_extractor -->|"dispatches"| node_pdf
node_extractor -->|"dispatches"| node_epub
node_extractor -->|"dispatches"| node_html
node_extractor -->|"dispatches"| node_docx
node_extractor -->|"dispatches"| node_rtf
node_extractor -->|"dispatches"| node_calibre
node_epub -->|"parses content with"| node_html
node_html -->|"reads source text"| node_text
node_rtf -->|"reads source text"| node_text
node_extractor -->|"sanitizes text"| node_sanitize
node_extractor -->|"detects structure"| node_analysis
node_pdfinspect -->|"wraps PDF extraction"| node_extractor
node_extractor -->|"provides extracted content"| node_skill
node_skill -->|"loads on demand"| node_agent

click node_cli "https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/cli.py"
click node_settings "https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/config.py"
click node_dependencies "https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/dependencies.py"
click node_extractor "https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/utils.py"
click node_pdf "https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/pdf.py"
click node_epub "https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/epub.py"
click node_html "https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/html.py"
click node_docx "https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/docx.py"
click node_rtf "https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/rtf.py"
click node_calibre "https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/calibre.py"
click node_text "https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/text.py"
click node_pdfinspect "https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/pdf_inspector_integration.py"
click node_sanitize "https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/sanitize.py"
click node_analysis "https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/utils.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_settings,node_dependencies,node_user toneBlue
class node_extractor,node_pdf,node_epub,node_html,node_docx,node_rtf,node_calibre,node_text,node_pdfinspect toneAmber
class node_sanitize,node_analysis toneMint
class node_skill,node_agent toneRose
```

## Components

### Entry and configuration

- [CLI](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/cli.py): `book_to_skill/cli.py`
- [Formats and paths](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/config.py): `book_to_skill/config.py`
- [Dependency checks](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/dependencies.py): `book_to_skill/dependencies.py`

### Document extraction

- [Extraction coordinator](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/utils.py): `book_to_skill/utils.py`
- [PDF extraction](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/pdf.py): `book_to_skill/parsers/pdf.py`
- [EPUB extraction](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/epub.py): `book_to_skill/parsers/epub.py`
- [HTML extraction](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/html.py): `book_to_skill/parsers/html.py`
- [DOCX extraction](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/docx.py): `book_to_skill/parsers/docx.py`
- [RTF extraction](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/rtf.py): `book_to_skill/parsers/rtf.py`
- [Calibre conversion](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/calibre.py): `book_to_skill/parsers/calibre.py`
- [Text decoding](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/parsers/text.py): `book_to_skill/parsers/text.py`
- [PDF inspection](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/pdf_inspector_integration.py): `book_to_skill/pdf_inspector_integration.py`

### Text preparation

- [Text sanitization](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/sanitize.py): `book_to_skill/sanitize.py`
- [Structure and metadata](https://github.com/virgiliojr94/book-to-skill/blob/master/book_to_skill/utils.py): `book_to_skill/utils.py`

### Skill use

- **Generated skill**
- **Agent host**

### Other components

- **User**

## Connections

- User → CLI: invokes (evidence: `README.md`)
- CLI → Extraction coordinator: runs (evidence: `book_to_skill/cli.py`)
- CLI → PDF inspection: installs hook (evidence: `book_to_skill/cli.py`)
- Extraction coordinator → Formats and paths: uses formats (evidence: `book_to_skill/utils.py`)
- Extraction coordinator → Dependency checks: checks dependencies (evidence: `book_to_skill/utils.py`)
- Extraction coordinator → PDF extraction: dispatches (evidence: `book_to_skill/utils.py`)
- Extraction coordinator → EPUB extraction: dispatches (evidence: `book_to_skill/utils.py`)
- Extraction coordinator → HTML extraction: dispatches (evidence: `book_to_skill/utils.py`)
- Extraction coordinator → DOCX extraction: dispatches (evidence: `book_to_skill/utils.py`)
- Extraction coordinator → RTF extraction: dispatches (evidence: `book_to_skill/utils.py`)
- Extraction coordinator → Calibre conversion: dispatches (evidence: `book_to_skill/utils.py`)
- EPUB extraction → HTML extraction: parses content with (evidence: `book_to_skill/parsers/epub.py`)
- HTML extraction → Text decoding: reads source text (evidence: `book_to_skill/parsers/html.py`)
- RTF extraction → Text decoding: reads source text (evidence: `book_to_skill/parsers/rtf.py`)
- Extraction coordinator → Text sanitization: sanitizes text (evidence: `book_to_skill/utils.py`)
- Extraction coordinator → Structure and metadata: detects structure (evidence: `book_to_skill/utils.py`)
- PDF inspection → Extraction coordinator: wraps PDF extraction (evidence: `book_to_skill/pdf_inspector_integration.py`)
- Extraction coordinator → Generated skill: provides extracted content (evidence: `README.md`)
- Generated skill → Agent host: loads on demand (evidence: `README.md`)
