An AI skill that turns books into animated, narrated, interactive web experiences
JavaScript ai-agentsai-educationanimationclaudeclaude-codeclaude-skillsedtecheducationinteractive-textbookscormtext-to-video
skill: leaner delivery pass, per-book paths and progress, page preview
yzrb61a5f884b18
diff --git a/.claude/skills/animebook/SKILL.md b/.claude/skills/animebook/SKILL.mdindex c32d7cd..bcb83aa 100644--- a/.claude/skills/animebook/SKILL.md+++ b/.claude/skills/animebook/SKILL.md@@ -1,86 +1,60 @@---name: animebook-description: Turn a book (PDF) into an animated, narrated, interactive web book — a static site whose chapters are drawn step by step in SVG, narrated with Edge TTS synced word by word, with quick checks inside the picture, graded end-of-chapter practice, a cover, a contents page and a bookshelf. Use it for any part of that pipeline: splitting a PDF into chapters, planning a book, making or fixing a chapter (animation, narration, questions), reviewing and testing lessons, the contents page, publishing. Also when the user only says "do the next chapter", "fix this animation" or "add a question here".+description: Make or edit animated, narrated, interactive web books from reference PDFs. Use for book planning, chapter animation and exercises, narration, cover and contents pages, and requested publishing, including "make the next chapter" or "fix this animation".---# AnimeBook-You turn a reference book into an animated book. Each chapter is one web page holding one 16:9 picture (a 1600×900 SVG stage plus a control bar). A lesson is a list of **beats**; each beat is one narration clip plus the animation timed to its words. Quick checks pause inside the picture; full-screen practice and a score card end the chapter. Everything is drawn in code: no images from the book, no stock art.+Make the picture explain the idea through change: rearrange, split, balance, count, compare. Each chapter is one 1600×900 SVG stage plus controls; **beats** pair narration clips with timed actions. Quick checks and final practice happen inside the picture. Templates supply mechanics; choose the visual argument for the content.-The pipeline below is fixed; it was worked out over a full 68-chapter book. The design inside it is yours (see *Creative freedom*). The user may add their own requests at any point; they override defaults here.+Follow the pipeline forward, entering at the requested stage for existing work. User requests override defaults. Default to code/SVG artwork; record any other asset choices in the book's conventions. Re-create explanations, examples and drawings; keep source PDFs, page images and extracted text outside the published folder and out of version control (`.gitignore`: `*.pdf`, `books/*/pages/`). Publishing and pushing require the user's instruction.## Project layout```-book.pdf, sections.json reference book and its page map (private)-book_pages/chNN/ page images + text.md per chapter (private)-BOOK.md the book plan: decisions, conventions, chapter status, errata — keep it current-content/chNN/narration.en.json narration script with [[marks]]; TTS cache beside it-tools/e2e_chNN.py per-chapter keyboard test+books/<book>/+ book.pdf, sections.json source and page map (private)+ pages/chNN/text.md, *.png extracted reference material (private)+ BOOK.md current scope, conventions, helper index+ chapters.md chapter map and status+ chapters/chNN.md brief storyboard, relevant errata and feedback+content/<book>/chNN/ narration.<lang>.json and TTS cache+tools/<book>/ targeted tests when neededsite/ the only published folderindex.html, lib/bookshelf.* bookshelf (once there are books)<book>/index.html cover + contents (assets/templates/book.html)<book>/unit-art.js unit sketches (assets/templates/unit-art.js)<book>/lib/engine.js, .css this book's engine copy (assets/engine/)<book>/chNN/index.html a lesson (assets/templates/chapter.html)- <book>/chNN/audio/en/ beat MP3s + timings.js+ <book>/chNN/audio/<lang>/ beat MP3s + timings.js```-`SKILL` below means this skill's folder. Needs: `uv` (scripts run as `uv run --with <deps>`), `ffmpeg` (ffprobe, for clip lengths), network access for Edge TTS, and Playwright's Chromium for review (`uv run --with playwright playwright install chromium`). Audio needs a local server: `python3 -m http.server 8765 -d site`.+`SKILL` means this skill's absolute folder; `<book>` is the book slug, `<lang>` its primary language code. Existing books keep their paths. Needs: `uv`, `ffmpeg`/`ffprobe`, Edge TTS network access and Playwright Chromium (`uv run --with playwright playwright install chromium`). Preview: `python3 -m http.server 8765 -d site`.## Pipeline-Gates marked **(user)** need the user's go-ahead; everything else you just do.+Resolve intake, book map and pilot decisions with the user; reuse answers and approvals already given.-1. **Intake (user).** Start BOOK.md from `SKILL/assets/templates/BOOK.md`. Ask once, briefly: readers (age, level), tone, narration language (others come later), anything to skip or add, a guide character if any, where it will be published. Offer defaults; record answers in BOOK.md.-2. **Split.** `SKILL/scripts/outline.py book.pdf` prints the bookmark tree; rerun with `--level N -o sections.json` at the chapter depth (no bookmarks: write sections.json by hand from the contents pages). Check it against the book's contents, then `SKILL/scripts/split_pages.py book.pdf` (needs `--with pymupdf`) for page images and each chapter's `text.md`.-3. **Book map (user).** Skim every chapter's `text.md` (text only). Write in BOOK.md: units and chapters with minute estimates, a colour per unit, and the recurring visual models across the book (number line, timeline, map, graph, …) — these become engine helpers. Show the user the chapter list and the visual approach.-4. **Pilot chapter (user).** Make chapter 1 completely (chapter loop below). This is where look, pacing, voice and question style get approved; expect several rounds. Record every decision in BOOK.md under *Conventions*; later chapters follow them. Build helpers for the recurring models now, not halfway through the book.-5. **Chapter loop.** One chapter at a time, each in its own subagent (see *Budget*); the main conversation stays the coordinator. Commit per unit if the user agrees.-6. **Finish the book.** Contents page with a sketch per unit, cover text, bookshelf entry, whole-book `check_blank.py` and all tests. Deploy only when asked. See `references/site.md`.+1. **Intake.** Choose a slug; create `books/<book>/BOOK.md` from the template. Record readers, tone, primary language, scope, assets/guide and publishing destination. Ask for missing decisions together, with defaults.+2. **Split.** Run `uv run --with pymupdf SKILL/scripts/outline.py books/<book>/book.pdf`; use `--level N -o books/<book>/sections.json` at chapter depth. For a PDF without bookmarks, inspect `split_pages.py … --pages 1-12 --out books/<book>/pages`, then write the map from its contents (schema: `outline.py --help`). Match the map to the contents; extract chapter text with `split_pages.py … --sections books/<book>/sections.json --out books/<book>/pages --text-only`.+3. **Book map.** Read contents and chapter openings; inspect more text where the scope is unclear. Create `chapters.md` with columns `# | Title | Unit | Minutes | Status` (planned, ready, user-approved); put colours and candidate recurring visual models in BOOK.md. Confirm the list and visual approach with the user.+4. **Initialize.** Follow [site.md](references/site.md#start-a-book-folder) to copy the book engine, cover/contents and chapter skeleton before making the pilot.+5. **Pilot.** Make chapter 1 through the chapter loop. Deliver it for the user's review and record approved conventions in BOOK.md. Implement helpers as needed; share one when another chapter uses it.+6. **Remaining chapters and finish.** Produce chapters sequentially (see *Context*). Complete cover text, unit sketches and bookshelf navigation using [site.md](references/site.md). Deliver the book and any unresolved issues for human review; reuse each chapter's delivery results. Commit or deploy within the user's authorization.## Chapter loop-1. **Read** `book_pages/chNN/text.md`; open a page image only where a diagram matters. Note concepts, worked examples, exercises and answers. **Recompute every answer**: reference books have errors. Fix them in your version and log them in BOOK.md.-2. **Storyboard**: a short beat list — what each beat shows, why it is true, where the quick checks go. → `references/authoring.md`-3. **Narration**: write `content/chNN/narration.en.json` (template in `SKILL/assets/templates/`), then `uv run --with edge-tts SKILL/scripts/tts.py content/chNN/narration.en.json site/<book>/chNN/audio/en`. Only changed beats are re-synthesized.-4. **Beats**: write `site/<book>/chNN/index.html` from the template or the closest finished chapter. API → `references/engine.md`.-5. **Review**: `SKILL/scripts/shot.py chNN --url …` and read the contact sheets; then `SKILL/scripts/check_blank.py site/<book> chNN --url …` must print nothing. → `references/review.md`-6. **Test**: `tools/e2e_chNN.py` from the template: every question wrong then right, one Show answer, the finish card, every beat rebuilt; no console errors.-7. **Register**: add the chapter to `UNITS` in the book's index.html, set the previous chapter's `CHAPTER.next`, update BOOK.md (status, errata, new conventions).+1. **Read** this chapter's `pages/chNN/text.md`; render its pages with `split_pages.py … --only chNN` when diagrams or missing text need images. Select the ideas and examples to teach.+2. **Storyboard** in `chapters/chNN.md`: beat list, visual changes, narration triggers and questions. Use [authoring.md](references/authoring.md) for content conventions; verify the examples and answers used in the finished chapter.+3. **Narration**: write `content/<book>/chNN/narration.<lang>.json`, then `uv run --with edge-tts SKILL/scripts/tts.py content/<book>/chNN/narration.<lang>.json site/<book>/chNN/audio/<lang>`.+4. **Beats**: implement the storyboard in `site/<book>/chNN/index.html`; API and replay invariants are in [engine.md](references/engine.md). Use the book's approved look and interactions.+5. **Delivery pass**: follow [review.md](references/review.md) once for loading, opening blanks, overlap/cropping, text density and colour consistency. Correct clear defects locally, recheck the affected part, then deliver; report unresolved problems. The user reviews overall aesthetics, pacing and teaching effectiveness.+6. **Register**: add the ready chapter to `UNITS`, set the previous chapter's `CHAPTER.next`, update its row in `chapters.md` and notes in `chapters/chNN.md`. Promote new shared decisions to BOOK.md. The coordinator owns this step when using subagents.-## Non-negotiables+## Context-- **Original work.** Never copy the book's wording, examples or page images; rewrite and redraw. Book pages and the PDF are never published.-- **Correct over faithful.** Facts and answers are verified, not trusted; tell the user what you corrected.-- **Picture and voice agree.** Every action is timed by a narration mark (`m('mark')`), never by guessed seconds. The picture is never empty while the narration speaks.-- **The picture teaches.** On-screen text is the key formula or phrase, placed beside what it describes, not a transcript. Captions (CC) exist but are optional.-- **Questions.** Only on what was just taught; never two question beats in a row (except the final practice); every question can be played by keyboard; a wrong answer gets feedback about that specific mistake and a Show answer; a right answer animates the object it is about. Grade the meaning (equivalent forms, any order where order does not matter).-- **One picture.** Everything happens inside the 16:9 stage; no paper-and-pencil tasks.-- **Deterministic beats.** A beat's `run` only schedules tweens: seeking rebuilds the scene by replaying earlier beats, so no timers, randomness or clock reads in `run`.-- **Engine change → rerun every chapter's test.** Each book has its own engine copy; improve `SKILL/assets/engine/` too when a change is general.-- **Publishing, pushing and deploying only when the user asks.**--## Creative freedom--The process is fixed; the design is yours. For each idea pick the visual argument that makes it obvious — rearrange, split, morph, balance, slide, count, compare — and invent scenes, helpers, question types and motion as the content needs. The templates are skeletons, not styles to copy; don't reuse an old chapter's choreography unless it truly fits. Judge every animation by one question: does watching it show *why*? Once the pilot is approved, keep the book consistent: palette, type, character, controls, question feel.--## Budget--A book is long; spend tokens on design, not on re-reading.--- **One subagent per chapter.** After the pilot, the main conversation only coordinates: it starts one subagent (Agent tool) per chapter, sequentially, with a short brief — chapter number, book folder, "follow SKILL.md and BOOK.md Conventions", anything the user asked for. The subagent runs the chapter loop through step 6 and replies in a few lines: files changed, tests and blank check passed or not, book errors found, new helpers or conventions. The main conversation then registers the chapter (step 7), updates BOOK.md, runs the regression if the engine changed, and asks the user only when something needs a decision. Don't run chapters in parallel: they share the engine, the contents page and the screenshot browser. The pilot stays in the main conversation, where the user can steer.-- **State lives in files.** Anything a later chapter needs goes into BOOK.md or `references/`, never only into conversation memory.-- **Text before images**: read `text.md`; open a page image only for a diagram.-- **Don't read engine.js**; use `references/engine.md` and grep for one function when needed.-- **Screenshots as sheets**: read the 4-up contact sheets from `shot.py` (open and end frames first), single shots only where a sheet shows a problem. Don't re-screenshot what a test already proves.-- **Write a page in one pass**, fix with small edits, and don't re-read a file you just wrote.-- **Short output**: the scripts print summaries; pipe long output through `tail`.-- **Regression only after engine changes**, run in the background.--## References--- `references/authoring.md` — chapter shape, storyboard, narration and marks, questions and practice, content rules.-- `references/engine.md` — the engine: stage, drawing, timing, question types, player; the known traps.-- `references/review.md` — screenshots, what to look for, blank check, end-to-end tests, regression.-- `references/site.md` — starting a book folder, cover and contents, unit sketches, guide character, bookshelf, deploying.+- Keep the pilot in the main conversation. Afterwards, use one fresh subagent per chapter sequentially when available; otherwise use the same chapter loop in the current agent with file-based state.+- Brief with chapter number, relevant map row, book/source/output paths, Skill path and current user requests. Pass these instead of full conversation history where the host supports fresh context. Worker reads BOOK.md and its chapter notes, completes steps 1–5, and returns files, delivery result, errata and new helpers/decisions in a few lines. Coordinator registers it.+- Read only the reference needed for the current step. Use the engine API and inspect individual functions when needed; copy assets rather than reading their full source as instructions.+- Keep BOOK.md to current conventions and the helper index. Chapter status, errata and historical feedback stay in their own files; read only relevant entries.+- Write from the storyboard in one pass. Use contact sheets and short command summaries; retain failure details. Run targeted interaction tests when the engine or grading changes, as described in review.md.diff --git a/.claude/skills/animebook/assets/engine/engine.js b/.claude/skills/animebook/assets/engine/engine.jsindex 681ed5e..538e56e 100644--- a/.claude/skills/animebook/assets/engine/engine.js+++ b/.claude/skills/animebook/assets/engine/engine.js@@ -1475,7 +1475,7 @@ function start(i, play) {Object.assign(P, { i, t: 0, waiting: false, done: false, afail: false, stall: 0 });P.end = runBeat(i);evalTo(0);- const a = P.audio = new Audio(`audio/en/${BEATS[i].id}.mp3`);+ const a = P.audio = new Audio(`audio/${CHAPTER.language || 'en'}/${BEATS[i].id}.mp3`);a.preload = 'auto';a.onerror = () => { if (P.audio === a) soundFailed(); };const b = BEATS[i];@@ -1608,9 +1608,10 @@ fit();// Start the lesson once the chapter page has defined CHAPTER and BEATS.// ?beat=N&t=S opens a paused frame, for reviewing a single moment.-// Per-browser progress shared with the contents page: last chapter opened, chapters finished.+// Per-book progress shared with the cover/contents at the parent URL folder.+const BOOK_PROGRESS_KEY = 'animebook:progress:' + new URL('../', location.href).pathname;function progress(f) {- try { const p = JSON.parse(localStorage.getItem('progress') || '{}'); f(p); localStorage.setItem('progress', JSON.stringify(p)); } catch {}+ try { const p = JSON.parse(localStorage.getItem(BOOK_PROGRESS_KEY) || '{}'); f(p); localStorage.setItem(BOOK_PROGRESS_KEY, JSON.stringify(p)); } catch {}}function boot() {$('coverK').textContent = `Chapter ${CHAPTER.number}`;diff --git a/.claude/skills/animebook/assets/templates/BOOK.md b/.claude/skills/animebook/assets/templates/BOOK.mdindex d18c62f..b07cf5a 100644--- a/.claude/skills/animebook/assets/templates/BOOK.md+++ b/.claude/skills/animebook/assets/templates/BOOK.md@@ -1,10 +1,11 @@# <Book title> — book plan-The working memory of this book. Every session starts by reading it; update it whenever something is decided.+Read this compact current state for chapter work. The chapter map/status lives in `chapters.md`; storyboards, errata and feedback live in `chapters/chNN.md`.## Intake- Readers: … · Tone: … · Narration language: … · Guide character: … · Publish to: …-- Source: `book.pdf`, N pages, N chapters in N units (`sections.json`).+- Slug: … · Primary language code: … · Asset approach: code/SVG by default, or agreed assets.+- Source: `book.pdf` · Page map: `sections.json` · N pages, N chapters in N units.## Conventions (approved in the pilot; later chapters follow them)- Look: palette, fonts, how a new idea enters, how steps are laid out …@@ -12,16 +13,8 @@ The working memory of this book. Every session starts by reading it; update it w- Questions: placement, typical types, feedback style …- Subject conventions (definitions, notation, rounding) …-## Recurring visual models → engine helpers-- … (which chapters use it, helper name once built)+## Visual models / available helpers+- … (candidate model, chapters using it, helper name and file once implemented)-## Chapters-| # | Title | Unit | Status | Book errors fixed |-| --- | --- | --- | --- | --- |-| 1 | … | 1 | planned / draft / reviewed / approved | … |--## User feedback and decisions (dated)-- YYYY-MM-DD: …--## Releases-- YYYY-MM-DD commit … deployment …+## Current decisions+- … (fold approved changes into conventions above; chapter feedback stays with its chapter)diff --git a/.claude/skills/animebook/assets/templates/book.html b/.claude/skills/animebook/assets/templates/book.htmlindex fd2efa2..9804927 100644--- a/.claude/skills/animebook/assets/templates/book.html+++ b/.claude/skills/animebook/assets/templates/book.html@@ -226,7 +226,8 @@ const UNITS = [ // [unit title, [[chapter title, minutes], ...]]; chapters areconst HUES = ['#f4a48c', '#86c9e8', '#f3c95c', '#e8a0c8', '#8fd6b0', '#bba8ee', '#f0b45a'];const id = n => 'ch' + String(n).padStart(2, '0');let P = {};-try { P = JSON.parse(localStorage.getItem('progress') || '{}'); } catch {}+const BOOK_PROGRESS_KEY = 'animebook:progress:' + new URL('.', location.href).pathname;+try { P = JSON.parse(localStorage.getItem(BOOK_PROGRESS_KEY) || '{}'); } catch {}const done = new Set(P.done || []);// Contents.diff --git a/.claude/skills/animebook/assets/templates/chapter.html b/.claude/skills/animebook/assets/templates/chapter.htmlindex c5f9d4a..5411e57 100644--- a/.claude/skills/animebook/assets/templates/chapter.html+++ b/.claude/skills/animebook/assets/templates/chapter.html@@ -14,7 +14,7 @@'use strict';// A starting skeleton, not a design. Replace every beat; keep the shape: intro, lesson beats with// quick checks between them, a summary, full-screen practice, finish. Beat ids match narration.en.json.-const CHAPTER = { number: 1, title: 'CHAPTER TITLE', minutes: 8 }; // set next: '../chNN/' once the next chapter exists+const CHAPTER = { number: 1, title: 'CHAPTER TITLE', minutes: 8, language: 'en' }; // match the audio folder; set next once the next chapter exists/* ---------- chapter drawing helpers ---------- */const mline = (p, parts, x, y, t0, fill = COL.chalk, size = 48, anchor = 'middle') => { const e = M(p, [].concat(parts), { x, y, size, fill, anchor, o: 0 }); show(e, t0); return e; };diff --git a/.claude/skills/animebook/assets/templates/e2e.py b/.claude/skills/animebook/assets/templates/e2e.pyindex 2b294b4..ba6f824 100644--- a/.claude/skills/animebook/assets/templates/e2e.py+++ b/.claude/skills/animebook/assets/templates/e2e.py@@ -1,9 +1,9 @@-"""Keyboard-only walk through chapter NN: each question answered wrong, right, and once via Show answer.+"""Optional interaction-test example; adapt the cases to the behavior being changed.python3 -m http.server 8765 -d site &- uv run --with playwright tools/e2e_chNN.py+ URL=http://localhost:8765/BOOK/chNN/ uv run --with playwright tools/BOOK/e2e_chNN.py-Beat numbers follow BEATS in the chapter page. Rerun every chapter's test after an engine change.+Beat numbers follow BEATS in the chapter page. Run relevant existing cases after engine changes."""import asyncio, osfrom playwright.async_api import async_playwrightdiff --git a/.claude/skills/animebook/references/authoring.md b/.claude/skills/animebook/references/authoring.mdindex c57588e..85ad664 100644--- a/.claude/skills/animebook/references/authoring.md+++ b/.claude/skills/animebook/references/authoring.md@@ -2,15 +2,15 @@## Shape-A chapter runs about 5–11 minutes: 10–20 beats, each 5–40 seconds of narration.+The algebra book used roughly 5–11 minute chapters and 5–40 second beats. Let the content determine length and the number of checks/practice sets.| Beat | Purpose || --- | --- || `intro` | Title card (unit and chapter number, title, one line of purpose). || lesson beats | One idea each, built up in the picture while the narration explains it. |-| `q1`, `q2`, … | A quick check after every one to three lesson beats, inside the picture. |+| `q1`, `q2`, … | A check of already taught content, separated from the next check by a lesson beat. || `wrap` | Three or four numbered takeaways. |-| `final1` … | Two to four full-screen practice sets labelled "Chapter practice N of M", covering the whole chapter. |+| `final1` … | Consecutive full-screen practice sets labelled "Chapter practice N of M", covering the whole chapter. || `finish` | Score card (`finishCard`): first-try results for quick checks and practice. |Beat ids are shared by the page (`BEATS`) and the narration file; a beat with `ask` waits for the answers before moving on.@@ -36,7 +36,7 @@ Principles that held up over a whole book:## Narration-`content/chNN/narration.en.json`:+`content/<book>/chNN/narration.<lang>.json` (English example):```json{ "voice": "en-US-AndrewMultilingualNeural", "rate": "-4%",@@ -47,7 +47,7 @@ Principles that held up over a whole book:- Write for the ear: short sentences, one idea each. Say math in words ("negative seven halves", "x squared"); the picture shows the symbols.- Match the audience: plain, warm, never childish. Explain why, not only how.- Question beats get one short line ("Quick check. Find the mean."); the card holds the question.-- `tts.py` caches word timings and only re-synthesizes beats whose text or voice changed. It writes `audio/en/<beat>.mp3` and `timings.js` (duration, mark times, one caption cue per sentence). Edge TTS needs network access.+- `tts.py` caches word timings beside the script; the output folder receives `<beat>.mp3` and `timings.js` (duration, marks, sentence captions).## Questions@@ -72,6 +72,5 @@ New types are welcome when the content calls for one; each needs keyboard play (## Content rules-- Rewrite everything in your own words with your own examples and numbers; keep the book's topics and order unless the user decides otherwise.-- Recompute every worked example and every answer key entry. Wrong statements, wrong answers and ambiguous exercises are common; fix or drop them, and log each in BOOK.md (chapter, what was wrong, what you did).-- Keep one consistent set of conventions (definitions, notation, rounding) for the whole book and record them in BOOK.md.+- Follow the agreed chapter scope and order. Verify facts, calculations and answers actually used in the finished lesson; correct or replace source errors and note them in `books/<book>/chapters/chNN.md` for the user.+- Use BOOK.md's definitions, notation and rounding conventions. Record new shared decisions there.diff --git a/.claude/skills/animebook/references/engine.md b/.claude/skills/animebook/references/engine.mdindex d835f94..972b635 100644--- a/.claude/skills/animebook/references/engine.md+++ b/.claude/skills/animebook/references/engine.md@@ -1,8 +1,8 @@# The engine (lib/engine.js, lib/engine.css)-A chapter page loads the engine and its `audio/en/timings.js`, defines `CHAPTER`, its own small drawing helpers, `BEATS` and question data, then calls `boot()`. The engine provides the stage, drawing, a timeline, question types, the guide character and the player. If a name below disagrees with the code, the code wins; fix this file.+A chapter page loads the engine and its `audio/<lang>/timings.js`, defines `CHAPTER` (including `language` when different from `en`), drawing helpers, `BEATS` and questions, then calls `boot()`. The engine provides the stage, drawing, timeline, question types, guide and player. Use the code's signatures if they differ from this reference.-Many helpers are mathematical (number lines, planes, tiles) because the first book was algebra. Use what fits; for other subjects write new helpers in the chapter page, and move one into the engine the second time it is needed — not earlier.+Many helpers are mathematical because the first book was algebra. Use those that fit, implement new ones in the chapter as needed, and share them in the book's engine when another chapter uses them.## Stage and state@@ -41,11 +41,11 @@ Topic helpers already in the engine: number lines (`numberLine`, `X(v)`, `Y0`, `}, { ask: done => quiz(BAND, [/* questions */], done) }], // optional: a question beat```-- `m('name', offset)` is the start time of the word after `[[name]]`; `D` is the clip's length. Never hard-code seconds that should follow the voice.+- `m('name', offset)` is the start time of the word after `[[name]]`; `D` is the clip's length. Use marks for actions tied to speech; scene entrances and transitions can use fixed offsets.- Tweens: `tw(e, to, t0, dur, ease)`, `prog(q => …, t0, dur, ease)` for custom motion (arcs, counters, live redraws), `show`, `hide`, `draw`, `pop`, `pulse`, `stream`. Eases: `io`, `out`, `back`, `lin`.- A lesson beat ends after its narration and its last tween, then the next starts; an `ask` beat waits for `done()`.- **Opening lead-in**: if a beat calls `panel()` (before 0.5 s) and nothing appears within 0.8 s, `runBeat` moves the opening group (every tween starting within 1.2 s of the first reveal) to start at 0.4 s. Opt out with `{ lead: false }` in the beat's fourth slot.-- **Seeking replays**: jumping to beat N rebuilds the scene and runs every earlier beat's `run` instantly. So `run` may only schedule tweens — no `setTimeout`, `Math.random`, `Date`, or reading the current state to decide what to draw. Interactive elements are created only inside `ask`.+- **Seeking replays**: jumping to beat N rebuilds the scene and runs earlier beats instantly. Make `run` deterministic: create objects and schedule tweens through the timeline, with inputs from chapter data and replayed `S` state. Create interactions inside `ask`; use `fx`/`fxp` for answer effects.- Constants used in a `BEATS` literal are evaluated when it is defined, so define them above `BEATS`. Data used only inside an `ask` closure may sit below.## Questions@@ -67,13 +67,15 @@ quiz(position, [{ id: 'c-mean', prompt: ['Find the mean of ', $m('7, 3, 9'), '.'Space play/pause, ←/→ previous/next beat (Shift+←/→ during a question), Home restart, C captions, F full screen, ? help. `seek(i, play)` rebuilds and jumps; `start(i, play)` begins a beat from the current picture. While audio plays, the beat clock follows `audio.currentTime`. `?beat=N&t=S` in the URL opens a frozen frame for review. The finish card's Enter opens `CHAPTER.next`, R replays.+Progress uses `animebook:progress:<book-path>`; the cover template reads the same key. Books served in different folders have separate saved places and completion lists.+Keep `<link rel="expect" href="#bar" blocking="render">` in every chapter's head; without it Chromium may paint before the player exists and cancel the page transition from the contents page.## Traps- `M()` italicises 1–2 letter lowercase runs (variables) and runs of capitals, but keeps common short English words upright (by, my, an, if, in, is, of, or, …; capitalised: By, If, In, …). In maths write `by`, `my`, `an`, `By` to keep them italic. Units inside `M()` turn italic too: write them as words in `T()` text ("meters"). Never put an English sentence in `M()`.- Prompts, `grid` text rows and `choice` options are HTML: plain strings render as text, so wrap math in `$m(...)`.-- Don't redeclare an engine name with `const` in a chapter (`rect`, `popIn`, `eqLine`, `fit`, `slot`, `Y0`, …): the page script dies and the stage stays empty. After writing a page, load `?beat=0` and check the console first.+- Prefix chapter-specific helpers when their names might collide with engine globals (`rect`, `popIn`, `eqLine`, `fit`, `slot`, `Y0`, …); a redeclaration stops the page script.- Drag handling: re-parent (append) the element before `setPointerCapture`; moving a node drops its capture.- A card whose content is too long for `BAND` should become several `blanks` rows in a wider side card.- When a question beat is continued early, the engine finishes the beat's pending tweens first; don't rely on half-finished fades.diff --git a/.claude/skills/animebook/references/review.md b/.claude/skills/animebook/references/review.mdindex 2f6c11b..5e01d3b 100644--- a/.claude/skills/animebook/references/review.md+++ b/.claude/skills/animebook/references/review.md@@ -1,53 +1,32 @@-# Review and tests+# Delivery pass-Serve the site first (audio needs HTTP): `python3 -m http.server 8765 -d site`. For a book in `site/<book>/`, pass `--url http://localhost:8765/<book>/` to the scripts. Python's server has no Range requests, so setting `audio.currentTime` jumps back to the start; tests let audio play or use `seek()`.+Serve `site/` over HTTP. Use this pass once per chapter; inspect relevant frames, fix clear defects locally and recheck those parts. Deliver for the user's assessment of overall aesthetics, pacing and teaching effectiveness.-## 1. Load check--Open `…/chNN/index.html?beat=0&t=0` (or run `shot.py` with one spec). Any console error usually means a redeclared engine name, a missing mark, or a constant used in `BEATS` before it is defined.--## 2. Screenshots+## Frames and opening blanks```sh-uv run --with playwright --with pillow SKILL/scripts/shot.py chNN --url … --out /tmp/shots+uv run --with playwright --with pillow SKILL/scripts/shot.py chNN --url http://localhost:8765/<book>/ --out /tmp/animebook-<book>+uv run --with playwright SKILL/scripts/check_blank.py site/<book> chNN --url http://localhost:8765/<book>/```-Every beat at 1.2 s (`open`), middle and end, saved as 4-up contact sheets `chNN_sheet_{open,mid,end}_K.png`. Read the `open` and `end` sheets; look at `mid` or a single shot only to chase a problem; use `shot.py chNN 5:7.5` for a specific moment. One browser at a time, and pick times after fades finish.+`shot.py` captures open/end frames as 4-up sheets and reports console errors. Read the sheets once; use `shot.py chNN 5:7.5` for a specific transition or correction. Add `--moments mid` when intermediate geometry needs a frame. Run one screenshot browser at a time.-Look for:+Make a brief judgment of:- the picture empty or unrelated at `open`;- text over drawings, labels colliding, anything clipped or off the stage;- a question card covering the object it asks about;- leftovers from the previous beat, half faded;-- wrong mathematics in the drawing: points off their values, unequal spacing, an area not matching its label;+- geometry contradicting the intended values, spacing or area;- text too small to read at half size, or too much text at once;- inconsistent colours for the same idea.-## 3. Opening blanks--```sh-uv run --with playwright SKILL/scripts/check_blank.py site/<book> chNN --url …-```--No output means no beat leaves the picture empty for more than 1 s after the narration starts (`LIMIT=0.6` for stricter). Fix the beat's opening, don't raise the limit.+The blank check reports openings empty for more than 1 second after speech starts (`LIMIT=0.6` for a stricter pass). Resolve reported openings in the beat. Preserve ordinary transitions and thinking pauses.-## 4. End-to-end test+Report the delivery result and any unresolved defects in a few lines. A new visual redesign starts with user feedback.-Copy `SKILL/assets/templates/e2e.py` to `tools/e2e_chNN.py` and fill in the chapter's questions: each answered wrong then right (first-try score 0), at least one Show answer, the finish card, R back to the start, then `seek` through every beat; no console errors. Run `uv run --with playwright tools/e2e_chNN.py` (set `URL` for a book folder).+## Targeted interaction tests-- Keyboard only (plus one mouse pass for drag questions).-- With focus in an answer box only Enter and Esc are handled; press Esc before S (Show answer).-- Playwright's `text=Check` matches case-insensitively and by substring ("Quick check"); buttons include their key label ("1Rational"). Use CSS classes or indexes.-- A multi-row `blanks`/`grid` question scores one per row.-- Enter on the finish card opens the next chapter; use R in tests.--## 5. Regression--After any engine change, run every chapter's test (in the background, two at a time):--```sh-ls tools/e2e_ch*.py | xargs -P 2 -I{} sh -c 'uv run -q --with playwright {} >/dev/null 2>&1 || echo "FAIL {}"'-```+For changes to playback, question types or grading, run existing tests that exercise the changed behavior. If needed, adapt `assets/templates/e2e.py` into `tools/<book>/e2e_chNN.py`; set `URL` to the actual chapter URL. Check the relevant wrong/right feedback, Show answer and continuation, or pause/replay/seek behavior. Shared timing/replay changes warrant the whole book's blank check and existing affected tests; ordinary new chapters use the delivery pass above.-Also rerun `check_blank.py` for the whole book when timing logic changes.+Test details: keyboard first, plus mouse for changed drag handling; Enter checks and Esc leaves answer boxes; press Esc before S. Multi-row questions score per row. Use R on the finish card (Enter opens the next chapter). Python's server lacks Range requests, so let audio play naturally instead of setting `audio.currentTime`.diff --git a/.claude/skills/animebook/references/site.md b/.claude/skills/animebook/references/site.mdindex 3790b5a..5223e7b 100644--- a/.claude/skills/animebook/references/site.md+++ b/.claude/skills/animebook/references/site.md@@ -4,18 +4,25 @@ The site is static: HTML, JS, CSS, MP3. No build step, backend, database or acco## Start a book folder+Set `SKILL` to the installed skill folder. Run once for a new slug; use an existing book's actual files when resuming:+```sh-B=site/<book-slug>-mkdir -p $B/lib $B/ch01 content/ch01 tools-cp SKILL/assets/engine/engine.js SKILL/assets/engine/engine.css $B/lib/-cp SKILL/assets/templates/book.html $B/index.html-cp SKILL/assets/templates/unit-art.js $B/unit-art.js-cp SKILL/assets/templates/chapter.html $B/ch01/index.html-cp SKILL/assets/templates/narration.en.json content/ch01/-cp SKILL/assets/templates/e2e.py tools/e2e_ch01.py+BOOK_ID=history+BOOK_SITE="site/$BOOK_ID"+BOOK_WORK="books/$BOOK_ID"+mkdir -p "$BOOK_SITE/lib" "$BOOK_SITE/ch01" "$BOOK_WORK/chapters" "content/$BOOK_ID/ch01" "tools/$BOOK_ID"+cp "$SKILL/assets/engine/engine.js" "$SKILL/assets/engine/engine.css" "$BOOK_SITE/lib/"+cp "$SKILL/assets/templates/book.html" "$BOOK_SITE/index.html"+cp "$SKILL/assets/templates/unit-art.js" "$BOOK_SITE/unit-art.js"+cp "$SKILL/assets/templates/chapter.html" "$BOOK_SITE/ch01/index.html"+cp "$SKILL/assets/templates/narration.en.json" "content/$BOOK_ID/ch01/narration.en.json"```-Each book keeps its own engine copy, so improving one book never breaks another. A chapter links back to `../` (the book's index) and the index links back to `../` (the bookshelf). With no bookshelf yet, either add `site/index.html` that simply redirects to the book (`<meta http-equiv="refresh" content="0; url=<book-slug>/">`) or delete the two `back-shelf` links from the book's index.+Use the agreed primary language: rename the narration source, load `audio/<lang>/timings.js`, and set `CHAPTER.language` to match (default `en`). Choose the voice and translate the template's visible UI text as needed before the pilot.++Each book has its own engine, source materials, narration and optional tests. The engine and cover derive the same progress key from the book's URL folder. Keep existing books on their current paths; their legacy progress remains intact.++A chapter returns to its book's index; the cover/contents returns to the bookshelf. With no bookshelf yet, create a minimal `site/index.html` linking to the book's cover. When adding a bookshelf, use underlined text and a small arrow for the entry; preserve cover → contents → chapter navigation.## Cover and contents (`index.html`)@@ -27,11 +34,11 @@ One page: no hash or `#book` shows the cover, `#contents` or `#chNN` the content## Unit sketches (`unit-art.js`)-Each unit header is a strip of chalkboard with a small drawing of that unit's ideas in the unit colour. It draws itself the first time the unit scrolls into view, then keeps one gentle loop that fits the topic (two terms swapping places, a dot hopping along a line, a balance tilting, a spinner turning). Draw from the book's own content — a timeline for a history unit, a map, a family tree, a key quotation — with paths and text only. Keep the left third light (the title sits there on phones); test at 1440 px and 390 px wide; motion stops under `prefers-reduced-motion`. The classes and loop examples are documented at the top of `unit-art.js` and in the `.unit-art` CSS of `index.html`.+Give each unit a small sketch of its own ideas, drawn in the unit colour, with one gentle topic-related loop. Use the agreed asset approach. Keep the left third light for the title on phones; check the finished contents at 1440 px and 390 px once. The template handles reduced motion; classes and loop examples are in `unit-art.js` and the `.unit-art` CSS.## Guide character-The engine's `mascotEl` draws the guide shown on question cards and the score card (and the cover uses the same drawing). The first book used an infinity sign whose loops are eyes. For a new book, draw a simple SVG character that suits it, in `mascotEl` and in the cover script, with the same moods (blink, hop when right, tilt when wrong). Never use a famous or branded character.+Keep the existing infinity guide by default. For an agreed custom guide, adapt `mascotEl` and the cover drawing together, retaining blink, happy hop and wrong-answer tilt states.## Bookshelf@@ -43,17 +50,17 @@ The engine's `mascotEl` draws the guide shown on question cards and the score caartwork: '<svg viewBox="0 0 260 175" class="book-art">…</svg>', features: ['…', '…', '…'] }```-Only list books that are published; never placeholders.+List ready books. Folder-based entries use their own counts and artwork; their saved place is available on the book cover.## Publishing-Only when the user asks. Any static host works; for Cloudflare Pages:+Use the user's publishing authorization. Any static host works; for Cloudflare Pages:```shnpx wrangler pages deploy site --project-name <project> --branch main --commit-hash $(git rev-parse --short HEAD)```-Commit first, deploy the committed state, then confirm the live URL serves the new files (`curl` a changed file with a cache-busting query) and record the deployment id in BOOK.md. Never publish the PDF, `book_pages/` or tools; they live outside `site/`.+Commit first, deploy the committed state, then confirm the live URL serves a changed file with a cache-busting query. Record commit, URL and deployment id in `books/<book>/releases.md`. Publish only `site/`.## Languagesdiff --git a/.claude/skills/animebook/scripts/outline.py b/.claude/skills/animebook/scripts/outline.pyindex 5dbe049..3855d3f 100644--- a/.claude/skills/animebook/scripts/outline.py+++ b/.claude/skills/animebook/scripts/outline.py@@ -12,9 +12,11 @@ page where the chapter itself begins. Pages before the first chapter becomeEvery PDF page lands in exactly one section, numbered by PDF page order (from 1),not by printed page numbers.-Without bookmarks, nothing is guessed: read the contents pages (render them with-split_pages.py --only 00_front) and write sections.json by hand in the same format.-Always check the result against the book before rendering pages.+Without bookmarks, render the contents using split_pages.py book.pdf --pages 1-12,+then write sections.json from those pages. Its JSON array covers every PDF page once:+[{"folder":"00_front","title":"Front matter","start":1,"end":12},+ {"folder":"ch01","title":"Chapter title","start":13,"end":40,"unit":"Part one"}, ...]+Adjust boundaries to the actual PDF; start/end are inclusive PDF page numbers."""import argparseimport json@@ -34,7 +36,7 @@ def main():toc = doc.get_toc() # [level, title, page]n = len(doc)if not toc:- sys.exit("No bookmarks in this PDF. Write sections.json by hand from the contents pages.")+ sys.exit("No bookmarks. Render contents with split_pages.py book.pdf --pages 1-12, then write sections.json from them.")if a.level is None:for lv, title, page in toc:print(f"{' ' * (lv - 1)}[{lv}] p{page} {title}")diff --git a/.claude/skills/animebook/scripts/shot.py b/.claude/skills/animebook/scripts/shot.pyindex 38a0d1c..8dd135e 100644--- a/.claude/skills/animebook/scripts/shot.py+++ b/.claude/skills/animebook/scripts/shot.py@@ -1,7 +1,8 @@#!/usr/bin/env python3"""Screenshot beats of a chapter for review, plus contact sheets of four shots each.- uv run --with playwright --with pillow shot.py ch07 # every beat at 1.2 s, middle and end+ uv run --with playwright --with pillow shot.py ch07 # every beat at 1.2 s (open) and its end+ uv run --with playwright --with pillow shot.py ch07 --moments mid # add the middle of every beatuv run --with playwright --with pillow shot.py ch07 3:end 5:4.5 6:mid # chosen moments (seconds, mid, end)... --url http://localhost:8765/history/ --out /tmp/shots@@ -10,6 +11,7 @@ Uses ?beat=N&t=S, which seeks to the beat and freezes at that time. Run one browtime: parallel runs slow page loads and catch pictures half faded in."""import argparse, asyncio+import sysfrom pathlib import Pathfrom playwright.async_api import async_playwrightfrom PIL import Image@@ -26,10 +28,10 @@ async def main(a):base = f"{a.url}{a.chapter}/index.html"await pg.goto(base + "?beat=0&t=0"); await pg.wait_for_timeout(500)if errs:- print("page errors:", errs); return+ print("page errors:", errs); await b.close(); return 1n = await pg.evaluate("BEATS.length")durs = await pg.evaluate("BEATS.map(b => TIMINGS[b.id].dur)")- specs = a.specs or [f"{i}:{t}" for t in ("open", "mid", "end") for i in range(n)]+ specs = a.specs or [f"{i}:{t}" for t in ("open", "end", *a.moments) for i in range(n)]groups = {}for s in specs:i, t = s.split(":"); i = int(i)@@ -47,14 +49,16 @@ async def main(a):sheet.paste(Image.open(f).resize((800, 480)), ((j % 2) * 800, (j // 2) * 480))sheet.save(a.out / f"{a.chapter}_sheet_{t}_{k // 4}.png")print("errors:", sorted(set(errs))[:8] or "none", "| shots in", a.out)+ return 1 if errs else 0if __name__ == "__main__":ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)ap.add_argument("chapter")ap.add_argument("specs", nargs="*")+ ap.add_argument("--moments", nargs="*", default=[], choices=["mid"], help="extra moments for every beat")ap.add_argument("--url", default="http://localhost:8765/")ap.add_argument("--out", type=Path, default=Path("/tmp/animebook-shots"))a = ap.parse_args()a.url = a.url if a.url.endswith("/") else a.url + "/"- asyncio.run(main(a))+ sys.exit(asyncio.run(main(a)))diff --git a/.claude/skills/animebook/scripts/split_pages.py b/.claude/skills/animebook/scripts/split_pages.pyindex d661ad7..1ebb799 100644--- a/.claude/skills/animebook/scripts/split_pages.py+++ b/.claude/skills/animebook/scripts/split_pages.py@@ -1,10 +1,11 @@#!/usr/bin/env python3-"""Render every PDF page to PNG, one folder per section of sections.json.+"""Extract a book by its page map, or preview a page range before a map exists.uv run --with pymupdf split_pages.py book.pdf --sections sections.json --out book_pagesuv run --with pymupdf split_pages.py book.pdf --list # check the map onlyuv run --with pymupdf split_pages.py book.pdf --only ch05 # one sectionuv run --with pymupdf split_pages.py book.pdf --text-only # text layer only, no images+ uv run --with pymupdf split_pages.py book.pdf --pages 1-12 # preview/, no sections.json neededEach section folder also gets text.md: the PDF's own text layer, page by page. Read thatfirst; open a page image only for diagrams, layout or text the layer gets wrong (it is far@@ -17,6 +18,7 @@ never published with the site."""import argparseimport json+import refrom pathlib import Pathimport pymupdf@@ -32,20 +34,32 @@ def main():ap.add_argument("--only", nargs="*", help="render only these section folders")ap.add_argument("--overwrite", action="store_true")ap.add_argument("--text-only", action="store_true", help="write text.md files, skip the images")+ ap.add_argument("--pages", help="preview a page or inclusive range (e.g. 3 or 1-12), independently of the map")a = ap.parse_args()- sections = json.loads(a.sections.read_text(encoding="utf-8"))with pymupdf.open(a.pdf) as doc:- nxt, seen = 1, set()- for s in sections:- f, st, en = s["folder"], s["start"], s["end"]- if not f or "/" in f or "\\" in f or f in (".", "..") or f in seen:- ap.error(f"bad or repeated folder name: {f!r}")- if st != nxt or en < st or en > len(doc):- ap.error(f"pages must run on without gaps or overlaps: {f} ({st}-{en}), expected start {nxt}")- seen.add(f)- nxt = en + 1- if nxt != len(doc) + 1:- ap.error(f"the map ends at page {nxt - 1}; the PDF has {len(doc)} pages")+ if a.pages:+ match = re.fullmatch(r"(\d+)(?:-(\d+))?", a.pages)+ if not match:+ ap.error("--pages expects a page or range, e.g. 3 or 1-12")+ start, end = int(match[1]), int(match[2] or match[1])+ if not 1 <= start <= end <= len(doc):+ ap.error(f"--pages must be within 1-{len(doc)} in ascending order")+ if a.only:+ ap.error("use --pages for a preview or --only for mapped sections")+ sections = [{"folder": "preview", "title": f"Pages {start}-{end}", "start": start, "end": end}]+ else:+ sections = json.loads(a.sections.read_text(encoding="utf-8"))+ nxt, seen = 1, set()+ for s in sections:+ f, st, en = s["folder"], s["start"], s["end"]+ if not f or "/" in f or "\\" in f or f in (".", "..") or f in seen:+ ap.error(f"bad or repeated folder name: {f!r}")+ if st != nxt or en < st or en > len(doc):+ ap.error(f"pages must run on without gaps or overlaps: {f} ({st}-{en}), expected start {nxt}")+ seen.add(f)+ nxt = en + 1+ if nxt != len(doc) + 1:+ ap.error(f"the map ends at page {nxt - 1}; the PDF has {len(doc)} pages")print(f"{len(doc)} pages, {len(sections)} sections, {a.dpi} dpi")if a.list:for s in sections:@@ -70,7 +84,8 @@ def main():manifest = {"source": a.pdf.name, "page_count": len(doc), "dpi": a.dpi,"page_numbering": "PDF page order from 1, not printed page numbers","filename_pattern": "page_{pdf_page:04d}.png", "sections": sections}- (a.out / "manifest.json").write_text(json.dumps(manifest, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")+ manifest_dir = a.out / "preview" if a.pages else a.out+ (manifest_dir / "manifest.json").write_text(json.dumps(manifest, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")if __name__ == "__main__":diff --git a/CLAUDE.md b/CLAUDE.mdindex 85a80ad..1f5c9e1 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -57,11 +57,10 @@ AnimeBook/├── scripts/│ └── prepare_mascot.swift # 在 macOS 上生成透明 PNG 和 SVG 封装├── content/chNN/ # 每章英文讲稿 narration.en.json([[mark]] 标记动画触发词)及 tts 缓存-├── .claude/skills/animebook/ # 从一本 PDF 到互动动画书的完整流程(英文):拆书、规划、试点章、逐章制作、审阅测试、目录与发布;+├── .claude/skills/animebook/ # 从 PDF 到互动动画书的流程(英文):拆书、规划、初始化、试点、逐章制作、轻量交付检查、目录与发布;│ # scripts/(outline、split_pages、tts、shot、check_blank)、assets/(引擎与模板)、references/├── tools/-│ ├── tts.py # Edge TTS 生成 MP3、词级时间点与逐句字幕-│ └── e2e_chNN.py # 各章浏览器端到端检查(Playwright);改引擎后全部重跑+│ └── e2e_chNN.py # 当前数学书的浏览器端到端检查;播放器或判题变化时运行相关检查├── site/ # 可部署的静态站点(只部署此目录)│ ├── index.html # 书架、书封与章节目录(同一页,hash 切换;章节数据在 UNITS;localStorage 记进度)│ ├── lib/ # 共用引擎 engine.js / engine.css;书架数据与样式 bookshelf.js / bookshelf.css;目录页单元小图 unit-art.js@@ -104,14 +103,14 @@ SVG 将 PNG 以 data URL 嵌入,单个文件自包含;仍然是位图,放## 现有工具-制作工具都在技能 `.claude/skills/animebook/scripts/` 里(下面用 `$SKILL` 指这个目录)。查看章节分组、按章导出书页与文字层:+制作工具在技能 `.claude/skills/animebook/scripts/` 里(下面用 `$SKILL` 指技能根目录)。查看章节分组、按章导出书页与文字层:```shuv run --with pymupdf $SKILL/scripts/split_pages.py *.pdf --listuv run --with pymupdf $SKILL/scripts/split_pages.py *.pdf --text-only # 只导出每章 text.md(读书页先读它,省 token)```-已有图片通常可以直接使用,不必重复导出。本书的网站在 `site/` 根目录(书架也在这里);以后的新书放在 `site/<书名>/`,见技能的 `references/site.md`。改动 `site/lib/engine.*` 中通用的部分时,同步更新技能的 `assets/engine/`。+已有图片通常可以直接使用,不必重复导出。本书保持原路径;新书页面在 `site/<书名>/`,参考资料与当前约定在 `books/<书名>/`,讲稿和可选测试在 `content/<书名>/`、`tools/<书名>/`。初始化与进度隔离见技能 `references/site.md`。改动 `site/lib/engine.*` 中通用的部分时,同步更新技能的 `assets/engine/`。本地预览(音频需要 HTTP,不能双击打开):diff --git a/plan.md b/plan.mdindex 75300a7..7e300e8 100644--- a/plan.md+++ b/plan.md@@ -459,7 +459,9 @@最终 Skill 开源分享的方向已确认,不以盈利为目标。封装重点是让其他使用者也能制作有教学价值的动画课程;具体许可证和发布方式尚未确定。-技能第一版已完成(2026-10-03):`.claude/skills/animebook/`,英文,覆盖从一本 PDF 到完整互动书的全流程:入门询问、拆书(书签生成章节表、按章导出图片与文字层)、全书规划、试点章、逐章循环(读文字层→分镜→讲稿与语音→画面→截图审阅→留白检测→端到端测试→登记)、目录页与单元小图、书架与发布。脚本在 `scripts/`,引擎与模板(章节页、书本封面目录页、单元小图、讲稿、测试、BOOK.md)在 `assets/`,细节在 `references/`(authoring、engine、review、site)。原则:流程固定,设计与动画留给模型发挥;第一版只用代码绘图,不用外部图片;省 token(每章新上下文、先读文字层、截图看拼图、不读引擎源码)。新书放在 `site/<书名>/`,各自带一份引擎;书架 `bookshelf.js` 已支持这类条目。下一步由用户用该技能独立尝试第二本书,检验可复用性。+技能第一版位于 `.claude/skills/animebook/`(英文),已按用户确认的 review 方向整理:入门→拆书→章节规划→初始化→试点章→逐章制作→交付。每章读参考内容、写分镜与讲稿、生成语音、实现画面,做一次简短检查(加载、留白、重叠、裁切、文字密度、颜色一致性),局部修正明确问题后登记并交付;整体风格、节奏和教学效果由用户审阅。播放器、题型或判题逻辑变化时运行相关测试,普通新章沿用交付检查。共享 helper 按需要实现,另章复用时共享。代码/SVG 是默认素材方式,可按用户要求调整。++新书页面位于 `site/<书名>/`,制作资料在 `books/<书名>/`,讲稿和可选测试分别在 `content/<书名>/`、`tools/<书名>/`;引擎副本和浏览器进度按书隔离。当前数学书保持原路径。`BOOK.md` 只记录当前约定与 helper 索引,章节表和各章记录分开按需读取;有 subagent 能力时顺序制作,每次传短任务与必要路径。无书签 PDF 可先用 `split_pages.py --pages` 查看目录;截图默认仅开场与结束,中间帧按需增加。下一步由用户用第二本书检验制作质量、返工与实际模型费用。设计时区分三类资源:Skill 中的制作与检查规则,可随 Skill 提供的引擎、模板和工具,以及每本书各自的目录、内容、音频、进度与章节产物。网站可通过书架统一收录多本书。当前参考书的 PDF、书页图片和已生成课程不作为通用 Skill 的内置教材。教学与视觉经验应区分通用原则和本书约定,避免把固定章节数、知识点或数学约定套到其他教材上。