Communitygithub.com

remotion-code-explainer

ソースコードを説明する没入型のシングルペインRemotion解説動画(1920×1080 30fps MP4)を作成します。コードのハイライト行、メモリボックス、ポインター矢印、データパケット、実行状態を1つのキャンバスに表示し、WordBoundaryカラオケ字幕付きでレンダリングします。ユーザーがコードの説明を依頼した場合、/remotion コマンドで使用します。

remotion-code-explainer とは?

このスキルは、任意のソースコードファイルを、Log2Base2スタイルのシングルペイン解説動画(1920×1080 30fps MP4)に変換するRemotionベースのツールです。画面を分割せず、1つの統一されたビジュアルステージ(SinglePaneStage)上で、コード実行の様子をアニメーション付きで視覚的に説明します。主な特徴として、現在の実行行のみをスポットライト表示するヘッダー、SVGベースの広々としたアニメーションキャンバス(メモリボックス、ポインター、データパケット、UIプレビューなどを同一画面に表示)、TTSのWordBoundaryタイムスタンプに同期した単語単位のカラオケ字幕などがあります。依存関係として remotion-best-practices と uv が必要で、CLIツール(code_explainer_cli.py)によりプロジェクトのスキャフォールディング、音声合成、MP4レンダリングを自動化します。ユーザーがコードの解説動画作成を依頼した場合や、ナレーションスクリプトをMP4に変換したい場合に使用します。

対応✓Claude Code~Codex CLI~Cursor✓Gemini CLI
npx skills add https://github.com/uzowurumauritius-rgb/remotion-stage/tree/main/skills/remotion-code-explainer

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Remotion Code Explainer (remotion-code-explainer)

概要

任意のソースコードファイルを、フレーム同期された没入型の1920×1080 30fps MP4 Remotion解説動画に変換します。形式はシングルペイン Log2Base2 スタジオフォーマットです。

画面を競合するサイドバイサイドペインや過密なマルチカード壁に分割することは絶対にしません。すべての動画は1つの統合ビジュアルステージ(<SinglePaneStage>)を使用するため、視聴者の注意はコードの実行方法に完全に集中します。

  1. 最小限のトップバー(44px、SinglePaneStageに内蔵):
    • 左側にレッスンタイトル+現在のアクティブセクションピル、右側に控えめなステップカウンター+細いプログレスバー。
  2. 1つの統合Log2Base2ステージ(SinglePaneStage — 幅100%):
    • フォーカスされた単一行スポットライトヘッダー: 現在のステップタイトルと単一のアクティブコード行のみをクリーモノスペースで表示します(アクティブな発話トークンをborderBottom: "2px solid #FACC15"でハイライト、水平パディングは絶対に追加しない)。さらに、triggerFrameでスプリングインする1つのコンパクトなアクティブコールアウトピル(token → 平易な英語の意味)を表示します。
    • 全幅没入型SVGキャンバス(viewBox="0 0 1600 680"): 広々とした連続的なモーショングラフィックス。ラベル付きメモリボックス(0x1004)、可変する変数、アニメーション化されたstrokeDashoffsetポインター矢印、スタックフレームのプッシュ/ポップ、配列/ツリーのスワップなど、Log2Base2のメモリ/実行ビジュアルを、ライブUI/stdout/テンソルプレビューと同じオープンキャンバス上に直接並べて表示します。
  3. 最小限の下部キャプションバー(VoiceoverCaptionBar — 68px):
    • 正確なTTSのWordBoundaryミリ秒タイムスタンプ(startMs、endMs)に基づいた、単語ごとにハイライトされるクリーンな中央揃えカラオケ字幕。

依存関係

  • remotion-best-practices(~/.gemini/skills/remotion/SKILL.md): すべてのRemotionアニメーションルール(useCurrentFrame()、interpolate()、spring()、<Sequence premountFor>、<Audio>、@remotion/google-fonts、CSSトランジションゼロ)に従う必要があります。
  • uv(~/.gemini/config/plugins/science/skills/uv/SKILL.md): ニューラル音声合成とWordBoundaryタイムスタンプ抽出のためにuv run --with edge-ttsを実行するために必要です。

クイックスタート

# 1. Remotion解説プロジェクトをスキャフォールディング
uv run python3 \
  ~/.gemini/config/skills/remotion-code-explainer/scripts/code_explainer_cli.py \
  scaffold \
  --project-dir "/path/to/project" \
  --source-file "/path/to/source.ext" \
  --output "/path/to/project/scaffold-status.json"

# 2. 自然なニューラル音声 + 正確なWordBoundaryとトークンタイムスタンプを合成
uv run --with edge-tts python3 \
  ~/.gemini/config/skills/remotion-code-explainer/scripts/code_explainer_cli.py \
  synthesize-voiceover \
  --project-dir "/path/to/project" \
  --beats-json "/path/to/project/beats.json" \
  --voice "en-US-AndrewNeural" \
  --rate "+2%" \
  --pause-sec 0.40 \
  --output "/path/to/project/public/voiceover/manifest.json"

