Book2Skills Pipeline v2
Autonomous, Intelligent Book-to-Skill Conversion Pipeline for Production AI Systems (OpenClaw, Claude, Codex, Hermes, etc.).
An end-to-end processing pipeline that converts unstructured books and complex domain documents (PDF, DOCX, MD, TXT) into production-ready AI Agent Skills (SKILL.md) compatible with AI frameworks such as OpenClaw, Claude, Codex, Hermes, and others. Features multi-provider LLM knowledge extraction, structured skill generation, semantic vector embeddings, persistent ChromaDB vector storage, autonomous LLM quality review, and knowledge graph relationship mapping.
๐ Quick Start
# 1. Installation
pip install -e ".[all]"
# 2. Configuration Setup
cp .env.example .env
# Edit .env: e.g., set B2S_LLM__PROVIDER=ollama & B2S_LLM__BASE_URL=http://localhost:11434/v1 for local mode
# 3. ๐ฎ Launch Interactive Studio (Recommended โ Zero Command Memory Required)
book2skills studio
# Or run via CLI directly:
book2skills run all --incremental # Process all books in data directory
book2skills export md # Export formatted SKILL.md bundles
book2skills search "marketing" # Search vector & keyword database
๐ฎ Interactive Studio (TUI)
The simplest way for anyone to operate the systemโan interactive arrow-key terminal menu:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ BOOK-TO-SKILLS STUDIO โ
โ Turn books into ready-to-use AI Agent Skills (OpenClaw, Claude...) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โฏ Choose an action:
๐ ๐ Run pipeline โ all books
๐ Run pipeline โ single book
โ๏ธ Configure LLM Provider
๐ List available books
๐ฆ List generated skills
๐ Search skills database
๐ค Export SKILL.md files
๐ View system statistics
๐๏ธ Clear pipeline cache
๐ช Exit Studio
- Interactive LLM Provider Wizard: Easily switch between OpenAI, Anthropic, Gemini, DeepSeek, OpenRouter, and Ollama directly from the terminal without manual
.envediting. - Live Progress Tracking: Visual progress indicators displaying active stages (
extract โ clean โ chunk โ knowledge โ skill_gen...). - Colorized Output: Rich summaries for books, skills, and extraction statistics.
- Zero Syntax Friction: Completely navigable using keyboard arrow keys and
Enter.
โจ Version 2 Architectural Upgrade Highlights
| Feature Area | v1 Implementation | v2 Enterprise Pipeline |
|---|---|---|
| Knowledge Extraction | Heuristic Regex parsing | Multi-LLM + JSON Schema Strict Enforcer (with fallback) |
| Semantic Tags | โ Empty / Missing | โ LLM generates 3โ5 targeted semantic tags per skill |
| Category Classification | Defaulted to "general" | โ Intelligent multi-category classifier (10+ categories) |
| Skill Naming Standard | Inconsistent camelCase | โ Strict kebab-case naming specification |
| Data Provenance | Unlinked book_id | โ Explicit source_book & source_chapters mapping |
| Skill Sections | Empty workflow fields | โ LLM synthesizes full Workflows, Checklists, & Examples |
| SKILL.md Export | โ Unavailable | โ Automated AI Agent SKILL.md bundle exporter |
| Vector Embeddings | Non-semantic hash codes | โ
Semantic vector embeddings (sentence-transformers) |
| Vector Database | Transient in-memory store | โ Persistent ChromaDB database storage |
| Quality Control | Superficial rules | โ Autonomous LLM Review Agents (1-10 scoring & audit) |
| Deduplication | Exact title matching | โ Semantic cosine vector similarity clustering (0.85+ threshold) |
| Knowledge Graph | โ None | โ Inter-skill relationship mapping & graph storage |
๐๏ธ The 10-Stage Pipeline Architecture
Extract โโโบ Clean โโโบ Semantic Chunking โโโบ Knowledge Extraction (LLM)
โ
โผ
Skill Gen (LLM) โโโบ Quality Review (LLM) โโโบ Deduplication (Cosine Similarity)
โ
โผ
Knowledge Graph โโโบ Vector Embeddings โโโบ Persistent Vector DB (ChromaDB)
Each stage is completely modular, independently executable via CLI (book2skills run stage <name> <file>), and backed by persistent checkpointing for seamless resume capabilities.
๐ Complete CLI Command Summary
book2skills run all --incremental # Process all books incrementally
book2skills run pipeline <file> # Process a single book file
book2skills run stage <name> <file> # Run a single isolated pipeline stage
book2skills list books # List discovered book files
book2skills list skills # List all generated skills
book2skills search "query" # Search skills by keyword / semantic content
book2skills export md # Export skills to SKILL.md format
book2skills show # Inspect current system configuration
book2skills clear -y # Clear pipeline cache silently
๐ REST API Endpoints
| HTTP Method | Endpoint | Description |
|---|---|---|
POST |
/api/v1/pipeline/run |
Trigger asynchronous pipeline execution |
GET |
/api/v1/pipeline/status/{run_id} |
Retrieve real-time pipeline execution status |
GET |
/api/v1/skills |
List all generated skills with pagination & filters |
GET |
/api/v1/skills/{skill_id} |
Fetch full detailed payload for a specific skill |
DELETE |
/api/v1/skills/{skill_id} |
Remove a skill from storage |
GET |
/api/v1/books |
List available books in the data directory |
POST |
/api/v1/books/upload |
Upload a new book file (.pdf, .docx) |
GET |
/api/v1/search?q=... |
Perform high-speed search across all skills |
GET |
/api/v1/stats |
Return global system metrics & quality score averages |
GET |
/api/v1/health |
Health check endpoint |
๐ค Supported LLM Providers & Models
| Provider | Needs API Key? | Recommended Models | Primary Strengths |
|---|---|---|---|
| Ollama (Local) | โ No | qwen2.5:14b, llama3.1:8b |
100% Free, offline, private local execution |
| OpenAI | โ Yes | gpt-4o, gpt-4o-mini |
High throughput & strict JSON adherence |
| Anthropic | โ Yes | claude-3-5-sonnet, claude-3-5-haiku |
Superior procedural logic & synthesis |
| DeepSeek | โ Yes | deepseek-v3, deepseek-r1 |
Enterprise-grade reasoning at high efficiency |
| Google Gemini | โ Yes | gemini-1.5-pro, gemini-1.5-flash |
Large context window handling |
| OpenRouter | โ Yes | 200+ models accessible | Flexible model routing and benchmark testing |
Dual-Model Pairing Strategy:
- Small Model (B2S_LLM__MODEL_SMALL): Handles extraction, semantic chunking, & tag generation.
- Large Model (B2S_LLM__MODEL_LARGE): Handles skill synthesis, edge-case formulation, & quality review.
๐งช Testing Suite
# Run isolated unit tests
pytest tests/unit/
# Run integration tests (LLM & storage validation)
pytest tests/integration/
# Run end-to-end tests (full pipeline run)
pytest tests/e2e/
# Generate code coverage report
pytest --cov=src/book_to_skills
๐ Output Directory Layout
outputs/
โโโ skills/ # Skill JSON payloads
โ โโโ markdown/ # Production-ready SKILL.md bundles
โโโ knowledge_graph/ # Inter-skill relationship mappings
โโโ embeddings/ # Vector index snapshots
data/vector_store/ # Persistent ChromaDB vector database
๐ณ Docker Deployment
# Build Docker image
docker build -f docker/Dockerfile -t book2skills .
# Run API & queue services via Docker Compose
docker-compose -f docker/docker-compose.yml up -d
๐ Full Documentation Suite
- ๐ Architecture Guide
- โ๏ธ Configuration Guide
- ๐ ๏ธ Development Guide
- โ Troubleshooting Guide
- ๐ Architectural Decision Records (ADRs)
๐ Tech Stack Summary
Python 3.11 ยท FastAPI ยท Pydantic ยท Typer ยท sentence-transformers ยท ChromaDB ยท structlog ยท pytest ยท Docker ยท GitHub Actions
๐ Acknowledgements
Book2Skills is built upon and inspired by exceptional open-source projects, research initiatives, and developer tools:
- ๐ง AI Agent Ecosystem (OpenClaw, Claude, Codex, Hermes, etc.): For pioneering the standardized
SKILL.mdspecification for AI agents. - โก FastAPI & Pydantic v2: For high-speed web framework infrastructure and strict type enforcement.
- ๐จ Rich & Questionary: For enabling visually stunning terminal UIs and interactive menu controls.
- ๐ ChromaDB & Sentence-Transformers: For semantic vector embeddings, indexing, and similarity clustering.
- ๐ค LLM Providers & Ecosystem: Ollama, OpenAI, Anthropic, Google Gemini, and DeepSeek for empowering autonomous knowledge extraction.
- ๐ Material for MkDocs: For delivering beautiful, accessible documentation UI for GitHub Pages.