Skip to content

jianshuo/claude-skills / wjs-converting-text-to-video

wjs-converting-text-to-video

Verified

Use when the user wants a 王建硕-style WeChat article (article.md) turned into a narrated short MP4 video — TTS voiceover via 火山引擎 Volcano TTS, HyperFrames CSS/GSAP animation per scene, subtle SFX, abstract watercolor background, full pipeline rendering to 1080×1920 portrait MP4 (30-90s). Triggers — "把这篇文章做成视频", "做一个解说视频", "讲解视频", "/wjs-converting-text-to-video".

FileKindSize
SKILL.mdskill md29.8 KB
scripts/bootstrap-project.shexecutablescript2.5 KB
scripts/daily-upload-batch.shexecutablescript2.5 KB
scripts/generate-bg.shexecutablescript2.1 KB
scripts/publish-to-youtube.pyexecutablescript8.4 KB
scripts/retrofit-bg-image.pyexecutablescript3.9 KB
scripts/strip-dark-scene-bgs.pyexecutablescript3.4 KB
scripts/synth-sfx.shexecutablescript1.4 KB
scripts/tts.pyexecutablescript5.7 KB

scripts/retrofit-bg-image.py

View on GitHub
#!/usr/bin/env python3
"""Retrofit the bg-image + bg-overlay layer into an existing index.html.

Idempotent — running twice has no extra effect.

Usage:
  retrofit-bg-image.py <article-folder>
  retrofit-bg-image.py <article-folder>/video    # also accepted

Inserts (only if not already present):
  - <div id="bg-image"></div> + <div id="bg-overlay"></div> right after <div id="root" ...>
  - CSS rules for #bg-image, #bg-overlay, .scene z-index inside the <style> block

The bg-image points to ../illustration.png (or ../cover.png as fallback).
"""
import sys, re, shutil
from pathlib import Path

CSS_INJECT = """
  /* ============ bg-image layer (abstract watercolor bg) ============ */
  #bg-image {
    position: absolute; inset: 0;
    background-image: url('bg.png');
    background-size: cover;
    background-position: center;
    filter: blur(30px) brightness(0.65) saturate(0.85);
    z-index: 0;
    transform: scale(1.1);
  }
  #bg-overlay {
    position: absolute; inset: 0;
    background: rgba(14, 11, 8, 0.28);
    z-index: 1;
  }
  .scene { z-index: 2; }
"""

HTML_INJECT = """
  <div id="bg-image"></div>
  <div id="bg-overlay"></div>
"""

def find_video_dir(arg: str) -> Path:
    p = Path(arg).resolve()
    if (p / "index.html").exists():
        return p
    if (p / "video" / "index.html").exists():
        return p / "video"
    sys.exit(f"No index.html found at {p} or {p}/video")

def ensure_bg_png(video_dir: Path) -> bool:
    """Copy illustration.png (or cover.png) from article folder into video/bg.png."""
    if (video_dir / "bg.png").exists():
        return True
    article_dir = video_dir.parent
    for cand in ("illustration.png", "cover.png"):
        src = article_dir / cand
        if src.exists():
            shutil.copy(src, video_dir / "bg.png")
            print(f"  + copied {cand} → bg.png")
            return True
    print(f"  ⚠️  no illustration.png or cover.png in {article_dir}, skipping bg-image retrofit")
    return False

def retrofit(video_dir: Path) -> bool:
    html_path = video_dir / "index.html"
    html = html_path.read_text()

    if not ensure_bg_png(video_dir):
        return False

    changed = False

    # Inject CSS (just before closing </style>)
    if "#bg-image" not in html:
        m = re.search(r"</style>", html)
        if not m:
            print(f"  ✗  no </style> tag in {html_path}, cannot inject CSS")
            return False
        html = html[:m.start()] + CSS_INJECT + html[m.start():]
        changed = True
        print(f"  + CSS injected")
    else:
        # Update existing CSS to tuned values (idempotent)
        html = re.sub(
            r"background-image:\s*url\('[^']+'\);",
            "background-image: url('bg.png');",
            html,
            count=1,
        )
        html = re.sub(
            r"filter:\s*blur\([^)]+\)\s*brightness\([^)]+\)\s*saturate\([^)]+\);",
            "filter: blur(30px) brightness(0.65) saturate(0.85);",
            html,
            count=1,
        )
        html = re.sub(
            r"background:\s*rgba\(14,\s*11,\s*8,\s*[\d.]+\);",
            "background: rgba(14, 11, 8, 0.28);",
            html,
            count=1,
        )

    # Inject HTML divs (right after opening <div id="root" ...>)
    if 'id="bg-image"' not in html:
        m = re.search(r'(<div id="root"[^>]*>)', html)
        if not m:
            print(f"  ✗  no <div id=\"root\"> in {html_path}, cannot inject divs")
            return False
        html = html[:m.end()] + HTML_INJECT + html[m.end():]
        changed = True
        print(f"  + HTML divs injected")

    if changed:
        html_path.write_text(html)
        print(f"  ✓ {html_path}")
    else:
        print(f"  · already has bg-image, no change")
    return changed

def main():
    if len(sys.argv) < 2:
        sys.exit(__doc__)
    for arg in sys.argv[1:]:
        video_dir = find_video_dir(arg)
        print(f"[retrofit] {video_dir}")
        retrofit(video_dir)

if __name__ == "__main__":
    main()
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall