Skip to content

πŸŽ₯ Make videos programmatically with React

WIP: AI docs updates

ASchwadc229b353a4a0
diff --git a/packages/docs/docs/ai/dynamic-compilation.mdx b/packages/docs/docs/ai/dynamic-compilation.mdx
new file mode 100644
index 0000000000..3bea3a8948
--- /dev/null
+++ b/packages/docs/docs/ai/dynamic-compilation.mdx
@@ -0,0 +1,469 @@
+---
+image: /generated/articles-docs-ai-dynamic-compilation.png
+crumb: 'AI'
+title: Dynamic Compilation
+sidebar_label: Dynamic Compilation
+---
+
+import Tabs from '@theme/Tabs';
+import TabItem from '@theme/TabItem';
+
+This guide shows how to take Remotion code (a string) and compile it in the browser to display a live preview. No server round-trip required. This is especially useful for AI-generated workflows where the code reuqires dynamic compilation to be shown as it was only just generated and never ran through the build process.
+
+## The Goal
+
+You have a code string from an AI model:
+
+```ts
+const generatedCode = `
+import { useCurrentFrame, AbsoluteFill } from "remotion";
+
+export const MyComposition = () => {
+ const frame = useCurrentFrame();
+ return (
+ <AbsoluteFill style={{ backgroundColor: "white", justifyContent: "center", alignItems: "center" }}>
+ <div style={{ fontSize: 100 }}>{frame}</div>
+ </AbsoluteFill>
+ );
+};
+`;
+```
+
+And you want to turn it into a live, interactive preview:
+
+```tsx
+<Player component={CompiledComponent} durationInFrames={150} fps={30} />
+```
+
+This page shows exactly how to bridge that gap.
+
+## Installation
+
+```bash
+npm install @babel/standalone remotion @remotion/player
+```
+
+`@babel/standalone` runs Babel entirely in the browser, allowing you to transpile JSX and TypeScript without a build server.
+
+## Basic Compilation
+
+Here's a minimal `compileCode` function that takes a code string and returns a React component:
+
+```tsx twoslash title="compile-code.ts"
+import * as Babel from '@babel/standalone';
+import React from 'react';
+import {AbsoluteFill, useCurrentFrame, useVideoConfig, spring, interpolate, Sequence} from 'remotion';
+
+interface CompilationResult {
+ Component: React.ComponentType | null;
+ error: string | null;
+}
+
+export function compileCode(code: string): CompilationResult {
+ if (!code?.trim()) {
+ return {Component: null, error: 'No code provided'};
+ }
+
+ try {
+ // Step 1: Strip imports (we inject APIs manually)
+ const codeWithoutImports = code.replace(/^import\s+.*$/gm, '').trim();
+
+ // Step 2: Extract the component body
+ // Handles: export const MyComposition = () => { ... };
+ const match = codeWithoutImports.match(/export\s+const\s+\w+\s*=\s*\(\s*\)\s*=>\s*\{([\s\S]*)\};?\s*$/);
+ const componentBody = match ? match[1].trim() : codeWithoutImports;
+
+ // Step 3: Wrap in a component function
+ const wrappedSource = `const DynamicComponent = () => {\n${componentBody}\n};`;
+
+ // Step 4: Transpile JSX/TypeScript to JavaScript
+ const transpiled = Babel.transform(wrappedSource, {
+ presets: ['react', 'typescript'],
+ filename: 'dynamic.tsx',
+ });
+
+ if (!transpiled.code) {
+ return {Component: null, error: 'Transpilation failed'};
+ }
+
+ // Step 5: Create the component using Function constructor
+ // This injects Remotion APIs as available variables
+ const createComponent = new Function('React', 'AbsoluteFill', 'useCurrentFrame', 'useVideoConfig', 'spring', 'interpolate', 'Sequence', `${transpiled.code}\nreturn DynamicComponent;`);
+
+ const Component = createComponent(React, AbsoluteFill, useCurrentFrame, useVideoConfig, spring, interpolate, Sequence);
+
+ if (typeof Component !== 'function') {
+ return {Component: null, error: 'Compilation did not produce a valid component'};
+ }
+
+ return {Component, error: null};
+ } catch (error) {
+ return {
+ Component: null,
+ error: error instanceof Error ? error.message : 'Unknown compilation error',
+ };
+ }
+}
+```
+
+## Using the Compiled Component
+
+Once you have a compiled component, pass it to the Remotion Player:
+
+```tsx twoslash title="DynamicPlayer.tsx"
+// @noErrors
+import {Player} from '@remotion/player';
+import {useState, useEffect} from 'react';
+import {compileCode} from './compile-code';
+
+interface DynamicPlayerProps {
+ code: string;
+ durationInFrames?: number;
+ fps?: number;
+}
+
+export const DynamicPlayer: React.FC<DynamicPlayerProps> = ({code, durationInFrames = 150, fps = 30}) => {
+ const [Component, setComponent] = useState<React.ComponentType | null>(null);
+ const [error, setError] = useState<string | null>(null);
+
+ useEffect(() => {
+ const result = compileCode(code);
+ if (result.error) {
+ setError(result.error);
+ setComponent(null);
+ } else {
+ setComponent(() => result.Component);
+ setError(null);
+ }
+ }, [code]);
+
+ if (error) {
+ return (
+ <div style={{color: 'red', padding: 20}}>
+ <strong>Compilation Error:</strong> {error}
+ </div>
+ );
+ }
+
+ if (!Component) {
+ return <div>Loading...</div>;
+ }
+
+ return <Player component={Component} durationInFrames={durationInFrames} fps={fps} compositionWidth={1920} compositionHeight={1080} style={{width: '100%'}} controls />;
+};
+```
+
+## Full Example
+
+Putting it all together:
+
+```tsx twoslash title="App.tsx"
+// @noErrors
+import {DynamicPlayer} from './DynamicPlayer';
+
+const generatedCode = `
+import { useCurrentFrame, AbsoluteFill, spring, useVideoConfig } from "remotion";
+
+export const MyComposition = () => {
+ const frame = useCurrentFrame();
+ const { fps } = useVideoConfig();
+
+ const scale = spring({
+ frame,
+ fps,
+ config: { damping: 10, stiffness: 100 },
+ });
+
+ return (
+ <AbsoluteFill style={{
+ backgroundColor: "#0f0f0f",
+ justifyContent: "center",
+ alignItems: "center"
+ }}>
+ <div style={{
+ fontSize: 120,
+ color: "white",
+ transform: \`scale(\${scale})\`
+ }}>
+ Hello World
+ </div>
+ </AbsoluteFill>
+ );
+};
+`;
+
+export default function App() {
+ return <DynamicPlayer code={generatedCode} durationInFrames={90} fps={30} />;
+}
+```
+
+## Understanding the Compilation Steps
+
+### 1. Strip Imports
+
+AI-generated code typically includes import statements:
+
+```ts
+import {useCurrentFrame, AbsoluteFill} from 'remotion';
+```
+
+Since we inject these APIs manually via the Function constructor, we remove imports:
+
+```ts
+const codeWithoutImports = code.replace(/^import\s+.*$/gm, '').trim();
+```
+
+### 2. Extract Component Body
+
+The generated code exports a component. We need to extract just the function body:
+
+```ts
+// From this:
+export const MyComposition = () => {
+ const frame = useCurrentFrame();
+ return <div>{frame}</div>;
+};
+
+// To this:
+const frame = useCurrentFrame();
+return <div>{frame}</div>;
+```
+
+### 3. Babel Transpilation
+
+`@babel/standalone` converts JSX and TypeScript to plain JavaScript that browsers can execute:
+
+```ts
+const transpiled = Babel.transform(wrappedSource, {
+ presets: ['react', 'typescript'],
+ filename: 'dynamic.tsx',
+});
+```
+
+The `react` preset handles JSX, and `typescript` handles type annotations.
+
+### 4. API Injection via Function Constructor
+
+The key technique is using JavaScript's `Function` constructor to create a function with specific variables in scope:
+
+```ts
+const createComponent = new Function(
+ 'React', // Parameter 1
+ 'useCurrentFrame', // Parameter 2
+ 'AbsoluteFill', // Parameter 3
+ // ... more parameters
+ `${transpiled.code}\nreturn DynamicComponent;`, // Function body
+);
+```
+
+When called with the actual values, these become available inside the generated code:
+
+```ts
+const Component = createComponent(
+ React, // Value for parameter 1
+ useCurrentFrame, // Value for parameter 2
+ AbsoluteFill, // Value for parameter 3
+ // ... more values
+);
+```
+
+## Extending with More APIs
+
+To support more Remotion features, add them to both the Function parameters and arguments:
+
+```tsx twoslash title="compile-code-extended.ts"
+// @noErrors
+import * as Babel from '@babel/standalone';
+import React, {useState, useEffect, useMemo, useRef} from 'react';
+import {AbsoluteFill, useCurrentFrame, useVideoConfig, spring, interpolate, interpolateColors, Easing, Sequence, Series, Img, Audio, Video, OffthreadVideo} from 'remotion';
+import * as RemotionShapes from '@remotion/shapes';
+import {TransitionSeries, linearTiming, springTiming} from '@remotion/transitions';
+import {fade} from '@remotion/transitions/fade';
+import {slide} from '@remotion/transitions/slide';
+
+export function compileCode(code: string) {
+ // ... same setup code ...
+
+ const createComponent = new Function(
+ // React
+ 'React',
+ 'useState',
+ 'useEffect',
+ 'useMemo',
+ 'useRef',
+ // Core Remotion
+ 'AbsoluteFill',
+ 'useCurrentFrame',
+ 'useVideoConfig',
+ 'spring',
+ 'interpolate',
+ 'interpolateColors',
+ 'Easing',
+ 'Sequence',
+ 'Series',
+ 'Img',
+ 'Audio',
+ 'Video',
+ 'OffthreadVideo',
+ // Shapes
+ 'Rect',
+ 'Circle',
+ 'Triangle',
+ 'Star',
+ 'Ellipse',
+ // Transitions
+ 'TransitionSeries',
+ 'linearTiming',
+ 'springTiming',
+ 'fade',
+ 'slide',
+ // The code
+ `${transpiled.code}\nreturn DynamicComponent;`,
+ );
+
+ const Component = createComponent(
+ React,
+ useState,
+ useEffect,
+ useMemo,
+ useRef,
+ AbsoluteFill,
+ useCurrentFrame,
+ useVideoConfig,
+ spring,
+ interpolate,
+ interpolateColors,
+ Easing,
+ Sequence,
+ Series,
+ Img,
+ Audio,
+ Video,
+ OffthreadVideo,
+ RemotionShapes.Rect,
+ RemotionShapes.Circle,
+ RemotionShapes.Triangle,
+ RemotionShapes.Star,
+ RemotionShapes.Ellipse,
+ TransitionSeries,
+ linearTiming,
+ springTiming,
+ fade,
+ slide,
+ );
+
+ // ... rest of the function
+}
+```
+
+## Error Handling
+
+Wrap the Player with an error boundary to catch runtime errors:
+
+```tsx twoslash title="PlayerWithErrorBoundary.tsx"
+// @noErrors
+import {Player, type ErrorFallback} from '@remotion/player';
+
+const errorFallback: ErrorFallback = ({error}) => (
+ <div
+ style={{
+ display: 'flex',
+ justifyContent: 'center',
+ alignItems: 'center',
+ height: '100%',
+ backgroundColor: '#1a1a1a',
+ color: '#ff6b6b',
+ padding: 20,
+ }}
+ >
+ <div style={{textAlign: 'center'}}>
+ <h3>Runtime Error</h3>
+ <pre style={{color: '#fff', fontSize: 14}}>{error.message}</pre>
+ </div>
+ </div>
+);
+
+<Player component={Component} durationInFrames={150} fps={30} compositionWidth={1920} compositionHeight={1080} errorFallback={errorFallback} />;
+```
+
+There are three types of errors to handle:
+
+1. **Syntax errors** - Babel fails to parse the code
+2. **Compilation errors** - The Function constructor fails
+3. **Runtime errors** - The component throws during rendering
+
+The `compileCode` function catches the first two. The Player's `errorFallback` prop handles the third.
+
+## React Hook: useCompilation
+
+For a cleaner React integration, create a custom hook:
+
+```tsx twoslash title="useCompilation.ts"
+// @noErrors
+import {useState, useEffect, useCallback} from 'react';
+import {compileCode, type CompilationResult} from './compile-code';
+
+export function useCompilation(initialCode: string = '') {
+ const [code, setCode] = useState(initialCode);
+ const [result, setResult] = useState<CompilationResult>({
+ Component: null,
+ error: null,
+ });
+ const [isCompiling, setIsCompiling] = useState(false);
+
+ const compile = useCallback((codeToCompile: string) => {
+ setIsCompiling(true);
+ const compilationResult = compileCode(codeToCompile);
+ setResult(compilationResult);
+ setIsCompiling(false);
+ }, []);
+
+ // Auto-compile on code change with debounce
+ useEffect(() => {
+ const timeout = setTimeout(() => {
+ if (code) compile(code);
+ }, 300);
+ return () => clearTimeout(timeout);
+ }, [code, compile]);
+
+ return {
+ code,
+ setCode,
+ Component: result.Component,
+ error: result.error,
+ isCompiling,
+ compile,
+ };
+}
+```
+
+Usage:
+
+```tsx
+const {code, setCode, Component, error, isCompiling} = useCompilation(initialCode);
+```
+
+## Security Considerations
+
+Dynamic code execution carries inherent risks. The AI-generated code runs with full access to the browser context.
+
+For production applications, consider:
+
+- **iframe isolation** - Run the Player in a sandboxed iframe
+- **Web Worker compilation** - Move Babel transpilation to a worker
+- **Content Security Policy** - Restrict what the generated code can access
+- **Code validation** - Check for potentially harmful patterns before compilation
+
+## Template
+
+For a production-ready implementation with validation, streaming, skill detection and more, see the [Prompt to Motion Graphics template](https://github.com/remotion-dev/remotion/tree/main/packages/template-prompt-to-motion-graphics):
+
+```bash
+npx create-video@latest --prompt-to-motion-graphics
+```
+
+## See Also
+
+- [Code Generation](/docs/ai/generate) - How to generate Remotion code with AI
+- [Player](/docs/player) - Remotion Player documentation
+- [System Prompt](/docs/ai/system-prompt) - Teaching LLMs about Remotion
diff --git a/packages/docs/docs/ai/generate-code.mdx b/packages/docs/docs/ai/generate-code.mdx
new file mode 100644
index 0000000000..21131efd2c
--- /dev/null
+++ b/packages/docs/docs/ai/generate-code.mdx
@@ -0,0 +1,99 @@
+---
+image: /generated/articles-docs-ai-generate-code.png
+crumb: 'AI'
+title: Code Generation Details
+sidebar_label: Code Generation Details
+---
+
+This page covers the process of generating Remotion code from natural language prompts using AI.
+
+## Validation
+
+Before calling an expensive code generation model, run a validation step to filter invalid requests early. This could potentially be done with a cheaper and faster model than GPT5.2
+
+**Valid prompts** describe visual, animated content: animated text, data visualizations, UI animations, social media content, abstract motion graphics.
+
+**Invalid prompts** should be filtered: questions, conversational requests, non-visual tasks.
+
+Use a lightweight model call with structured output returning a boolean. On failure, return a helpful error message before any expensive API calls are made.
+
+## Skill Detection
+
+After validation, analyze the prompt to identify which **skills** are relevant. Skills are modular knowledge units that provide domain-specific guidance.
+
+### How Skills Work
+
+1. A classifier model analyzes the user prompt
+2. It returns an array of matching skill names
+3. The relevant skill content is injected into the system prompt
+4. Only pertinent expertise is included, keeping context focused
+
+### Skill Categories
+
+Skills enable contextual expertise without bloating every prompt.
+
+#### Guidance Skills
+
+| Skill | Purpose |
+| ------------------ | --------------------------------------------------------------------------------------- |
+| **charts** | Data visualization patterns - bar charts, pie charts, axis labels, staggered animations |
+| **typography** | Kinetic text - typewriter effects, word carousels, text highlights |
+| **messaging** | Chat UI - bubble layouts, WhatsApp/iMessage styling, staggered entrances |
+| **transitions** | Scene changes - TransitionSeries, fade/slide/wipe effects |
+| **sequencing** | Timing control - Sequence, Series, staggered delays |
+| **spring-physics** | Organic motion - spring configs, bounce effects, chained animations |
+| **social-media** | Platform-specific formats - aspect ratios, safe zones |
+| **3d** | Three.js integration - 3D scenes, camera setup |
+
+#### Example Skills
+
+Example skills provide complete working code references (histogram, chat messages, typewriter effects, etc.) that demonstrate these patterns in action. Think of them as implementation archetypes that can be adapted for the user's prompt. The current archetypes can be also checked out live in the `Code Examples` area of the app.
+
+### Benefits
+
+- Base prompt stays lightweight
+- Context is relevant to the specific request
+- Reduces token usage on simple prompts
+- Improves output quality for specialized domains
+- Can easily be extended for more guidance and examples
+
+## System Prompt Design
+
+A previous approach of using a single System Prompt without skills can be found [here](/docs/ai/system-prompt).
+
+In our system prompt, we limit the guidance to absolutely critical elements that every generation requires. Then we inject the detected skills to the system prompt.
+
+Key principles that emphasize on every prompt, regardless of the injected skills:
+
+### Constants-First Pattern
+
+All customizable values should be defined as constants at the top. This makes it easy for users to modify colors, text, and timing without digging through the component.
+
+### Spring Physics
+
+Prefer `spring()` over `interpolate()` for natural, organic motion. Linear animations feel mechanical - spring physics adds life and polish.
+
+### Crossfade Layers
+
+For smooth state transitions, use overlapping opacity animations rather than abrupt switches. This prevents jarring visual jumps.
+
+### Reserved Names
+
+Warn against shadowing Remotion's built-in functions: `spring`, `interpolate`, `useCurrentFrame`, `useVideoConfig`, `Sequence`, `AbsoluteFill`.
+
+## Sanitization
+
+AI responses often contain extra content that needs to be cleaned:
+
+1. **Strip markdown wrappers** - Remove ` ```tsx ` code block markers
+2. **Extract component code** - Use brace-counting to find where the component ends, cutting off trailing commentary
+3. **Validate structure** - Check that the output contains a valid exported React component
+
+## Streaming
+
+For better UX, stream the generated code using Server-Sent Events. This provides real-time feedback as the code is generated, rather than waiting for the complete response.
+
+## See Also
+
+- [Browser Compilation](/docs/ai/generate-compile) - Compile and preview generated code in the browser
+- [System Prompt](/docs/ai/system-prompt) - The foundation prompt for teaching LLMs Remotion
diff --git a/packages/docs/docs/ai/generate.mdx b/packages/docs/docs/ai/generate.mdx
index 489f2ae83a..526b9e221b 100644
--- a/packages/docs/docs/ai/generate.mdx
+++ b/packages/docs/docs/ai/generate.mdx
@@ -173,11 +173,12 @@ const {output} = await generateText({
## Next Steps
-Once you have the generated code string, you need to compile and render it. The next guide will show how to turn this code string into a live preview using `@babel/standalone`.
+Now what can you even do with this component code? Could be a first draft for an animation that you would like to use in your software or an inspiration to learn other ways to use the Remotion APIs.
+Making it easy to see this generated component code is important. But you need to compile and render it. The [next guide](/docs/ai/dynamic-compilation) will show how to turn this code string into a live preview right within your browser.
## Template
-For a production-ready implementation with validation, skill detection, and streaming, see the [Prompt to Motion Graphics template](https://github.com/remotion-dev/remotion/tree/main/packages/template-prompt-to-motion-graphics):
+For an remotion code generation implementation with validation, skill detection, streaming and more, see the [Prompt to Motion Graphics template](https://github.com/remotion-dev/remotion/tree/main/packages/template-prompt-to-motion-graphics):
```bash
npx create-video@latest --prompt-to-motion-graphics
@@ -185,5 +186,6 @@ npx create-video@latest --prompt-to-motion-graphics
## See Also
+- [Dynamic Compilation](/docs/ai/dynamic-compilation)
- [System Prompt](/docs/ai/system-prompt) - The full system prompt for teaching LLMs Remotion
- [Agent Skills](/docs/ai/skills) - Modular knowledge units for AI coding assistants
diff --git a/packages/template-prompt-to-motion-graphics/README.md b/packages/template-prompt-to-motion-graphics/README.md
index 72dc359040..6449ffadf5 100644
--- a/packages/template-prompt-to-motion-graphics/README.md
+++ b/packages/template-prompt-to-motion-graphics/README.md
@@ -9,73 +9,91 @@
</a>
</p>
-AI-powered motion graphics - creating Remotion code from a natural language prompt.
+AI-powered motion graphics generator that transforms natural language prompts into Remotion code.
-## Process Overview
+## Architecture
```
-User Prompt β†’ Validation β†’ Code Generation β†’ Sanitization β†’ Compilation β†’ Remotion Preview
+User Prompt β†’ Validation β†’ Skill Detection β†’ Code Generation β†’ Sanitization β†’ Live Preview
```
-### Overview - How It Works
+## How It Works
-1. **Validation** (`/api/generate`) - Classifies if the prompt is valid motion graphics content before calling the expensive generation model
+### 1. Validation
-2. **Code Generation** - Uses OpenAI with a detailed system prompt containing animation patterns and examples. Code is streamed via Server-Sent Events for real-time feedback
+Before expensive model calls, a lightweight classifier determines if the prompt describes valid motion graphics content.
-3. **Sanitization** (`sanitize-response.ts`) - Extracts clean component code from AI output using brace-counting to handle trailing commentary
+**Accepted**: animated text, data visualizations, UI animations, social media content, abstract motion graphics
-4. **Compilation** (`compiler.ts`) - Transpiles the code string in the browser to an executable React component using Babel, then renders in the standard Remotion Preview
+**Rejected**: questions, conversational requests, non-visual tasks
-### Validation
+### 2. Skill Detection
-Before calling the expensive code generation model, we run a cheap validation step using `generateObject()` to classify whether a prompt is valid motion graphics content. This returns a simple boolean.
+The system analyzes the prompt to identify which **skills** are relevant. Skills are modular knowledge units that provide domain-specific guidance to the code generation model.
-**Valid prompts** include requests for:
+There are two types of skills:
-- Animated text, titles, kinetic typography
-- Data visualizations (charts, graphs, progress bars)
-- UI animations, logo animations, brand intros
-- Social media content, explainer animations
-- Abstract motion graphics, animated illustrations
+- **Guidance Skills** - Pattern libraries with best practices for specific domains (charts, typography, transitions, etc.)
+- **Example Skills** - Complete working code references that demonstrate specific animation patterns
-**Invalid prompts** are filtered out:
+This approach keeps the base prompt lightweight while dynamically injecting only the relevant expertise for each request.
-- Questions ("What is 2+2?", "How do I...")
-- Text content requests (conversational, tell me a joke, ...)
-- Non-visual tasks (calculations, translations)
+### 3. Code Generation
-On validation failure, the user gets a helpful error message before any expensive API calls are made.
+Uses a one-shot prompt with the base Remotion knowledge plus any detected skills. The generated code follows these principles:
-### Code Generation
+- **Constants-first design** - All text, colors, and timing values are declared as editable constants at the top
+- **Aesthetic defaults** - Guidance on visual polish, spacing, and animation feel
+- **Crossfade patterns** - Smooth state transitions without layout jumps
+- **Spring physics** - Natural, organic motion using Remotion's spring() function
-The current prompting approach is a simple one-shot prompt without LLM loops or example lookups. GPT 5.2 Low reasoning seems to be a good middle ground between generation speed and output quality.
+### 4. Sanitization & Compilation
-Contents of the system prompt
+The response is cleaned (removing markdown wrappers and trailing commentary), then compiled in-browser using Babel. The compiled component renders directly in the Remotion Preview with all necessary APIs injected.
-- **Constants-first**: All text, colors, and timing as editable constants. This helps user to easily change the variables in the editor
-- General **aesthetic guidance** on motion graphic for better output
-- **Crossfade layers**: Smooth state transitions without layout jumps
-- **Reserved names**: Warns against shadowing `spring`, `interpolate`, hooks
-- **Output Examples** to give the LLM an understanding of what we are expecting
+## Skills System
-### Sanitization
+Skills enable contextual expertise without bloating every prompt. Located in `src/skills/`:
-The AI response may contain markdown wrappers (```tsx blocks) or trailing commentary after the code. The sanitization step:
+### Guidance Skills
-- Strips markdown code block wrappers
-- Uses brace-counting to extract only the component code, cutting off any explanatory text the model adds after the closing brace
-- Validates that the output contains valid JSX using regex checks
+| Skill | Purpose |
+| ------------------ | --------------------------------------------------------------------------------------- |
+| **charts** | Data visualization patterns - bar charts, pie charts, axis labels, staggered animations |
+| **typography** | Kinetic text - typewriter effects, word carousels, text highlights |
+| **messaging** | Chat UI - bubble layouts, WhatsApp/iMessage styling, staggered entrances |
+| **transitions** | Scene changes - TransitionSeries, fade/slide/wipe effects |
+| **sequencing** | Timing control - Sequence, Series, staggered delays |
+| **spring-physics** | Organic motion - spring configs, bounce effects, chained animations |
+| **social-media** | Platform-specific formats - aspect ratios, safe zones |
+| **3d** | Three.js integration - 3D scenes, camera setup |
-### Compilation
+### Example Skills (Code Snippets)
-For a good end to end user experience, it is a priority to directly show a preview of the generated remotion code in the same app.
+Example skills provide complete working references (histogram, chat messages, typewriter effects, etc.) that demonstrate these patterns in action. We think of them like implementation archetypes that can be used and adjusted for the user prompt.
-- Extracts the component body from the ES6 module format - we get rid of the imports and just extract the component itself `export const MyAnimation = () => { ... };`
-- Transpiles JSX/TypeScript to JavaScript using Babel (in-browser)
-- Creates a `Function` constructor with all Remotion APIs injected, we did a pre-selection of common available APIs that can be used for the animations(`useCurrentFrame`, `spring`, `interpolate`, `Sequence`, `AbsoluteFill`, etc.)
-- Also injects shape libraries (`@remotion/shapes`), Lottie support, and Three.js for 3D
-- The compiled component is then rendered in the standard Remotion Preview
+## Usage Tips
+
+**Prompting best practices:**
+
+- Be specific about colors, timing, and layout ("green sent bubbles on the right, gray received on the left")
+- Include data directly in the prompt for charts and visualizations
+- Describe the animation feel you want ("bouncy spring entrance", "smooth fade", "staggered timing")
+
+**Images:**
+
+- Direct image uploads are not supported
+- Reference images via URL - the generated code will use Remotion's `<Img>` component
+- Example: _"Create a DVD screensaver animation of this image https://example.com/logo.png"_
+
+**What works well:**
+
+- Kinetic typography and text animations
+- Data visualizations with animated entrances
+- Chat/messaging UI mockups
+- Social media content (Stories, Reels, TikTok)
+- Logo animations and brand intros
+- Abstract motion graphics
## Commands