Skip to content

jianshuo/claude-skills / wjs-voicedrop-creating-motion-book

wjs-voicedrop-creating-motion-book

Flagged

Use when the user wants a whole book (usually a VoiceDrop 书架 book) turned into a chaptered explainer animation narrated by the book's own audiobook (书架「听本章」) — vertical 视频号 9:16 by default, art style auto-picked from the book's content, delivered as an in-browser HTML player and optionally MP4. Triggers — "把这本书做成动画", "做成艺术动画片", "读书动画", "听书配动画", "motion book", "/wjs-voicedrop-creating-motion-book <书名>".

FileKindSize
SKILL.mdskill md11.2 KB
cloud/harvest_kits.shscript3.2 KB
cloud/mb.mjsscript2.4 KB
cloud/probe.mjsscript1.3 KB
cloud/run_book.shscript23.6 KB
cloud/setup_worker.shscript3.3 KB
kits/8bit/.harvestedother16 B
kits/8bit/kit.jsonconfig6.6 KB
kits/8bit/lib.jsscript49.2 KB
kits/USAGE.tsvother3.0 KB
kits/banknote/fonts/NotoSerifSC-Black.woffbinary2.1 MB
kits/banknote/fonts/NotoSerifSC-Regular.woffbinary2.1 MB
kits/banknote/fonts/OFL.txtmarkdown4.2 KB
kits/banknote/kit.jsonconfig1.1 KB
kits/banknote/lib.jsscript16.6 KB
kits/bauhaus/.harvestedother15 B
kits/bauhaus/kit.jsonconfig2.5 KB
kits/bauhaus/lib.jsscript37.0 KB
kits/cave/.harvestedother22 B
kits/cave/kit.jsonconfig2.6 KB
kits/cave/lib.jsscript33.1 KB
kits/constructivism/.harvestedother19 B
kits/constructivism/kit.jsonconfig3.0 KB
kits/constructivism/lib.jsscript47.0 KB
kits/cubism/.harvestedother24 B
kits/cubism/kit.jsonconfig1.6 KB
kits/cubism/lib.jsscript13.0 KB
kits/dali/.harvestedother21 B
kits/dali/kit.jsonconfig4.2 KB
kits/dali/lib.jsscript51.8 KB
kits/dunhuang/.harvestedother13 B
kits/dunhuang/kit.jsonconfig5.7 KB
kits/dunhuang/lib.jsscript49.4 KB
kits/egypt/.harvestedother21 B
kits/egypt/kit.jsonconfig3.9 KB
kits/egypt/lib.jsscript72.4 KB
kits/flat2026/kit.jsonconfig2.1 KB
kits/flat2026/lib.jsscript50.5 KB
kits/ghibli/.harvestedother15 B
kits/ghibli/kit.jsonconfig5.4 KB
kits/ghibli/lib.jsscript74.9 KB
kits/gothic/.harvestedother17 B
kits/gothic/kit.jsonconfig5.6 KB
kits/gothic/lib.jsscript70.6 KB
kits/greek/.harvestedother10 B
kits/greek/kit.jsonconfig2.5 KB
kits/greek/lib.jsscript49.6 KB
kits/haring/.harvestedother19 B
kits/haring/kit.jsonconfig3.4 KB
kits/haring/lib.jsscript36.4 KB
kits/hopper/.harvestedother13 B
kits/hopper/kit.jsonconfig4.2 KB
kits/hopper/lib.jsscript45.2 KB
kits/impression/.harvestedother15 B
kits/impression/kit.jsonconfig6.2 KB
kits/impression/lib.jsscript71.2 KB
kits/ink/.harvestedother19 B
kits/ink/fonts/NotoSerifSC-Black.woffbinary2.1 MB
kits/ink/fonts/NotoSerifSC-Regular.woffbinary2.1 MB
kits/ink/fonts/OFL.txtmarkdown4.2 KB
kits/ink/kit.jsonconfig5.0 KB
kits/ink/lib.jsscript47.7 KB
kits/kirby/.harvestedother14 B
kits/kirby/kit.jsonconfig3.1 KB
kits/kirby/lib.jsscript40.9 KB
kits/klimt/.harvestedother13 B
kits/klimt/kit.jsonconfig6.4 KB
kits/klimt/lib.jsscript36.5 KB
kits/kurzgesagt/kit.jsonconfig1.0 KB
kits/kurzgesagt/lib.jsscript16.1 KB
kits/kusama/.harvestedother15 B
kits/kusama/kit.jsonconfig5.4 KB
kits/kusama/lib.jsscript53.9 KB
kits/matisse/.harvestedother9 B
kits/matisse/kit.jsonconfig6.4 KB
kits/matisse/lib.jsscript43.1 KB
kits/monet/.harvestedother10 B
kits/monet/kit.jsonconfig5.4 KB
kits/monet/lib.jsscript64.5 KB
kits/munch/.harvestedother36 B
kits/munch/kit.jsonconfig2.8 KB
kits/munch/lib.jsscript17.8 KB
kits/nouveau/.harvestedother9 B
kits/nouveau/kit.jsonconfig6.9 KB
kits/nouveau/lib.jsscript34.2 KB
kits/picasso_blue/.harvestedother12 B
kits/picasso_blue/kit.jsonconfig6.2 KB
kits/picasso_blue/lib.jsscript58.4 KB
kits/pop/.harvestedother11 B
kits/pop/kit.jsonconfig2.5 KB
kits/pop/lib.jsscript37.3 KB
kits/raytrace/.harvestedother20 B
kits/raytrace/kit.jsonconfig3.2 KB
kits/raytrace/lib.jsscript39.7 KB
kits/renaissance/.harvestedother12 B
kits/renaissance/kit.jsonconfig6.4 KB
kits/renaissance/lib.jsscript95.2 KB
kits/rickmorty/.harvestedother8 B
kits/rickmorty/kit.jsonconfig2.4 KB
kits/rickmorty/lib.jsscript53.4 KB
kits/roman/.harvestedother18 B
kits/roman/kit.jsonconfig2.0 KB
kits/roman/lib.jsscript53.8 KB
kits/rubberhose/.harvestedother10 B
kits/rubberhose/kit.jsonconfig5.0 KB
kits/rubberhose/lib.jsscript52.4 KB
kits/seurat/.harvestedother15 B
kits/seurat/kit.jsonconfig3.1 KB
kits/seurat/lib.jsscript17.8 KB
kits/shadowpuppet/.harvestedother21 B
kits/shadowpuppet/kit.jsonconfig3.2 KB
kits/shadowpuppet/lib.jsscript43.2 KB
kits/shinkai/.harvestedother9 B
kits/shinkai/kit.jsonconfig3.7 KB
kits/shinkai/lib.jsscript39.0 KB
kits/vangogh/.harvestedother18 B
kits/vangogh/README.mdmarkdown1.5 KB
kits/vangogh/kit.jsonconfig11.1 KB
kits/vangogh/lib.jsscript94.0 KB
kits/vaporwave/.harvestedother12 B
kits/vaporwave/kit.jsonconfig7.7 KB
kits/vaporwave/lib.jsscript57.8 KB
player/template.htmlother13.0 KB
references/章节制作规范.mdmarkdown6.2 KB
references/踩坑.mdmarkdown4.6 KB
references/选画风.mdmarkdown6.3 KB
scripts/add_cover.mjsscript3.7 KB
scripts/assemble.mjsscript9.7 KB
scripts/build_html.mjsscript6.1 KB
scripts/common.mjsscript7.8 KB
scripts/fetch_book.mjsscript1.7 KB
scripts/framing_sheet.mjsscript2.6 KB
scripts/narrate.mjsscript8.4 KB
scripts/new_book.mjsscript4.4 KB
scripts/optimize_html.mjsscript5.2 KB
scripts/pick_styles.mjsscript3.9 KB
scripts/publish_video.mjsscript5.1 KB
scripts/qa_batches.mjsscript3.4 KB
scripts/render_chunks.mjsscript5.7 KB
scripts/render_lock.shscript783 B
scripts/republish_player.mjsscript4.9 KB
scripts/smoke.mjsscript20.7 KB
scripts/split_chapters.mjsscript2.7 KB

