-
Notifications
You must be signed in to change notification settings - Fork 68
Add remotion best practices skill bundle #648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| --- | ||
| name: remotion-best-practices | ||
| description: Best practices for Remotion - Video creation in React | ||
| metadata: | ||
| tags: remotion, video, react, animation, composition | ||
| --- | ||
|
|
||
| ## When to use | ||
|
|
||
| Use this skills whenever you are dealing with Remotion code to obtain the domain-specific knowledge. | ||
|
|
||
| ## How to use | ||
|
|
||
| Read individual rule files for detailed explanations and code examples: | ||
|
|
||
| - [rules/3d.md](rules/3d.md) - 3D content in Remotion using Three.js and React Three Fiber | ||
| - [rules/animations.md](rules/animations.md) - Fundamental animation skills for Remotion | ||
| - [rules/assets.md](rules/assets.md) - Importing images, videos, audio, and fonts into Remotion | ||
| - [rules/audio.md](rules/audio.md) - Using audio and sound in Remotion - importing, trimming, volume, speed, pitch | ||
| - [rules/calculate-metadata.md](rules/calculate-metadata.md) - Dynamically set composition duration, dimensions, and props | ||
| - [rules/can-decode.md](rules/can-decode.md) - Check if a video can be decoded by the browser using Mediabunny | ||
| - [rules/charts.md](rules/charts.md) - Chart and data visualization patterns for Remotion | ||
| - [rules/compositions.md](rules/compositions.md) - Defining compositions, stills, folders, default props and dynamic metadata | ||
| - [rules/display-captions.md](rules/display-captions.md) - Displaying captions in Remotion with TikTok-style pages and word highlighting | ||
| - [rules/extract-frames.md](rules/extract-frames.md) - Extract frames from videos at specific timestamps using Mediabunny | ||
| - [rules/fonts.md](rules/fonts.md) - Loading Google Fonts and local fonts in Remotion | ||
| - [rules/get-audio-duration.md](rules/get-audio-duration.md) - Getting the duration of an audio file in seconds with Mediabunny | ||
| - [rules/get-video-dimensions.md](rules/get-video-dimensions.md) - Getting the width and height of a video file with Mediabunny | ||
| - [rules/get-video-duration.md](rules/get-video-duration.md) - Getting the duration of a video file in seconds with Mediabunny | ||
| - [rules/gifs.md](rules/gifs.md) - Displaying GIFs synchronized with Remotion's timeline | ||
| - [rules/images.md](rules/images.md) - Embedding images in Remotion using the Img component | ||
| - [rules/import-srt-captions.md](rules/import-srt-captions.md) - Importing .srt subtitle files into Remotion using @remotion/captions | ||
| - [rules/lottie.md](rules/lottie.md) - Embedding Lottie animations in Remotion | ||
| - [rules/measuring-dom-nodes.md](rules/measuring-dom-nodes.md) - Measuring DOM element dimensions in Remotion | ||
| - [rules/measuring-text.md](rules/measuring-text.md) - Measuring text dimensions, fitting text to containers, and checking overflow | ||
| - [rules/sequencing.md](rules/sequencing.md) - Sequencing patterns for Remotion - delay, trim, limit duration of items | ||
| - [rules/tailwind.md](rules/tailwind.md) - Using TailwindCSS in Remotion | ||
| - [rules/text-animations.md](rules/text-animations.md) - Typography and text animation patterns for Remotion | ||
| - [rules/timing.md](rules/timing.md) - Interpolation curves in Remotion - linear, easing, spring animations | ||
| - [rules/transcribe-captions.md](rules/transcribe-captions.md) - Transcribing audio to generate captions in Remotion | ||
| - [rules/transitions.md](rules/transitions.md) - Scene transition patterns for Remotion | ||
| - [rules/trimming.md](rules/trimming.md) - Trimming patterns for Remotion - cut the beginning or end of animations | ||
| - [rules/videos.md](rules/videos.md) - Embedding videos in Remotion - trimming, volume, speed, looping, pitch | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "owner": "am-will", | ||
| "slug": "remotion-best-practices", | ||
| "displayName": "Remotion Best Practices", | ||
| "latest": { | ||
| "version": "1.0.0", | ||
| "publishedAt": 1769024303669, | ||
| "commit": "https://github.com/clawdbot/skills/commit/cf14c4a145107299b14a4eba382d442800fd4666" | ||
| }, | ||
| "history": [] | ||
| } | ||
|
Comment on lines
+1
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Search for any code that reads _meta.json from skill directories
rg -n "_meta\.json" --type ts --type jsRepository: truffle-ai/dexto Length of output: 42 🏁 Script executed: # Find and inspect the discover-skills file
fd -t f "discover-skills" --type tsRepository: truffle-ai/dexto Length of output: 229 🏁 Script executed: # Check what files are in the skill directories to understand the pattern
find .agents/skills -type f -name "*.md" -o -name "*.json" | head -20Repository: truffle-ai/dexto Length of output: 1184 🏁 Script executed: # Search broadly for any code that loads or validates skill metadata
rg -i "skill.*meta|meta.*skill" --type ts --type js -A 2 -B 2Repository: truffle-ai/dexto Length of output: 42 🏁 Script executed: # Check if _meta.json follows any naming convention or is referenced in any config files
rg "_meta" --type json --type md --type yaml --type yml -A 1 -B 1Repository: truffle-ai/dexto Length of output: 87 🏁 Script executed: # Find discover-skills file
fd -type f discover-skillsRepository: truffle-ai/dexto Length of output: 230 🏁 Script executed: # Search for "SKILL.md" to understand skill discovery patterns
rg "SKILL\.md" -A 3 -B 3Repository: truffle-ai/dexto Length of output: 35363 🏁 Script executed: # Look for any skill loading or discovery logic
rg -i "skills.*load|discover.*skill|skill.*discover" -A 2 -B 2Repository: truffle-ai/dexto Length of output: 18699 🏁 Script executed: # Check if there are any configuration files that define how skills are loaded
fd -type f -name "*.config.*" -o -name "*config.ts" -o -name "*config.js"Repository: truffle-ai/dexto Length of output: 230 Remove unused This file is not consumed by the skill discovery system, which only recognizes skill directories containing 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| --- | ||
| name: 3d | ||
| description: 3D content in Remotion using Three.js and React Three Fiber. | ||
| metadata: | ||
| tags: 3d, three, threejs | ||
| --- | ||
|
|
||
| # Using Three.js and React Three Fiber in Remotion | ||
|
|
||
| Follow React Three Fiber and Three.js best practices. | ||
| Only the following Remotion-specific rules need to be followed: | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| First, the `@remotion/three` package needs to be installed. | ||
| If it is not, use the following command: | ||
|
|
||
| ```bash | ||
| npx remotion add @remotion/three # If project uses npm | ||
| bunx remotion add @remotion/three # If project uses bun | ||
| yarn remotion add @remotion/three # If project uses yarn | ||
| pnpm exec remotion add @remotion/three # If project uses pnpm | ||
| ``` | ||
|
|
||
| ## Using ThreeCanvas | ||
|
|
||
| You MUST wrap 3D content in `<ThreeCanvas>` and include proper lighting. | ||
| `<ThreeCanvas>` MUST have a `width` and `height` prop. | ||
|
|
||
| ```tsx | ||
| import { ThreeCanvas } from "@remotion/three"; | ||
| import { useVideoConfig } from "remotion"; | ||
|
|
||
| const { width, height } = useVideoConfig(); | ||
|
|
||
| <ThreeCanvas width={width} height={height}> | ||
| <ambientLight intensity={0.4} /> | ||
| <directionalLight position={[5, 5, 5]} intensity={0.8} /> | ||
| <mesh> | ||
| <sphereGeometry args={[1, 32, 32]} /> | ||
| <meshStandardMaterial color="red" /> | ||
| </mesh> | ||
| </ThreeCanvas> | ||
| ``` | ||
|
|
||
| ## No animations not driven by `useCurrentFrame()` | ||
|
|
||
| Shaders, models etc MUST NOT animate by themselves. | ||
| No animations are allowed unless they are driven by `useCurrentFrame()`. | ||
| Otherwise, it will cause flickering during rendering. | ||
|
|
||
| Using `useFrame()` from `@react-three/fiber` is forbidden. | ||
|
|
||
| ## Animate using `useCurrentFrame()` | ||
|
|
||
| Use `useCurrentFrame()` to perform animations. | ||
|
|
||
| ```tsx | ||
| const frame = useCurrentFrame(); | ||
| const rotationY = frame * 0.02; | ||
|
|
||
| <mesh rotation={[0, rotationY, 0]}> | ||
| <boxGeometry args={[2, 2, 2]} /> | ||
| <meshStandardMaterial color="#4a9eff" /> | ||
| </mesh> | ||
| ``` | ||
|
|
||
| ## Using `<Sequence>` inside `<ThreeCanvas>` | ||
|
|
||
| The `layout` prop of any `<Sequence>` inside a `<ThreeCanvas>` must be set to `none`. | ||
|
|
||
| ```tsx | ||
| import { Sequence } from "remotion"; | ||
| import { ThreeCanvas } from "@remotion/three"; | ||
|
|
||
| const { width, height } = useVideoConfig(); | ||
|
|
||
| <ThreeCanvas width={width} height={height}> | ||
| <Sequence layout="none"> | ||
| <mesh> | ||
| <boxGeometry args={[2, 2, 2]} /> | ||
| <meshStandardMaterial color="#4a9eff" /> | ||
| </mesh> | ||
| </Sequence> | ||
| </ThreeCanvas> | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| --- | ||
| name: animations | ||
| description: Fundamental animation skills for Remotion | ||
| metadata: | ||
| tags: animations, transitions, frames, useCurrentFrame | ||
| --- | ||
|
|
||
| All animations MUST be driven by the `useCurrentFrame()` hook. | ||
| Write animations in seconds and multiply them by the `fps` value from `useVideoConfig()`. | ||
|
|
||
| ```tsx | ||
| import { useCurrentFrame } from "remotion"; | ||
|
|
||
| export const FadeIn = () => { | ||
| const frame = useCurrentFrame(); | ||
| const { fps } = useVideoConfig(); | ||
|
|
||
| const opacity = interpolate(frame, [0, 2 * fps], [0, 1], { | ||
| extrapolateRight: 'clamp', | ||
| }); | ||
|
|
||
| return ( | ||
| <div style={{ opacity }}>Hello World!</div> | ||
| ); | ||
| }; | ||
| ``` | ||
|
Comment on lines
+11
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing imports in the code example. The example uses 🔧 Proposed fix to add missing imports-import { useCurrentFrame } from "remotion";
+import { useCurrentFrame, useVideoConfig, interpolate } from "remotion";🤖 Prompt for AI Agents |
||
|
|
||
| CSS transitions or animations are FORBIDDEN - they will not render correctly. | ||
| Tailwind animation class names are FORBIDDEN - they will not render correctly. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| --- | ||
| name: assets | ||
| description: Importing images, videos, audio, and fonts into Remotion | ||
| metadata: | ||
| tags: assets, staticFile, images, fonts, public | ||
| --- | ||
|
|
||
| # Importing assets in Remotion | ||
|
|
||
| ## The public folder | ||
|
|
||
| Place assets in the `public/` folder at your project root. | ||
|
|
||
| ## Using staticFile() | ||
|
|
||
| You MUST use `staticFile()` to reference files from the `public/` folder: | ||
|
|
||
| ```tsx | ||
| import {Img, staticFile} from 'remotion'; | ||
|
|
||
| export const MyComposition = () => { | ||
| return <Img src={staticFile('logo.png')} />; | ||
| }; | ||
| ``` | ||
|
|
||
| The function returns an encoded URL that works correctly when deploying to subdirectories. | ||
|
|
||
| ## Using with components | ||
|
|
||
| **Images:** | ||
|
|
||
| ```tsx | ||
| import {Img, staticFile} from 'remotion'; | ||
|
|
||
| <Img src={staticFile('photo.png')} />; | ||
| ``` | ||
|
|
||
| **Videos:** | ||
|
|
||
| ```tsx | ||
| import {Video} from '@remotion/media'; | ||
| import {staticFile} from 'remotion'; | ||
|
|
||
| <Video src={staticFile('clip.mp4')} />; | ||
| ``` | ||
|
|
||
| **Audio:** | ||
|
|
||
| ```tsx | ||
| import {Audio} from '@remotion/media'; | ||
| import {staticFile} from 'remotion'; | ||
|
|
||
| <Audio src={staticFile('music.mp3')} />; | ||
| ``` | ||
|
|
||
| **Fonts:** | ||
|
|
||
| ```tsx | ||
| import {staticFile} from 'remotion'; | ||
|
|
||
| const fontFamily = new FontFace('MyFont', `url(${staticFile('font.woff2')})`); | ||
| await fontFamily.load(); | ||
| document.fonts.add(fontFamily); | ||
| ``` | ||
|
|
||
| ## Remote URLs | ||
|
|
||
| Remote URLs can be used directly without `staticFile()`: | ||
|
|
||
| ```tsx | ||
| <Img src="https://example.com/image.png" /> | ||
| <Video src="https://remotion.media/video.mp4" /> | ||
| ``` | ||
|
|
||
| ## Important notes | ||
|
|
||
| - Remotion components (`<Img>`, `<Video>`, `<Audio>`) ensure assets are fully loaded before rendering | ||
| - Special characters in filenames (`#`, `?`, `&`) are automatically encoded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the singular/plural typo in the usage guidance.
Use this skillsreads awkwardly in the entry-point doc.✏️ Suggested wording
📝 Committable suggestion
🤖 Prompt for AI Agents