/book-to-course:book-to-coursefrom book-to-course
Converts books/documents (EPUB, PDF, HTML, DOCX, Markdown, TXT) into an interactive web-based course with step-by-step lessons, quizzes, animations, flashcards, programming exercises with unit tests, and progress tracking. Activated when a user wants to learn from uploaded material or create an interactive study course.
Ships in book-to-course. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Turns a source book into a folder that works as a self-contained web course. The learner opens it in a browser, reads explanations written for a complete beginner, plays with small animations, answers quizzes, writes code that is checked by unit tests, and their progress is stored in a file next to the course.
The player (HTML/CSS/JS + a tiny Python helper) is fixed and already tested — your job is the content: read the book carefully, then write lessons as JSON files. Scripts do everything mechanical.
<course>/
index.html assets/ serve.py start.sh start.bat README.md ← player (never hand-edit; refresh with init_course.py --update)
content/course.json, content/<chapter-id>/chapter.json, 01-*.json … 99-test.json ← YOU write these
exercises/<dir>/ (starter files, tests, exercise.json, _solution/) ← YOU write these for code exercises
course/data.js ← generated by build_course.py
progress/progress.json ← learner progress (written by serve.py)
.build/state.json, .build/plan.md, .build/source/ ← resume info + extracted book text
Scripts (all in scripts/, standard library only):
| script | purpose |
|---|---|
extract_book.py INPUT OUTDIR | book → chapter Markdown files + manifest.json + outline.md |
init_course.py DIR --extract OUTDIR [--ui-lang CODE] | create course folder, copy player, create state |
course_state.py DIR status|next|set|note|log | where the build stands (resume across sessions) |
build_course.py DIR [--single-file OUT.html] | validate lessons, print theory/practice balance, write course/data.js |
verify_exercises.py DIR | tests must FAIL on starter and PASS on solution |
pack_course.py DIR [--share] | zip for delivery / later continuation |
Create a task list for the steps below. Use SendUserMessage for short progress notes — the learner-to-be may be away.
If the user mentions an existing course, attaches a course zip/folder, or says "next chapter": unzip/locate it and run
course_state.py DIR status. It prints the next chapter, the notes (terminology, running example, style decisions) and the
log. Continue at step 4 for that chapter. If player files look outdated, run init_course.py DIR --update.
Look for the book in the attachments (/mnt/user-data/uploads/), in the conversation, or on the linked computer. Ask only
what you cannot reasonably decide; otherwise state your assumption and go on:
which go python3 node …). If not installed, still write exercises but say they could not be verified.python3 scripts/extract_book.py /path/to/book.epub work/extract
Read work/extract/outline.md and the warnings. PDF exit code 2 means a scanned book — run ocrmypdf if available, or tell
the user an EPUB or text-based PDF is needed. PDF extraction is heuristic: when code, tables or math look garbled,
rasterize the page (pdftoppm -r 110 -f N -l N -png) and look at it, then fix the text from the picture. EPUB/HTML are
the cleanest sources.
Math-heavy PDFs are garbled more often than prose, because pdftotext maps the math font's glyphs to whatever
Unicode code point the PDF happens to embed — not necessarily the right one. Watch for: Greek letters (λ, θ, …)
silently vanishing from the extracted text; = turning into a lookalike character such as ⫽; ×/±/√ turning into
the wrong symbol or disappearing; matrices and multi-line equations collapsing onto one line with their layout lost. A
page that reads fine in prose but has a nonsensical equation ("fica Ax x com algum escalar") is this, not a typo in the
book — rasterize that page and transcribe the formula directly from the image into $...$/$$...$$ (references/math.md
has the supported LaTeX subset); don't try to guess the original from the garbled text.
python3 scripts/init_course.py <course-dir> --extract work/extract [--ui-lang pl]
Write <course-dir>/.build/plan.md: the learning arc, one line per planned lesson with the source sections it covers
(this is the coverage map — every substantial section of every chapter must land in some lesson), the exercise idea for each
chapter, the running example if any, and the exercise toolchain. Then fill content/course.json (subtitle, description).
Sizing rule of thumb: one lesson per ~1,200–2,000 source words (at least 2 per chapter), plus one test lesson per chapter.
Record decisions that later batches must respect with course_state.py DIR note "…" (term translations, naming of the running example, tone).
For each chapter (course_state.py DIR next tells you which): set CH in_progress, then read the whole chapter file in
.build/source/chapters/ (in slices if long) before writing — never write from memory of the topic; the course must reflect
this book's content and order. Then create content/<chapter-id>/chapter.json, lessons 01-….json …, a test lesson 99-test.json,
and exercises/<dir>/ for code exercises. Before writing the first lesson of a course, read:
references/pedagogy.md — how to explain things to a beginner, theory/practice balance, quiz & test designreferences/lesson-schema.md — every block type and field (use only these)references/exercises.md — designing exercises whose unit tests check the learner's code (read when the book teaches programming)references/examples/ — a complete sample lesson (all block types), a chapter test, and a Go exercise folder with tests and _solution/ to copy the shape fromAfter finishing a chapter: build_course.py DIR (fix all errors; read warnings), verify_exercises.py DIR,
course_state.py DIR set CH done --note "…", add notes for continuity. Keep going to the next chapter.
Long books don't fit in one go. Work chapter by chapter; state is saved after every chapter, so stopping anywhere is safe.
When context grows heavy, or after about 3 chapters in one sitting, run pack_course.py, deliver the zip, and tell the user
which chapter comes next and that they can say "continue the course" with the zip attached (or the folder linked). A partially
built course is fully usable: unfinished chapters simply don't appear yet.
build_course.py DIR → no errors; practice share per chapter roughly 35–60%.verify_exercises.py DIR → all OK. A SKIPPED exercise was not verified: say so plainly.python3 serve.py --no-browser &, then a headless browser or the built-in browser) — check one lesson renders and a quiz works.pack_course.py DIR and send the zip with SendUserFile. If a folder on the user's computer is linked and they asked for it there, write the course into that folder instead.start.bat / ./start.sh (needs Python 3) or just open index.html; progress lives in progress/; what is covered and what is next (if partial). build_course.py --single-file preview.html yields one HTML file for a quick look without unzipping (progress then stays in the browser).stepper block.from_book blocks are for short excerpts (≲100 words) or code listings from the book with a source reference; never paste long passages — the course is a learning aid, not a copy.build_course.py prints the theory/practice split — if a chapter is far outside 35–60% practice, rebalance.verify_exercises.py proves it. A broken test is far worse than a missing exercise.ids (e.g. ch03-quiz-slices). Progress is stored by id; renaming or reordering blocks later would orphan it.reveal prompts, tables, SVG/flow diagrams, and selfcheck exercises (write-and-compare tasks with a checklist).$...$ (inline) or $$...$$ (display) in any md/text field — see references/math.md for the supported LaTeX subset. Use a derivation block for a worked example that proceeds line by line (one algebraic move per step, each with a why); use stepper for a numeric walkthrough instead when that reads more naturally. svg is still the right tool for geometry and freehand diagrams, not for equations. Practice means numeric questions (a typed answer checked within a tolerance — use it instead of fill whenever the answer is a number) and order of proof steps, not more reading.fill and order questions; keep example sentences from the book short.svg or flow block, or describe it in a table.terms.build_course.py refuses to write data.js while errors remain — fix them (messages name file, block and field). --force writes anyway (don't use for delivery).course/data.js missing or invalid; rerun build_course.py.start.sh/start.bat. The command to run by hand is shown on each exercise.assets/i18n/en/README.md (opens in a new tab)assets/i18n/en/strings.json (opens in a new tab)assets/i18n/pl/README.md (opens in a new tab)assets/i18n/pl/strings.json (opens in a new tab)assets/i18n/pt/README.md (opens in a new tab)assets/i18n/pt/strings.json (opens in a new tab)assets/template/assets/app.js (opens in a new tab)assets/template/assets/style.css (opens in a new tab)assets/template/index.html (opens in a new tab)assets/template/serve.py (opens in a new tab)assets/template/start.bat (opens in a new tab)assets/template/start.sh (opens in a new tab)references/examples/example-chapter-test.json (opens in a new tab)references/examples/example-lesson.json (opens in a new tab)references/examples/example-math-lesson.json (opens in a new tab)references/examples/exercise-go-io/_solution/main.go (opens in a new tab)references/examples/exercise-go-io/exercise.json (opens in a new tab)references/examples/exercise-go-io/go.mod (opens in a new tab)references/examples/exercise-go-io/main.go (opens in a new tab)references/examples/exercise-go-io/main_test.go (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
HTML, CSS, JavaScript, Python
npx claudepluginhub sebastianhaba/book-to-course-skill --plugin book-to-course3 skills in this plugin
/course-to-apkPackage an existing interactive course generated by the book-to-course skill (a folder with index.html, assets/ and course/data.js, or its .zip) into a signed Android APK — a light offline WebView app to install on a phone or tablet. Checks the build tools on the machine (JDK, Android SDK build-tools and platform), tells the user exactly what is missing and where to get it, and can download it for them. Use this whenever the user wants a course "na telefon/tablet", "na Androida", "jako aplikację", "zrób z kursu APK", "course to apk", wants to learn from their generated course on a mobile device offline, or wants to rebuild/update a course app after adding chapters — even if they don't say "APK" explicitly. Do NOT use for building a course from a book (that is book-to-course), for iOS apps, or for general Android app development./course-to-appimagePackage an existing interactive course generated by the book-to-course skill (a folder with index.html, assets/ and course/data.js, or its .zip) into a self-contained Linux AppImage — one file that carries its own WebView engine (Electron), so it runs on any desktop distro without installing anything, keeps progress in a file and can run code exercises' tests. Checks the build tools on the machine (appimagetool, Electron, AppImage runtime), tells the user exactly what is missing and where to get it, and can download it for them. Use this whenever the user wants a course "na Linuxa", "jako aplikację na pulpit/desktop", "w menu aplikacji", "zrób z kursu AppImage", "course to appimage", wants a course app they can copy to another Linux computer, wants to open their generated course like a normal program instead of start.sh, or wants to rebuild/update the course app after adding chapters — even if they don't say "AppImage" explicitly. Do NOT use for building a course from a book (that is book-to-course), for Android (course-to-apk), Windows/macOS installers, Flatpak/Snap/.deb packaging, or general Linux/Electron app development.Other plugins' skills for the same job