Communitygithub.com

Remotion Compose

將自然語言影片簡報轉換為完整、可預覽的 Remotion 組合 - 擷取持續時間、場景、品牌色、長寬比和真實文案;規劃影格預算;並編寫基於 useCurrentFrame、interpolate、spring、AbsoluteFill 和 Sequence 的資料驅動 React/TypeScript 程式碼,並註冊在 Root.tsx 中。

Remotion Compose 是什麼?

此技能(Remotion Compose)能將產品展示、功能導覽或行銷動畫等自然語言請求,轉換為可直接在 Remotion Studio 中預覽的完整 React/TypeScript 組合。它會自動提取影片的持續時間、場景順序、品牌色調、長寬比和真實文案,並據此規劃精確的影格預算。技能會輸出一個程式碼檔案,其中使用 useCurrentFrame、interpolate 與 spring 等 Remotion 核心 API 實現影格驅動的動畫,並透過 Sequence 組件在時間軸上編排各場景。最終的組件會被註冊在 Root.tsx 中,讓使用者能立即拖曳時間軸進行檢視。此技能支援 Cursor 與 Coding Agents 等平台,但不會處理最終的 MP4 渲染(請使用 remotion-render)或專案初始化(請使用 remotion-setup)。

相容平台~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/SkillMedev/skills/tree/HEAD/skills/remotion-compose

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Remotion Compose 是做什麼的?

您能將自然語言簡報轉換為完整、可預覽的 Remotion 組合 —— 真正的 React/TypeScript,搭配影格驅動的動畫。輸出檔案為 src/compositions/ 目錄下的 .tsx 檔案,並會註冊在 src/Root.tsx 中,使用者能立即在 Studio 中拖曳時間軸檢視,或交給 remotion-render 處理。

當收到任何建立、產生、動畫化或「為……撰寫影片程式碼」的請求時觸發,包括產品展示、導覽、功能介紹或行銷動畫 —— 例如「製作一個 20 秒的影片來展示 X」。

步驟 1 - 提取簡報

在開始編寫程式碼前,必須先取得這些資訊。以一次緊湊的批次提問;對於明顯的缺漏項目,使用合理的預設值填補,而非停滯不前:

  1. 持續時間(秒)、fps(預設 30 —— 產品與行銷影片的標準,渲染成本為 60fps 的一半。只有當動畫涉及精細的滑鼠游標移動或滾動 UI,且 30fps 會產生明顯卡頓時,才考慮使用 60fps)
  2. 場景 —— 依序發生的事件。盡量引導出一個節奏清單:「標誌、三個功能、CTA」優於「我的應用程式展示」
  3. 品牌 —— 主要 / 強調 / 背景色十六進位色碼,以及字型(一個 @remotion/google-fonts 系列名稱)。
  4. 長寬比 / 平台 —— 16:9 橫向(1920×1080)、9:16 直向(1080×1920)用於社交媒體,或 1:1 正方形(1080×1080)。
  5. 文案 —— 實際的標題 / 功能名稱 / CTA 文字。絕不捏造產品宣稱;要求真實用語。

到處都將秒數轉換為影格:durationInFrames = 秒數 * fps。典型總長度:社交 / 產品展示 15-60 秒,廣告剪輯 6-15 秒。

步驟 2 - 建立場景計畫

每個影片一個 <Composition>,每個場景一個元件,在時間軸上使用 <Sequence> 串接。在撰寫程式碼前先配置好影格預算:

總計:20 秒 @ 30fps = 600 個影格
  片頭(標誌)        影格   0-90    (Sequence from=0   durationInFrames=90)
  功能 1              影格  90-240   (Sequence from=90  durationInFrames=150)
  功能 2              影格 240-390   (Sequence from=240 durationInFrames=150)
  功能 3              影格 390-540   (Sequence from=390 durationInFrames=150)
  CTA 結尾            影格 540-600   (Sequence from=540 durationInFrames=60)

在預算規劃時需注意的節奏閾值:

  • 任何承載文字的節拍至少需要 2 秒(30fps 下為 60 影格)—— 加上進場動畫與停留時間。一個標題,每個單字大約需要 150-200 毫秒的停留時間才能閱讀;一個 6 個單字的標題在其動畫播放完畢後需要大約 1 秒的停留時間。
  • 進場動畫:10-20 影格。交叉淡出和離場動畫:12-15 影格。時間過長會顯得遲緩,過短則像一個閃爍。
  • 除非是刻意的閃現剪接,否則沒有場景短於約 45 影格。

<Sequence from={F}> 會移動子元件的本地時鐘,使該元件內部的 useCurrentFrame() 從 0 開始。每一個場景都像從影格 0 開始一樣進行動畫。

步驟 3 - 核心 API 參考

  • useCurrentFrame() —— 當前影格(時鐘)。所有動畫都是這個值的函數。
  • useVideoConfig() —— { fps, width, height, durationInFrames }。
  • interpolate(frame, [inFrames], [outValues], opts) —— 線性映射。在進場 / 離場時始終傳入 { extrapolateLeft: "clamp", extrapolateRight: "clamp" },避免數值超出範圍。
  • spring({ frame, fps, config }) —— 基於物理的 0→1(會稍微超過)。用於任何需要感覺有生命力的元素(彈出、滑動、縮放顯示)。
  • AbsoluteFill —— 一個全螢幕、絕對定位的 div;每個場景的基礎圖層。
  • Sequence —— 時間位移並限制子元件的時間範圍(場景調度器)。
  • Series / Series.Sequence —— 緊接連續的場景,無需手動計算 from 偏移量。
  • Img、staticFile —— 請參閱步驟 6。

步驟 4 - spring() 與 interpolate() 的比較

使用 spring() 在……情況下使用 interpolate() 在……情況下
運動應有物理感 —— 彈出、反彈、縮放顯示、滑入需要在精確影格之間進行精確的線性控制
需要自然穩定 / 過衝效果淡入淡出(透明度 0→1)、色彩變化、進度條、任何需要精準對齊影格的效果
卡片、標誌、徽章的進入效果交叉淡出和離場,過衝會看起來不對時使用

模式 —— 使用 spring 驅動變換,使用 interpolate 驅動透明度:

const { fps } = useVideoConfig();
const frame = useCurrentFrame();
const pop = spring({ frame, fps, config: { damping: 200 } });   // 0 → 1,有活力
const opacity = interpolate(frame, [0, 15], [0, 1], { extrapolateRight: "clamp" });
const scale = interpolate(pop, [0, 1], [0.8, 1]);

damping: 200 是主力配置 —— 快速穩定且幾乎沒有過衝。較低的阻尼(約 10-20)會產生明顯的反彈;僅在反彈是想要的效果時才使用低阻尼值。

步驟 5 - 標準產品展示結構

除非簡報另有說明,否則採用此結構:標誌 / 品牌片頭 → N 個功能介紹 → CTA 結尾。使其資料驅動(步驟 6),以便可以自由變體。

// src/compositions/ProductDemo.tsx
import {
  AbsoluteFill, Sequence, useCurrentFrame, useVideoConfig,
  interpolate, spring,
} from "remotion";
import { loadFont } from "@remotion/google-fonts/Inter";

const { fontFamily } = loadFont();

export type Feature = { title: string; body: string };
export type ProductDemoProps = {
  brand: string;
  colors: { bg: string; fg: string; accent: string };
  logoText: string;
  features: Feature[];
  cta: string;
};

const Intro: React.FC<{ text: string; colors: ProductDemoProps["colors"] }> = ({ text, colors }) => {
  const frame = useCurrentFrame();
  const { fps } = useVideoConfig();
  const s = spring({ frame, fps, config: { damping: 200 } });
  const scale = interpolate(s, [0, 1], [0.7, 1]);
  const opacity = interpolate(frame, [0, 12], [0, 1], { extrapolateRight: "clamp" });
  return (
    <AbsoluteFill style={{ backgroundColor: colors.bg, justifyContent: "center", alignItems: "center" }}>
      <h1 style={{ fontFamily, fontSize: 120, color: colors.fg, transform: `scale(${scale})`, opacity }}>
        {text}
      </h1>
    </AbsoluteFill>
  );
};

const FeatureCallout: React.FC<{ feature: Feature; colors: ProductDemoProps["colors"] }> = ({ feature, colors }) => {
  const frame = useCurrentFrame();
  const { fps } = useVideoConfig();
  const slide = spring({ frame, fps, config: { damping: 200 } });
  const x = interpolate(slide, [0, 1], [-60, 0]);
  const opacity = interpolate(frame, [0, 15], [0, 1], { extrapolateRight: "clamp" });
  return (
    <AbsoluteFill style={{ backgroundColor: colors.bg, justifyContent: "center", paddingLeft: 160 }}>
      <div style={{ transform: `translateX(${x}px)`, opacity }}>
        <div style={{ fontFamily, fontSize: 32, color: colors.accent, fontWeight: 700, letterSpacing: 2 }}>
          {feature.title.toUpperCase()}
        </div>
        <div style={{ fontFamily, fontSize: 64, color: colors.fg, maxWidth: 1100, marginTop: 16 }}>
          {feature.body}
        </div>
      </div>
    </AbsoluteFill>
  );
};

const Outro: React.FC<{ cta: string; colors: ProductDemoProps["colors"] }> = ({ cta, colors }) => {
  const frame = useCurrentFrame();
  const opacity = interpolate(frame, [0, 18], [0, 1], { extrapolateRight: "clamp" });
  return (
    <AbsoluteFill style={{ backgroundColor: colors.accent, justifyContent: "center", alignItems: "center" }}>
      <h2 style={{ fontFamily, fontSize: 84, color: colors.bg, opacity }}>{cta}</h2>
    </AbsoluteFill>
  );
};

export const ProductDemo: React.FC<ProductDemoProps> = ({ colors, logoText, features, cta }) => {
  const intro = 90;
  const per = 150;
  const outro = 60;
  return (
    <AbsoluteFill>
      <Sequence durationInFrames={intro}>
        <Intro text={logoText} colors={colors} />
      </Sequence>
      {features.map((f, i) => (
        <Sequence key={i} from={intro + i * per} durationInFrames={per}>
          <FeatureCallout feature={f} colors={colors} />
        </Sequence>
      ))}
      <Sequence from={intro + features.length * per} durationInFrames={outro}>
        <Outro cta={cta} colors={colors} />
      </Sequence>
    </AbsoluteFill>
  );
};

在 src/Root.tsx 中註冊,使用相同數字計算 durationInFrames 並提供 defaultProps:

<Composition
  id="ProductDemo"
  component={ProductDemo}
  durationInFrames={90 + 3 * 150 + 60}
  fps={30}
  width={1920}
  height={1080}
  defaultProps={{
    brand: "Acme",
    colors: { bg: "#0B0B0F", fg: "#FFFFFF", accent: "#6C5CE7" },
    logoText: "Acme",
    features: [
      { title: "快速", body: "數秒內交付,而非數個衝刺。" },
      { title: "簡單", body: "一個提示,一個影片。" },
      { title: "屬於你", body: "你的品牌,你的文案。" },
    ],
    cta: "立即免費開始 →",
  }}
/>

對於直向 / 社交媒體,設定 width={1080} height={1920};對於正方形,設定 1080×1080。保持元件相同 —— 只有畫布改變。

步驟 6 - 資料驅動的屬性與靜態資源

上述組合是完全資料驅動的:每個文字和顏色都是一個屬性。這就是重點 —— 變體(新的文案、新的調色盤、在地化的文字)無需重新提示;只需傳遞不同的屬性(remotion-render 可以從 JSON 檔案批次處理此操作)。

靜態資源(標誌、截圖、音訊)位於 public/assets/ 目錄中,並使用 staticFile() 引用 —— 絕不使用 import 或原始路徑:

import { Img, staticFile } from "remotion";
<Img src={staticFile("assets/logo.png")} />

步驟 7 - 輸出

將完成的檔案儲存到 src/compositions/<VideoName>.tsx,在 src/Root.tsx 中註冊,並告知使用者使用 npx remotion studio 預覽(http://localhost:3000)。然後交接:「在 Studio 中拖曳時間軸。告訴我需要更改什麼 —— 速度太快、顏色不對、文案不同 —— 我會編輯並重新渲染(remotion-render)。」

禁止事項

  • 禁止使用 CSS 轉場 / 動畫或 setTimeout/setInterval 進行動畫。Remotion 會獨立且並行地渲染影格;任何不源自 useCurrentFrame() 的內容在最終渲染中都是不可見或不一致的,即使它在瀏覽器預覽中看起來正常。
  • 禁止使用 Math.random() 進行散落 / 粒子效果 —— 每個渲染工作執行緒會得到不同的數值,導致影格無法匹配。請使用 Remotion 的 random(seed) 來獲得確定性的偽亂數。
  • 禁止在沒有 delayRender() / continueRender() 的情況下擷取資料或等待非同步工作 —— 渲染器會在資料到達之前捕捉影格。
  • 禁止在場景元件內部硬編碼 fps、width 或 height —— 從 useVideoConfig() 讀取它們,這樣切換 30↔60fps 或橫向↔直向時不會破壞每個時間和佈局。
  • 禁止省略進場 / 離場 interpolations 中的 extrapolateLeft/Right: "clamp" —— 透明度會超過 1,元素在其範圍結束後會飄離畫面。
  • 禁止捏造標題、功能宣稱或 CTA —— 使用使用者的真實文案,如果缺少則詢問。

品質標準

  • 每個動畫值都是 useCurrentFrame()(加上屬性)的純函數 —— 在 Studio 中向後拖曳時間軸,看起來與向前播放完全相同。
  • 計畫中的影格預算總和必須與 Root.tsx 中的 durationInFrames 完全相等,且沒有任何文字節拍的停留時間低於其可讀最小時間。
  • 所有文案和顏色均透過具有 defaultProps 的型別屬性傳入 —— 場景元件中沒有埋入的字面常數。
  • 資源透過 staticFile() 載入;檔案能乾淨註冊並在 Studio 中預覽,無控制檯錯誤。

Individual skills in this repo

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

SkillMedev/skills

Designs REST API surfaces - resource naming, HTTP method and status-code semantics, error shapes, pagination, and filtering - and delivers an endpoint spec a consumer can build against without asking questions. Use when someone asks "how should I name this endpoint", "what status code should this return", "should this be PUT or PATCH", "how do I paginate this list", or is reviewing an API before it ships to external consumers. Do NOT use for planning breaking-change rollouts and deprecation windows - use api-versioning-strategist instead; for GraphQL type and resolver design - use graphql-schema instead; for generating client SDKs from an existing spec - use api-client-generator instead; for designing inbound webhook endpoints - use webhook-receiver-hardener instead.

SkillMedev/skills

Produce an accurate, properly timed caption track (SRT or WebVTT) from a video's audio - transcribing or aligning to the voiceover script, timing cues to speech, and enforcing line-length and reading-speed rules so captions are readable and in sync. Use when someone says "generate captions", "make subtitles from the audio", "transcribe and caption this", "export an SRT or VTT", "the captions are out of sync", or "the subtitles flash by too fast to read". Do NOT use to burn-in, style, reframe, or position an existing caption track for a platform (9:16, brand styling, safe areas) - that is social-video-formatter; do NOT use to animate text word-by-word as a motion graphic - that is kinetic-typography; do NOT use to write the spoken script in the first place - that is narration-script.

SkillMedev/skills

Turns data and charts into a decision-driving narrative structured as headline finding, trend, implication, and recommended action - with finding-led chart titles, context for every number, annotation guidance, and honest flags on any conclusion the data cannot support. Use when someone says "turn these numbers into a story", "what's the takeaway from this data", "help me present these results to leadership", or has charts but no narrative. Do NOT use for compressing a long document into a one-pager - use executive-summary instead - or for running the analysis that produces the findings - use eda-playbook instead.

SkillMedev/skills

Use when a task needs live or historical money data - "convert USD to EUR", "current/past exchange rate", "FX rate on this date / over this range", or "current price of Bitcoin/Ethereum, market cap, 24h change". Frankfurter (ECB reference rates, no key) is the FX default; CoinGecko's free keyless tier covers crypto. Do NOT use for stock quotes or equities - no keyless stock API survives verification, say so instead of guessing; do NOT use for country economic indicators like GDP or inflation series - use government-open-data instead; if the request is a vague "I need live data", route through public-data-api-picker.

SkillMedev/skills

Builds a driver-based FP&A operating model linking business inputs to P&L, balance sheet, and cash flow outputs. Use when building an annual plan, preparing investor materials, running scenario analysis, or stress-testing the business.

SkillMedev/skills

Use when a task needs live geographic lookups - "geocode this address", "what's at these coordinates" (reverse geocoding), "lat/lon for this city", "which country/state is this ZIP or postal code in", or "country facts: capital, currency, population, flag". Nominatim (OpenStreetMap) is the geocoding default; Zippopotam for postal codes; APICountries for country facts. All keyless. Do NOT use for weather at a location - use weather-climate instead; do NOT use for country-level statistics over time (GDP, population trends) - use government-open-data instead; if the request is a vague "I need live data", route through public-data-api-picker.

SkillMedev/skills

Runs the full Getting Things Done loop - capture, clarify, organize, reflect, engage - building a trusted system of context lists, a projects list with defined next actions, and a weekly review habit. Use when someone says "I'm overwhelmed and things are slipping through the cracks", "set up GTD for me", "help me do a brain dump and organize it", or "my to-do list is a mess". Do NOT use for just running the weekly review ritual itself - use weekly-review instead - or for clearing an email backlog - use inbox-zero.

SkillMedev/skills

Processes any email backlog to zero using the 4Ds - Delete, Delegate, Defer, Do - with a mass-archive strategy for the obvious, a touch-each-email-once discipline, and a keep-it-clear system of batched processing windows, ruthless unsubscribing, filters, and a minimal folder setup. Use when someone says "I have 5,000 unread emails", "help me get to inbox zero", "email is eating my whole day", or treats their inbox as a to-do list. Do NOT use for drafting the reply emails themselves or prioritization rules for an ongoing support queue - use email-triage instead - or for protecting focus time around the email windows - use deep-work-planner instead.

SkillMedev/skills

Write landing-page copy section by section - hero, social proof, features-as-benefits, objections, CTA - leading with one promise and proving it down the page. Use when someone asks "write my landing page", "improve my hero headline", "what should the homepage say", "turn these features into benefits", or is shipping a new page for a launch or campaign. Do NOT use for testing and optimizing an existing page's conversion rate - use landing-page-cro instead; for the one-line claim itself use positioning-statement; for the full message ladder use messaging-hierarchy.

SkillMedev/skills

Improves an existing landing page's conversion rate through evidence-first CRO - audit heatmaps and recordings, write structured hypotheses, prioritize with ICE scoring, and run one-variable tests to statistical significance. Use when someone asks "why isn't my landing page converting", "audit this page before we scale spend", "which A/B test should we run first", or after a CVR drop or ahead of a paid-traffic push. Do NOT use for writing a new landing page from scratch - use landing-page-copy instead. Do NOT use for auditing the ad accounts sending the traffic - use paid-acquisition-audit instead. Do NOT use for reading the results of a finished experiment - use ab-test-analyzer instead.

SkillMedev/skills

Runs structured coaching sessions using values clarification and the GROW model, ending every session with one committed action, a deadline, and an if-then plan for the likely obstacle. Use when someone says "I feel stuck in my life", "help me figure out what I want", "hold me accountable to my goals", or "coach me through this decision". Do NOT use for building a stress toolkit - use stress-management instead - or a journaling practice - use journal-framework; for a standing goal-tracking system, use goals-accountability. Coaching, not therapy: signs of clinical distress route to a licensed professional.

SkillMedev/skills

Adapts English content for a target language and region - swapping idioms, setting the right formality register, replacing cultural references, converting dates, units, and currency - and delivers the localized text with a notes column explaining each adaptation and flagging what needs a native reviewer. Use when someone asks "localize this copy for the Japanese market", "adapt our marketing copy for the Mexican market", "make this translation sound native instead of literal", or a literal translation reads foreign, stiff, or risky. Do NOT use for auditing in-product UI text quality - use ux-writing-audit instead.

SkillMedev/skills

Scaffolds a new Remotion video project wired for Claude Code Agent Skills - Node check, create-video scaffold, skills install, folder conventions, Google Fonts, and a smoke-test render. Use whenever someone wants to start making videos with Remotion and Claude, even just "make product videos with Claude.

SkillMedev/skills

Classifies incident severity (SEV1-4) using impact, scope, and urgency signals and decides who to page. Use when an alert fires or a report comes in and a severity call must be made quickly.

SkillMedev/skills

Use the Skill Me catalog from inside any conversation - discover, install, and manage Claude skills through the Skill Me MCP, and load installed skills automatically each session.

SkillMedev/skills

Write one platform-native caption from a topic and brand voice, with a front-loaded hook, native length, and a single earned CTA. Use when the user gives a topic (and optionally brand voice or a described image/video) and asks for an Instagram, LinkedIn, X/Twitter, or TikTok caption. Do NOT use when the user wants a dedicated standalone LinkedIn post - use linkedin-post-writer instead; or a multi-post X thread - use tweet-thread-builder instead; or to adapt one existing piece of content into versions for several channels - use cross-platform-reformatter instead.

SkillMedev/skills

Reframe and export a finished video for social platforms - 9:16 ↔ 16:9 cropping, burned-in captions, a platform-native first frame, loop design, and per-platform specs (aspect, length, safe areas) for TikTok, Reels, Shorts, X, and LinkedIn. Use when someone says "make this vertical", "crop to 9:16", "format for TikTok/Reels/Shorts", "add captions/subtitles", "why is my video cut off on mobile", "resize for Instagram", or "export for social". Do NOT use when the question is about the storyboard or shot order before any video exists (use video-storyboard); the animation craft of how elements move (use motion-design-principles); animated word-by-word caption styling (use kinetic-typography); palette, contrast, or lighting (use motion-color-and-light); directing the product-demo content and screen choreography (use product-demo-director); or scoring, beat-syncing, or audio (use sound-and-music-sync) - this is the craft layer that decides WHAT to format for the feed, then hands a concrete spec to remotion-compo...

SkillMedev/skills

Writes and tunes PySpark jobs - join strategy and broadcast size limits, shuffle-partition sizing, skew diagnosis and salting, UDF avoidance, caching, and output file layout - with concrete size and skew thresholds. Use when someone asks "why is my Spark job slow", "should I broadcast this join", "one task takes forever while the rest finish", "my job OOMs during a join", or is writing a new PySpark ETL job. Do NOT use for Kafka topic, consumer-group, or streaming-pipeline design - use kafka-pipelines instead; do NOT use for single-machine dataframe work that fits in memory - use pandas-expert instead.

SkillMedev/skills

Builds clean, performant, accessible SwiftUI views with correct state ownership, scoped invalidation, and smooth list scrolling, and reviews existing SwiftUI code against a concrete frame-time and re-render budget. Use when someone asks "why does my SwiftUI list stutter", "should this be @State or @Observable", "my whole screen re-renders when one row changes", "how do I animate this transition", or wants a SwiftUI view built or refactored. Do NOT use for cross-platform React Native apps - use react-native-pro instead; do NOT use for Flutter widget trees - use flutter-widget-architect instead; do NOT use for Android Compose UIs - use jetpack-compose-builder instead.

相關技能