# 3. 最終的な1080p 30fps MP4を高速8ワーカーキーフレーム重複排除レンダラーでレンダリング
uv run python3 \
  ~/.gemini/config/skills/remotion-code-explainer/scripts/code_explainer_cli.py \
  render-mp4 \
  --project-dir "/path/to/project" \
  --composition-id "CodeExplainer" \
  --out-name "Explainer.mp4" \
  --concurrency 8 \
  --output "/path/to/project/render-report.json"

没入型ストーリーテリングとワークフロー

  1. エネルギッシュなビートをデザインする(beats.json):
    • コードがなぜそのように動作するのか、視聴者を即座に惹きつける、明瞭で会話調のナレーションを書きます。
    • <SinglePaneStage>に渡されるアクティブ行にアクティブtokenがそのまま含まれるように、codeSnippetを集中させます(1–4行)。
    • パケット移動、ポインターホップ、配列スワップ、ライブテンソル/UIアニメーションがあるビートには、"motionStepFrames": 2を設定します。
  2. スキャフォールディングと音声合成:
    • scripts/code_explainer_cli.pyを介してscaffold(SinglePaneStage.tsx、VoiceoverCaptionBar.tsx、render_full_mp4.mjsをコピー)とsynthesize-voiceoverを実行します。
  3. 全キャンバスモーショングラフィックスを制作する(viewBox="0 0 1600 680"):
    • アニメーション化されたLog2Base2 × KodeKloud SVGストーリーボードをchildrenとして<SinglePaneStage>に渡します。
    • 「見せる」ことを「語る」より優先: 静的なコード壁やテキストボックスを物理的な動きに置き換えます。レジスタ/変数からメモリスロットへの値の飛翔、ポインターのスムーズな再ルーティング、コンポーネント間を移動するデータパケット、同じオープンキャンバス上で更新されるライブ状態/UI出力などです。
    • 動的なグリッドやスクロールトレースは<clipPath>でラップし、モーションが領域外にはみ出さないようにします。
  4. 静止フレームの確認と最終MP4のレンダリング:
    • npm run lintを実行し、read_fileで代表的な静止フレーム(npx remotion still)を検査して、重なりやクリッピングがないことを確認します。
    • render-mp4(scripts/render_full_mp4.mjs)を実行し、最終的な.mp4がout/、プロジェクトルート、およびワークスペースルートに保存されていることを確認します。

レート制限とよくある間違い

  • scripts/code_explainer_cli.pyは/tmp/remotion_edge_tts.lockを適用します(0.35s間隔、1s/2s/4sのバックオフで3回リトライ)。
  • 絶対に2ゾーンの分割画面ダッシュボードを使用したり、40行のスクロールコード壁をダンプしたりしないでください。画面は1つの<SinglePaneStage>ペインに保ってください。
  • ハイライトされたインライントークンに水平paddingを絶対に追加しないでください(borderBottom: "2px solid #FACC15"とbackgroundColorのみ)。
  • SVGステージ内で静的なテキストカードを絶対に使用しないでください。アニメーション化されたメモリ/ポインター/パケットモーションで概念を視覚的に示すことができる場合は、そちらを使用してください。

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

remotion-electronic-explainer

Creates synchronized, immersive single-pane Remotion visual explainer videos for Electronic Engineering (Semiconductors, PN Junctions, Diodes, BJTs, MOSFETs, CMOS Logic, Op-Amp IC Stages, ADC/DAC, PCB Signal Integrity) in a pure Log2Base2 single-stage format—with a focused single-line device equation spotlight, full-screen animated carrier/channel diagrams and live I-V curves on one canvas, WordBoundary karaoke captions, and fast 1080p MP4 rendering. Use whenever the user asks to explain electronic engineering, semiconductors, transistors, or analog/digital ICs with /remotion.

remotion-math-explainer

Creates synchronized, immersive single-pane Remotion visual explainer videos for Mathematics (Calculus, Linear Algebra, Differential Equations, Probability, Proofs) in a pure Log2Base2 single-stage format—with a focused single-line equation spotlight, full-screen 3Blue1Brown x Log2Base2 animated geometric/data motion graphics, WordBoundary karaoke captions, and fast 1080p MP4 rendering. Use whenever the user asks to explain math with /remotion, animate a derivation or theorem, or turn a math script into an MP4 explainer.

remotion-physics-explainer

Creates synchronized, immersive single-pane Remotion visual explainer videos for Physics (Mechanics, Electromagnetism, Thermodynamics, Optics/Waves, Quantum Mechanics, Relativity) in a pure Log2Base2 single-stage format—with a focused single-line governing law spotlight, full-screen animated free-body/field/wave simulations and live telemetry on one canvas, millisecond-accurate WordBoundary karaoke captions, and fast 1080p MP4 rendering. Use whenever the user asks to explain physics with /remotion or animate a physical law/system.

remotion-software-explainer

Creates synchronized, immersive single-pane Remotion visual explainer videos for Software Engineering (System Design, Distributed Systems, Microservices, Kubernetes/Docker, Design Patterns, Database Internals, CI/CD, Networking) in a pure Log2Base2 single-stage format—with a focused single-line contract/YAML spotlight, full-screen animated architecture flows with traveling request packets and live trace timelines on one canvas, WordBoundary karaoke captions, and fast 1080p MP4 rendering. Use whenever the user asks to explain software engineering, system design, or architecture with /remotion.

関連スキル