Community程式設計與開發github.com

remotion-elements

在 Remotion 專案中安裝可重複使用的影片元件(如標題、背景、圖表與字幕樣式)。使用 `npx remotion elements use` 註冊元件庫,並在 Remotion Studio 中以 `npx remotion elements add-library` 管理。適用於取得元件頁面網址或元件庫網址,或影片需要現成元件時。

remotion-elements 是什麼?

這個技能(remotion-elements)讓 AI 代理能夠協助開發者在 Remotion 專案中安裝與管理可重複使用的影片元件(Elements)。元件是以 React 撰寫的獨立影片組件,安裝後會將原始碼直接複製到專案中,使用者可以完全擁有並自由編輯。技能支援透過 CLI 工具 `npx remotion elements` 進行操作:使用 `add-library` 註冊元件庫(可從官方列表或任意網站取得),並使用 `use` 搭配 `--dry-run` 進行預覽後再實際安裝。此外,它還能處理多種邊界情況,例如找不到元件時檢查 HTML 中的 JSON 酬載、處理多個元件同頁的 slug 選擇、以及處理 Remotion 版本過舊的問題。安裝完成後,AI 會引導使用者調整屬性與時間軸,並建議載入 `remotion-markup` 技能來優化標記。支援 Remotion 4.0.543 以上版本,並與 Remotion Studio 無縫整合。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/remotion-dev/skills/tree/main/skills/remotion-elements

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

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

說明文件

Elements

Element 是用 React 撰寫的可重複使用影片元件。 Element 函式庫會將每個 Element 發佈在其專屬的 Element 頁面上。 安裝 Element 會將其原始碼複製到專案中。使用者擁有該副本,可以像任何其他元件一樣編輯它,並與其他 Element 結合使用。

如果尚未建立 Remotion 專案,請先載入「建立新的 Remotion 影片」(remotion-create 技能)。

Element 函式庫

任何網站都可以是 Element 函式庫,且所有 Element 函式庫都是對等的。 擷取 https://www.remotion.dev/elements/libraries.md 以取得目前的 Element 函式庫列表,包含每個函式庫的網址與 Markdown 索引。 CLI 需要一個 Element 頁面網址。若要在未列出的 Element 函式庫中找到一個,請擷取其 Markdown 索引(通常位於其網域的 /llms.txt,或透過在頁面網址後附加 .md)。

安裝 Element 函式庫

安裝 Element 函式庫會將其列在 Remotion Studio 的「瀏覽 Elements」中,使用者可以在其中預覽 Element 並將其拖入合成中。 在從 Element 函式庫新增 Element 之前,請先安裝該函式庫。請執行以下指令:

npx remotion elements add-library <library-url>
  • 使用 Element 函式庫列表中的函式庫網址,或使用者提供的網址。
  • 該指令會將 Config.addElementLibrary() 的呼叫新增到 remotion.config.ts。如果該函式庫已存在於設定中,則不會有任何變更。
  • 它會從函式庫頁面讀取顯示名稱。若要覆蓋,請傳遞 --display-name <name>。
  • No Remotion config file found: 建立 remotion.config.ts,內容包含 import {Config} from '@remotion/cli/config';,然後再次執行指令。
  • 需要 Remotion 4.0.547 或更新版本。在較舊的版本上,請自行將 Config.addElementLibrary({url: '<library-url>'}) 呼叫新增到 remotion.config.ts。

新增 Element

請複製此檢查清單並追蹤進度:

- [ ] 1. 取得 Element 頁面網址並安裝其 Element 函式庫
- [ ] 2. 試運行成功
- [ ] 3. Element 已安裝
- [ ] 4. Element 已調整並預覽

1. 取得 Element 頁面網址並安裝其 Element 函式庫

  • 如果提供了 Element 頁面網址: 直接使用。
  • 如果提供了 Element 函式庫網址或名稱: 擷取該函式庫的 Markdown 索引,選擇使用者要求的 Element,並使用其 Element 頁面網址。
  • 如果未提供任何資訊: 搜尋 Element 函式庫的 Markdown 索引,尋找適合該影片的 Element。

Markdown 索引會連結到 Markdown 文件,而安裝程式無法使用這些文件。 請擷取 Element 的 Markdown 文件,並使用其附近命名的 Element 頁面網址,例如在 Element page: 或 URL: 之後。 如果未命名任何網址,請從文件網址中移除 .md。

如果該 Element 來自已知的 Element 函式庫,請安裝該函式庫。如果僅提供 Element 頁面網址,則跳過此步驟。

2. 試運行

請執行以下指令:

npx remotion elements use <element-page-url> --composition <composition-id> --dry-run

讀取輸出結果,並在繼續前修正原因:

  • No Element found: 搜尋該頁面 HTML 中的 application/vnd.remotion.element+json。如果具有該類型的 <link> 包含 href,請將 href 相對於 Element 頁面網址解析,然後對該 JSON 網址進行試運行。如果沒有酬載,則該元件不是 Element。請遵循其 Markdown 頁面上的安裝說明(例如 shadcn 指令),然後跳到步驟 4。
  • 頁面上有多個 Element: 新增 --element <slug>。
  • 列出了合成 ID: 傳遞使用者正在處理的合成。如果不清楚,請詢問。
  • 無法識別 elements use 或 --dry-run: Remotion 版本低於 4.0.543。請載入 Remotion 升級(remotion-upgrade 技能)或詢問使用者。

重複直到試運行印出 Element、將要建立和變更的檔案、套件和素材。

3. 安裝

改用 --yes 而非 --dry-run 執行相同的指令:

npx remotion elements use <element-page-url> --composition <composition-id> --yes

該指令會安裝缺少的套件,將素材儲存到 public/,在合成元件的旁邊寫入一個 .element.tsx 檔案,並在第 0 影格插入 Element。

  • 如果 .element.tsx 檔案已存在且內容不同,則指令會失敗。僅在使用者同意的情況下新增 --overwrite。
  • Element 的原始碼會在專案中執行。僅從使用者提供或使用者信任的 Element 函式庫的 Element 頁面網址進行安裝。

4. 調整與預覽

  • 根據影片調整文字、顏色和屬性。
  • 調整包裹的 <Sequence> 以控制時間軸與位置。
  • 在編輯標記之前,請先載入 Remotion 標記最佳實踐(remotion-markup 技能)。
  • 在 Studio 中開啟合成,並檢查 Element 是否能正確渲染。修正錯誤並再次檢查。

參考資料

Individual skills in this repo

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

相關技能