scripts/common.mjs

View on GitHub
// 公用:路径、凭据、book.json、MP3 帧操作、口播稿与 ASR 按字对齐。只依赖 Node(≥20),不要 ffmpeg / Python / Chromium。
import fs from 'node:fs';
import path from 'node:path';
import os from 'node:os';
import { spawnSync } from 'node:child_process';
import { fileURLToPath } from 'node:url';

export const SK = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
export const ENGINE = process.env.HUASHU_ENGINE || path.join(os.homedir(), '.claude/skills/huashu-art-motion/scripts/engine');
export const readJSON = f => JSON.parse(fs.readFileSync(f, 'utf8'));
export const writeJSON = (f, o) => fs.writeFileSync(f, JSON.stringify(o, null, 1) + '\n');
export const book = P => readJSON(path.join(P, 'book.json'));
export const chapterIds = b => b.chapters.map((_, i) => `ch${String(i + 1).padStart(2, '0')}`);   // ch01…chNN(口播是听书整章,没有另写的开场段)

// 凭据:环境变量优先,其次 ~/code/.env(Mac)或 $BOOK_ENV 指定的文件(VPS)
export function loadEnv() {
  const f = process.env.BOOK_ENV || path.join(os.homedir(), 'code/.env'), env = { ...process.env };
  if (fs.existsSync(f)) for (let l of fs.readFileSync(f, 'utf8').split('\n')) {
    l = l.trim().replace(/^export /, ''); const i = l.indexOf('=');
    if (!l || l.startsWith('#') || i < 0) continue;
    const k = l.slice(0, i).trim(); if (!(k in env)) env[k] = l.slice(i + 1).trim().replace(/^["']|["']$/g, '');
  }
  return env;
}

// Node 20 的 WebSocket 要 --experimental-websocket(22 起默认有):没有就带上开关重启自己
export function ensureWebSocket() {
  if (typeof WebSocket !== 'undefined') return;
  const r = spawnSync(process.execPath, ['--experimental-websocket', '--no-warnings', ...process.argv.slice(1)], { stdio: 'inherit' });
  process.exit(r.status ?? 1);
}

// ---------- MP3:按帧解析(跳过 ID3 和 Xing/Info 帧),帧级拼接,全零静音帧 ----------
const BR = { 1: [0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320], 2: [0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160] };
const SR = { 3: [44100, 48000, 32000], 2: [22050, 24000, 16000], 0: [11025, 12000, 8000] };
export function mp3Frames(buf) {
  const frames = []; let i = 0, fmt = null;
  while (i + 4 <= buf.length) {
    if (buf[i] === 0x49 && buf[i + 1] === 0x44 && buf[i + 2] === 0x33) { i += 10 + ((buf[i + 6] & 127) << 21 | (buf[i + 7] & 127) << 14 | (buf[i + 8] & 127) << 7 | (buf[i + 9] & 127)); continue; }
    if (buf[i] !== 0xff || (buf[i + 1] & 0xe0) !== 0xe0 || ((buf[i + 1] >> 1) & 3) !== 1) { i++; continue; }   // 只认 Layer III
    const ver = (buf[i + 1] >> 3) & 3, br = BR[ver === 3 ? 1 : 2][buf[i + 2] >> 4], sr = (SR[ver] || [])[(buf[i + 2] >> 2) & 3];
    if (!br || !sr || ver === 1) { i++; continue; }
    const len = Math.floor((ver === 3 ? 144 : 72) * br * 1000 / sr) + ((buf[i + 2] >> 1) & 1);
    const mono = (buf[i + 3] >> 6) === 3, side = mono ? (ver === 3 ? 17 : 9) : (ver === 3 ? 32 : 17);
    const tag = buf.subarray(i + 4 + side, i + 8 + side).toString('latin1');
    const f = buf.subarray(i, i + len);
    if (tag !== 'Xing' && tag !== 'Info') {
      const k = `${ver}/${sr}/${buf[i + 3] >> 6}`;
      if (fmt && fmt.key !== k) throw new Error(`MP3 格式中途变了:${fmt.key} → ${k}`);
      fmt ||= { key: k, ver, sr, spf: ver === 3 ? 1152 : 576, header: Buffer.from(f.subarray(0, 4)), side, len };
      frames.push(f);
    }
    i += len;
  }
  if (!fmt) throw new Error('不是 MP3(找不到 Layer III 帧)');
  return { frames, ...fmt, dur: frames.length * (ver3(fmt) ? 1152 : 576) / fmt.sr };
}
const ver3 = f => f.ver === 3;
export const mp3Duration = file => mp3Frames(fs.readFileSync(file)).dur;
// 全零侧信息=没有频谱数据=解出来是数字静音;码率与第一帧相同、去掉 padding 位
export function silentFrames(fmt, n) {
  const h = Buffer.from(fmt.header); h[2] &= ~0x02;
  const len = Math.floor((fmt.ver === 3 ? 144 : 72) * BR[fmt.ver === 3 ? 1 : 2][h[2] >> 4] * 1000 / fmt.sr);
  const f = Buffer.alloc(len); h.copy(f, 0); return Array(n).fill(f);
}

// ---------- 按字对齐(difflib.SequenceMatcher(autojunk=False) 的逐行移植)----------
const PUN = new Set(',、:?。;! ,.~~“”"\'()()《》·—-');
function matchingBlocks(a, b) {
  const b2j = new Map(); b.forEach((c, j) => { if (!b2j.has(c)) b2j.set(c, []); b2j.get(c).push(j); });
  const longest = (alo, ahi, blo, bhi) => {
    let bi = alo, bj = blo, bs = 0, j2len = new Map();
    for (let i = alo; i < ahi; i++) {
      const nj = new Map();
      for (const j of b2j.get(a[i]) || []) { if (j < blo) continue; if (j >= bhi) break; const k = (j2len.get(j - 1) || 0) + 1; nj.set(j, k); if (k > bs) { bi = i - k + 1; bj = j - k + 1; bs = k; } }
      j2len = nj;
    }
    while (bi > alo && bj > blo && a[bi - 1] === b[bj - 1]) { bi--; bj--; bs++; }
    while (bi + bs < ahi && bj + bs < bhi && a[bi + bs] === b[bj + bs]) bs++;
    return [bi, bj, bs];
  };
  const q = [[0, a.length, 0, b.length]], out = [];
  while (q.length) {
    const [alo, ahi, blo, bhi] = q.pop(), [i, j, k] = longest(alo, ahi, blo, bhi);
    if (k) { out.push([i, j, k]); if (alo < i && blo < j) q.push([alo, i, blo, j]); if (i + k < ahi && j + k < bhi) q.push([i + k, ahi, j + k, bhi]); }
  }
  out.sort((x, y) => x[0] - y[0] || x[1] - y[1]);
  const merged = []; for (const m of out) { const l = merged.at(-1); if (l && l[0] + l[2] === m[0] && l[1] + l[2] === m[1]) l[2] += m[2]; else merged.push([...m]); }
  return merged;
}
// asr: 火山 ASR 结果(result.utterances[].words[],毫秒);返回 { rows: [[开始, 结束, 短句]], ratio }
export function alignPhrases(asr, text) {
  const phrases = text.split(/(?<=[,。:;?])|\n/).filter(p => p && p.trim()).map(p => p.trim());
  const sc = []; phrases.forEach((p, k) => { for (const ch of p) if (!PUN.has(ch)) sc.push([ch, k]); });
  const ac = [];
  for (const u of asr.result?.utterances || []) for (const w of u.words || []) {
    const t = [...w.text].filter(ch => !PUN.has(ch)); if (!t.length) continue;
    const a = w.start_time / 1000, b = w.end_time / 1000;
    t.forEach((ch, i) => ac.push([ch, a + (b - a) * i / t.length, a + (b - a) * (i + 1) / t.length]));
  }
  const blocks = matchingBlocks(sc.map(x => x[0]), ac.map(x => x[0]));
  const st = Array(sc.length).fill(null), en = Array(sc.length).fill(null);
  for (const [ai, bj, k] of blocks) for (let i = 0; i < k; i++) { st[ai + i] = ac[bj + i][1]; en[ai + i] = ac[bj + i][2]; }
  const known = st.map((v, i) => v === null ? -1 : i).filter(i => i >= 0);
  if (!known.length) throw new Error('ASR 与稿子完全对不上');
  for (let i = 0; i < sc.length; i++) {
    if (st[i] !== null) continue;
    const L = known.filter(k => k < i).at(-1), R = known.find(k => k > i);
    if (L === undefined) { st[i] = en[i] = st[R]; continue; }
    if (R === undefined) { st[i] = en[i] = en[L]; continue; }
    st[i] = en[L] + (st[R] - en[L]) * (i - L) / (R - L); en[i] = en[L] + (st[R] - en[L]) * (i - L + 1) / (R - L);
  }
  const rows = [];
  phrases.forEach((p, k) => { const idx = sc.map((x, i) => x[1] === k ? i : -1).filter(i => i >= 0); if (idx.length) rows.push([st[idx[0]], en[idx.at(-1)], p]); });
  return { rows, ratio: blocks.reduce((s, m) => s + m[2], 0) / Math.max(1, sc.length) };
}
export const formatRows = rows => rows.map(([a, b, p]) => `${a.toFixed(2).padStart(6)}-${b.toFixed(2).padStart(6)}  ${p}`).join('\n') + '\n';
export const parseRows = s => s.split('\n').map(l => l.match(/^\s*([\d.]+)-\s*([\d.]+)\s+(.*)$/)).filter(Boolean).map(m => [+m[1], +m[2], m[3].trim()]);

// 简单并发池
export async function pool(items, n, fn) {
  const out = []; let k = 0;
  await Promise.all(Array.from({ length: Math.min(n, items.length) }, async () => { while (k < items.length) { const i = k++; out[i] = await fn(items[i], i); } }));
  return out;
}
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall