---
name: story-html-publisher
description: Final step of the AI Storybook pipeline. Consolidates the scenes, images, and per-scene audio into ONE self-contained HTML storybook — a swipe/tap player with every image and audio clip embedded as base64 so the single file works offline and can be shared as-is. Reads {slug}_scenes.json, {slug}_images.json, and {slug}_audio/, then writes {slug}_story.json and {slug}.html. Use this skill whenever the user wants to build the final storybook, export to HTML, package the story, make the storybook file, generate the HTML, or wrap up the pipeline. Trigger on phrases like "build the storybook HTML", "export to HTML", "make the final file", "package the storybook", "generate the storybook", "wrap up the pipeline", or whenever the scenes + images + audio all exist and the user wants the single shareable file. Produces a single self-contained .html (images + audio embedded).
title: story-html-publisher
canonical_url: https://skilld.dev/gh/hassancs91/claude-image-generation/story-html-publisher
last_updated: 2026-10-09T12:01:14.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [assets/build_html.py](https://skilld.dev/api/skills-raw/hassancs91/claude-image-generation/story-html-publisher/assets/build_html.py), [assets/player-template.html](https://skilld.dev/api/skills-raw/hassancs91/claude-image-generation/story-html-publisher/assets/player-template.html), [references/build-html.md](https://skilld.dev/api/skills-raw/hassancs91/claude-image-generation/story-html-publisher/references/build-html.md).
>
> If the user asked to install this Skill, run `npx skilld install hassancs91/claude-image-generation/story-html-publisher`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/story-html-publisher`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/hassancs91/claude-image-generation/story-html-publisher) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/story-html-publisher`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/story-html-publisher --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/story-html-publisher --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Story HTML Publisher

Takes everything the upstream skills produced and emits **one self-contained HTML storybook**: a swipe/tap player where each scene is one screen (illustration + narration text), with the playback controls in a fixed footer. It opens with a **dedicated cover page** — the first illustration shown clean, playing only the short spoken title. Every image and audio clip is embedded as a base64 data URI, so the single `.html` file works offline, opens with a double-click, and can be emailed or dropped on any static host with no assets folder.

This skill does **no creative work** — no new text, images, or audio. It only reads, validates, pairs, embeds, and writes. If something is missing upstream, it reports the gap rather than fabricating.

## When this skill applies

The pipeline's earlier skills have run and the user wants the final output: "build the storybook", "export to HTML", "make the final file", "wrap up the pipeline".

Does NOT apply to stories that haven't been through `scene-splitter` + `story-illustrator` + `story-narrator` — point the user to the missing step.

## Required inputs

In `stories/{slug}/`:

| Artifact | Producer | Path |
|---|---|---|
| Scenes spine | scene-splitter | `{slug}_scenes.json` |
| Image registry | story-illustrator | `{slug}_images.json` |
| Audio clips | story-narrator | `{slug}_audio/{slug}_part_NN.mp3` |
| Title clip (optional) | story-narrator | `{slug}_audio/title.mp3` |

Everything pairs by **scene index**: `scenes[i].index = N` → image from `images.json.shots[]` where `index = N` → audio `{slug}_part_NN.mp3`.

## Workflow — four stages with one hard gate

### Stage 1: Discover and validate

1. Determine the `slug` (user argument → the `*_scenes.json` in the working dir → ask).
2. Locate the three inputs. Confirm each scene has both an image (in `images.json`) and an audio file. Build a pairing table: index → text snippet → image present? → audio present?
3. **Reconstruction sanity check:** the scene count in `scenes.json` should match the number of `shots` in `images.json` and the number of `_part_NN.mp3` files.
4. Report findings:
   > Found 9 scenes, 9 images, 9 audio clips (+ title clip). All paired. Ready to build.
   If anything is missing, list the gaps. Don't proceed to build with gaps unless the user says "build partial" (the build script will embed what exists and leave placeholders for the rest).

### Stage 2: Build the HTML

Run the build script (preferred):

```bash
python .claude/skills/story-html-publisher/assets/build_html.py {slug}
```

It downloads/reads every image and audio file, embeds them as data URIs, injects them into [assets/player-template.html](https://skilld.dev/api/skills-raw/hassancs91/claude-image-generation/story-html-publisher/assets/player-template.html), and writes `stories/{slug}/{slug}_story.json` + `stories/{slug}/{slug}.html`. Read [references/build-html.md](https://skilld.dev/api/skills-raw/hassancs91/claude-image-generation/story-html-publisher/references/build-html.md) for what it does, options, and how to do it by hand if the script can't run.

On Windows use `python`; on macOS/Linux use `python3`. Stdlib only — no installs needed.

### Stage 3 — HARD GATE: review the storybook

Report:
1. Output path: `stories/{slug}/{slug}.html`, its size (MB), and scene count
2. Any warnings the build emitted (missing image/audio for a scene)
3. A one-liner: **"Open `stories/{slug}/{slug}.html` in your browser to read the finished storybook."**

Then prompt:

> **Storybook built — open it and review, then reply:**
> - `done` to finish
> - `rebuild` to regenerate the HTML (e.g. after swapping an image/audio file)
> - `fix image N` / `fix audio N` — if a scene's media is wrong, regenerate it upstream (illustrator/narrator), then `rebuild`

This is the final review surface — the user reads the actual storybook here. Don't declare success before they've had the chance to open it.

> ⚠️ The `.html` can be large (several MB) because media is embedded. It opens fine in a browser but may be slow to preview inside a chat/artifact viewer — tell the user to open it locally in a real browser.

### Stage 4: Finish

On `done`, confirm in one line: "Storybook ready: `stories/{slug}/{slug}.html` ({N} scenes, {size} MB). Fully self-contained — share or host it anywhere."

## What the finished storybook does

- A dedicated cover page (slide 0): the first illustration shown clean — no overlaid title text, no scrim, no glyph — with the title in the header. It plays the optional spoken title clip, then auto-advances into scene 1.
- One scene per screen after that: illustration + narration text, controls in a fixed footer
- Tap the image (or the footer play button) to play/pause the scene's narration. No play glyph is drawn on the image.
- Swipe (left = next, right = prev), arrow keys, on-screen buttons, or tap a progress dot to navigate
- Auto-play toggle: when a scene's narration ends, advance to the next scene. Every slide is uniform (one image, one clip, advance on `ended`) — no title→body audio chaining
- A "The End" screen with a "Read again" button at the finish
- Serif body text matching the serif title, LTR English, warm storybook styling, responsive (phone + desktop), no external dependencies

## What this skill does NOT do

- Does NOT generate new content (text/images/audio) — it only packages.
- Does NOT upload anywhere — local file output only. (The result is portable; the user can host it wherever.)
- Does NOT modify upstream artifacts.
- Does NOT support multiple stories per run — one story per invocation.

## Reference files

- [references/build-html.md](https://skilld.dev/api/skills-raw/hassancs91/claude-image-generation/story-html-publisher/references/build-html.md) — what the build does, options, the data shape, and the by-hand fallback
- [assets/build_html.py](https://skilld.dev/api/skills-raw/hassancs91/claude-image-generation/story-html-publisher/assets/build_html.py) — the build script (stdlib only)
- [assets/player-template.html](https://skilld.dev/api/skills-raw/hassancs91/claude-image-generation/story-html-publisher/assets/player-template.html) — the self-contained swipe player template
