Agent skill

Motion Canvas

by davila7 in davila7/claude-code-templates

Complete production-ready guide for Motion Canvas with ESM/CommonJS workarounds, full setup templates, and troubleshooting for programmatic video creation using TypeScript

MITAuto-check passed

Install Motion Canvas

skills CLI
$ npx skills add davila7/claude-code-templates --skill motion-canvas -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install davila7/claude-code-templates motion-canvas --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/davila7/claude-code-templates.git skills-src && mkdir -p .claude/skills && cp -r skills-src/cli-tool/components/skills/video/motion-canvas .claude/skills/motion-canvas && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
motion-canvas
GitHub stars
32k
Token cost
~2.8k tokens
SKILL.md length
750 words
Files
4 (incl. references)
Skills in repo
478
Repo updated
First seen
Licence
MIT

At a glance

Complete production-ready guide for Motion Canvas with ESM/CommonJS workarounds, full setup templates, and troubleshooting for programmatic video creation using TypeScript

  • Works in 10 steps: Initialize Project → Configure package.json for ESM → Install ALL Required Dependencies → …
  • SKILL.md covers ⚠️ CRITICAL: ESM/CommonJS…, When to use, Core Concepts and Complete Setup Guide, plus 6 more sections
  • Calls npm

What it does

Motion Canvas is an agent skill from davila7/claude-code-templates. Complete production-ready guide for Motion Canvas with ESM/CommonJS workarounds, full setup templates, and troubleshooting for programmatic video creation using TypeScript

Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/animations.md`, `references/generators.md` and `references/signals.md`).

It works with TypeScript and Vite. The repository describes itself as: CLI tool for configuring and monitoring Claude Code. The licence is MIT.

Example prompts

  • “/motion-canvas”

Requirements

  • Node.js

Workflow steps

10 steps, taken from the step headings in SKILL.md.

  1. Initialize Project
  2. Configure package.json for ESM
  3. Install ALL Required Dependencies
  4. Create Project Structure
  5. Create vite.config.js with ESM/CommonJS Workaround
  6. Create tsconfig.json
  7. Create index.html
  8. Create src/project.ts
  9. Create First Animation Scene
  10. Run Development Server

What it can do on your machine

Read from SKILL.md and the folder at commit 46b4d8b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • motioncanvas.io
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Motion Canvas loads about 2.8k tokens when it runs, and up to ~4.8k if it reads all its reference files. Until then it costs about 46 tokens; SKILL.md has 750 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~46
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~4.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from davila7/claude-code-templates at commit 46b4d8b, republished under its MIT licence (© davila7). 750 words, ~2,831 tokens.

Download SKILL.mdSave it as .claude/skills/motion-canvas/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
motion-canvas
description
Complete production-ready guide for Motion Canvas with ESM/CommonJS workarounds, full setup templates, and troubleshooting for programmatic video creation using TypeScript
version
2.0.0
author
motion-canvas
repo
https://github.com/motion-canvas/motion-canvas
license
MIT
tags
Video, TypeScript, Animation, Motion Canvas, Signals, Generators, Canvas API, Vector, Audio Sync, Vite, ESM
dependencies
@motion-canvas/core>=3.0.0, @motion-canvas/2d>=3.0.0, @motion-canvas/ui>=3.0.0, @motion-canvas/vite-plugin>=3.0.0

Motion Canvas - Production-Ready Video Creation with TypeScript

Complete production-ready skill for creating programmatic videos using Motion Canvas, including critical ESM/CommonJS workarounds, full configuration templates, and comprehensive troubleshooting.

⚠️ CRITICAL: ESM/CommonJS Interoperability Issue

IMPORTANT: The @motion-canvas/vite-plugin package is distributed as CommonJS, which causes import errors in modern ESM projects. The standard import motionCanvas from '@motion-canvas/vite-plugin' WILL NOT WORK.

You MUST use the createRequire workaround documented in the Setup section below.

When to use

Use this skill whenever you are dealing with Motion Canvas code to obtain domain-specific knowledge about:

  • Creating animated videos using TypeScript and generator functions
  • Building animations with signals and reactive values
  • Working with vector graphics and Canvas API
  • Synchronizing animations with voice-overs and audio
  • Using the real-time preview editor for instant feedback
  • Implementing procedural animations with flow control
  • Creating informative visualizations and diagrams
  • Animating text, shapes, and custom components
  • Setting up Motion Canvas projects from scratch with correct configuration
  • Troubleshooting common setup and build errors

Core Concepts

Motion Canvas allows you to create videos using:

  • Generator Functions: Describe animations using JavaScript generators with yield* syntax
  • Signals: Reactive values that automatically update dependent properties
  • Real-time Preview: Live editor with instant preview powered by Vite
  • TypeScript-First: Write animations in TypeScript with full IDE support
  • Canvas API: Leverage 2D Canvas for high-performance vector rendering
  • Audio Synchronization: Sync animations precisely with voice-overs

Complete Setup Guide

Step 1: Initialize Project
bash
# Create project directory
mkdir my-motion-canvas-project
cd my-motion-canvas-project

# Initialize package.json
npm init -y
Step 2: Configure package.json for ESM

CRITICAL: Add "type": "module" to enable ESM imports.

json
{
  "name": "my-motion-canvas-project",
  "version": "1.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  }
}
Step 3: Install ALL Required Dependencies

CRITICAL: Must include @motion-canvas/ui - the plugin will fail without it.

bash
npm install --save-dev @motion-canvas/core @motion-canvas/2d @motion-canvas/vite-plugin @motion-canvas/ui vite typescript
Step 4: Create Project Structure
my-motion-canvas-project/
├── package.json          # "type": "module" required
├── vite.config.js        # Use .js NOT .ts (see Step 5)
├── tsconfig.json         # TypeScript configuration
├── index.html            # HTML entry point
└── src/
    ├── project.ts        # Project configuration with scenes
    └── scenes/
        └── example.tsx   # Animation scene
Step 5: Create vite.config.js with ESM/CommonJS Workaround

CRITICAL: Use vite.config.js (NOT .ts) with the createRequire workaround.

File: vite.config.js

javascript
import {defineConfig} from 'vite';
import {createRequire} from 'module';

// WORKAROUND: @motion-canvas/vite-plugin is CommonJS, must use require
const require = createRequire(import.meta.url);
const motionCanvasModule = require('@motion-canvas/vite-plugin');
const motionCanvas = motionCanvasModule.default || motionCanvasModule;

export default defineConfig({
  plugins: [
    motionCanvas({
      project: './src/project.ts',
    }),
  ],
});

Why .js instead of .ts?

  • Vite config runs before TypeScript compilation
  • The createRequire workaround works reliably in plain JavaScript
  • Avoids additional type resolution complexity
Step 6: Create tsconfig.json

CRITICAL: Include esModuleInterop and allowSyntheticDefaultImports.

File: tsconfig.json

json
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ES2020",
    "lib": ["ES2020", "DOM"],
    "jsx": "react-jsx",
    "jsxImportSource": "@motion-canvas/2d/lib",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "skipLibCheck": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules"]
}
Step 7: Create index.html

File: index.html

html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Motion Canvas Project</title>
</head>
<body>
  <div id="root"></div>
  <script type="module" src="/src/project.ts"></script>
</body>
</html>
Step 8: Create src/project.ts

File: src/project.ts

typescript
import {makeProject} from '@motion-canvas/core';
import example from './scenes/example?scene';

export default makeProject({
  scenes: [example],
});
Step 9: Create First Animation Scene

File: src/scenes/example.tsx

typescript
import {makeScene2D} from '@motion-canvas/2d/lib/scenes';
import {Circle} from '@motion-canvas/2d/lib/components';
import {createRef} from '@motion-canvas/core/lib/utils';
import {all} from '@motion-canvas/core/lib/flow';

export default makeScene2D(function* (view) {
  const circleRef = createRef<Circle>();

  view.add(
    <Circle
      ref={circleRef}
      size={70}
      fill="#e13238"
    />,
  );

  // Animate circle size and position
  yield* circleRef().size(140, 1);
  yield* circleRef().position.x(300, 1);
  yield* circleRef().fill('#e6a700', 1);

  // Parallel animations
  yield* all(
    circleRef().scale(1.5, 0.5),
    circleRef().rotation(360, 1)
  );
});
Step 10: Run Development Server
bash
npm run dev

Open browser at http://localhost:5173 to see the Motion Canvas editor.

Troubleshooting

Error: TypeError: motionCanvas is not a function

Cause: ESM/CommonJS interoperability issue with @motion-canvas/vite-plugin

Solution: Use the createRequire workaround in vite.config.js (see Step 5)

javascript
// ❌ WRONG - Will not work
import motionCanvas from '@motion-canvas/vite-plugin';

// ✅ CORRECT - Use createRequire
import {createRequire} from 'module';
const require = createRequire(import.meta.url);
const motionCanvasModule = require('@motion-canvas/vite-plugin');
const motionCanvas = motionCanvasModule.default || motionCanvasModule;
Error: Cannot find module '@motion-canvas/ui'

Cause: Missing required dependency

Solution: Install the UI package:

bash
npm install --save-dev @motion-canvas/ui
Error: Property 'default' does not exist on type ...

Cause: TypeScript configuration missing ESM interop settings

Solution: Add to tsconfig.json:

json
{
  "compilerOptions": {
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true
  }
}
Warning: The CJS build of Vite's Node API is deprecated

Status: This is a known warning and can be safely ignored. It appears because @motion-canvas/vite-plugin is CommonJS. The workaround ensures functionality despite the warning.

Show full SKILL.md (310 more words)Show less
Error: Failed to resolve import "*.tsx?scene"

Cause: Vite plugin not properly loaded or configured

Solution:

  1. Verify vite.config.js has the correct workaround
  2. Check project path points to correct file: './src/project.ts'
  3. Ensure scene imports use ?scene suffix: import example from './scenes/example?scene';
Build fails with TypeScript errors

Solution:

  1. Verify tsconfig.json includes all required options (see Step 6)
  2. Check jsxImportSource is set to @motion-canvas/2d/lib
  3. Ensure all dependencies are installed

How to use

Read individual rule files for detailed explanations and code examples:

Core Animation Concepts

For additional topics like scenes, shapes, text rendering, audio synchronization, and advanced features, refer to the comprehensive Motion Canvas official documentation.

Complete Working Example

This is a complete, tested project structure that works out of the box:

my-motion-canvas-project/
├── package.json
│   {
│     "name": "my-motion-canvas-project",
│     "type": "module",
│     "scripts": {
│       "dev": "vite",
│       "build": "vite build"
│     },
│     "devDependencies": {
│       "@motion-canvas/core": "^3.0.0",
│       "@motion-canvas/2d": "^3.0.0",
│       "@motion-canvas/vite-plugin": "^3.0.0",
│       "@motion-canvas/ui": "^3.0.0",
│       "vite": "^5.0.0",
│       "typescript": "^5.0.0"
│     }
│   }
│
├── vite.config.js (with createRequire workaround)
├── tsconfig.json (with esModuleInterop)
├── index.html
└── src/
    ├── project.ts (makeProject with scenes array)
    └── scenes/
        └── example.tsx (makeScene2D with animations)

Best Practices

  1. Always use the createRequire workaround - Don't try standard ESM imports for the Vite plugin
  2. Use vite.config.js not .ts - Avoids additional compilation complexity
  3. Include all dependencies - Don't forget @motion-canvas/ui
  4. Use generator functions - All scene animations should use function* and yield* syntax
  5. Leverage signals - Create reactive dependencies between properties
  6. Think in durations - Specify animation duration in seconds as the second parameter
  7. Use refs for control - Create references to nodes for precise animation control
  8. Preview frequently - Take advantage of the real-time editor for instant feedback
  9. Organize scenes - Break complex animations into multiple scenes
  10. Type everything - Use TypeScript for better IDE support and fewer errors

Common Pitfalls to Avoid

  1. ❌ Forgetting "type": "module" in package.json
  2. ❌ Using standard import for @motion-canvas/vite-plugin
  3. ❌ Not installing @motion-canvas/ui
  4. ❌ Missing esModuleInterop in tsconfig.json
  5. ❌ Using vite.config.ts instead of vite.config.js
  6. ❌ Forgetting ?scene suffix in scene imports

Resources

© davila7, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in cli-tool/components/skills/video/motion-canvas of davila7/claude-code-templates.

  • SKILL.md
  • references/animations.md
  • references/generators.md
  • references/signals.md

Open the folder on GitHubat commit 46b4d8b

Compare with similar skills

Motion Canvas next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Motion Canvas compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Motion Canvas this skilldavila7/claude-code-templates32k—~2.8kAutomated safety check: PassMIT
Web Artifacts Builderanthropics/skills180k41 repos~769Automated safety check: PassApache-2.0
Threejs Gameplay Systemsvalkor-ai/loom1.2k1 repos~1.4kAutomated safety check: PassApache-2.0
Uni Appsonofmagic/uni-app-tailwindcss-template3362 repos~1kAutomated safety check: PassMIT
Design To CodeMigoXLab/coderio1142 repos~1.2kAutomated safety check: PassApache-2.0
Viteoyjt/uniapp-vue3-template6271 repos~780Automated safety check: NotesMIT

Similar skills

  • Web Artifacts Builder

    anthropics/skills

    Official

    Builds multi-component claude.ai HTML artifacts as a small React, TypeScript and Tailwind project, then bundles it into one shareable HTML file.

    180k GitHub starsUsed in 41 repos~769 tokens
    Frontend & DesignAuto-check passed
  • Build and iterate playable Three.js game systems: starter scaffold, architecture, design briefs, core loops, level and encounter design, entities, input, camera, collision and physics, scoring…

    1.2k GitHub starsUsed in 1 repo~1.4k tokens
    Game DevelopmentAuto-check passed
  • Uni App

    sonofmagic/uni-app-tailwindcss-template

    Comprehensive skill reference for uni-app cross-platform development framework

    336 GitHub starsUsed in 2 repos~1k tokens
    Frontend & DesignAuto-check passed
  • Design To Code

    MigoXLab/coderio

    Pixel-perfect Figma to React conversion using coderio. An agent skill from MigoXLab/coderio.

    114 GitHub starsUsed in 2 repos~1.2k tokens
    Frontend & DesignAuto-check passed
  • Vite

    oyjt/uniapp-vue3-template

    Vite next-generation frontend build tool with fast HMR and optimized builds.

    627 GitHub starsUsed in 1 repo~780 tokens
    Frontend & DesignAuto-check: notes
  • Cross-platform UI styling for MarkerOn Tauri app (macOS WKWebView vs Windows WebView2).

    1.2k GitHub stars~2k tokensUpdated yesterday
    Frontend & DesignAuto-check passed

More from davila7/claude-code-templates

All 478 skills in this repo
  • Perplexity Web Search

    davila7/claude-code-templates

    Runs web-grounded searches through Perplexity's Sonar models over OpenRouter for current events, recent literature and cited facts beyond the model's training cutoff.

    32k GitHub starsUsed in 11 repos~3.5k tokens
    Auto-check: notes
  • Neuropixels Data Analysis

    davila7/claude-code-templates

    Analyzes Neuropixels recordings from SpikeGLX or Open Ephys through preprocessing, drift correction, Kilosort4 spike sorting, quality metrics and curation.

    32k GitHub starsUsed in 9 repos~2.8k tokens
    Auto-check passed
  • Scientific Venue Templates

    davila7/claude-code-templates

    Supplies LaTeX templates and formatting rules for journals, conferences, posters, and grant proposals, then can check a draft against them.

    32k GitHub starsUsed in 9 repos~5.1k tokens
    Auto-check: notes
  • Brand Voice Content Creator

    davila7/claude-code-templates

    Analyzes a brand's existing writing to lock in a consistent voice, then builds SEO blog posts and platform-specific social content around it.

    32k GitHub starsUsed in 3 repos~1.9k tokens
    Auto-check passed
  • CAPA Officer

    davila7/claude-code-templates

    Guides corrective and preventive action (CAPA) work in a quality management system, from initiation and root cause analysis through effectiveness verification.

    32k GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed
  • Fda Consultant Specialist

    davila7/claude-code-templates

    Senior FDA consultant and specialist for medical device companies including HIPAA compliance and requirement management.

    32k GitHub starsUsed in 1 repo~2.7k tokens
    Auto-check passed

Works with

Questions about Motion Canvas

What does Motion Canvas do?

Complete production-ready guide for Motion Canvas with ESM/CommonJS workarounds, full setup templates, and troubleshooting for programmatic video creation using TypeScript. Motion Canvas is an agent skill from davila7/claude-code-templates.

How do I install Motion Canvas in Claude Code?

Run `npx skills add davila7/claude-code-templates --skill motion-canvas -a claude-code`. Or copy the skill folder (cli-tool/components/skills/video/motion-canvas in davila7/claude-code-templates) into .claude/skills/motion-canvas in your project. Claude Code loads it when a task matches its description.

How do I install Motion Canvas in Codex?

Run `npx skills add davila7/claude-code-templates --skill motion-canvas -a codex`. Or copy the skill folder (cli-tool/components/skills/video/motion-canvas in davila7/claude-code-templates) into .agents/skills/motion-canvas in your project. Codex loads it when a task matches its description.

Can I use Motion Canvas in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add davila7/claude-code-templates --skill motion-canvas -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/motion-canvas, .gemini/skills/motion-canvas, .github/skills/motion-canvas and .opencode/skills/motion-canvas in your project.

What does Motion Canvas need to run?

Going by SKILL.md and its folder, Motion Canvas needs the command-line tools its instructions call (npm). Our summary lists: Node.js.

Does Motion Canvas access the network?

SKILL.md names 2 domains. As links in the text: motioncanvas.io and github.com. This is read from the text; nothing was executed.

Is Motion Canvas safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Motion Canvas use?

Motion Canvas is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Motion Canvas use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2k tokens, read only when the agent opens those files.

What are the alternatives to Motion Canvas?

Skills that share tags, products or a category with Motion Canvas: Web Artifacts Builder (anthropics/skills, 180k stars), Threejs Gameplay Systems (valkor-ai/loom, 1.2k stars), Uni App (sonofmagic/uni-app-tailwindcss-template, 336 stars) and Design To Code (MigoXLab/coderio, 114 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Motion Canvas?

davila7 (a GitHub user) maintains it in davila7/claude-code-templates, which has 32,483 GitHub stars. The repository holds 478 skills in this directory. The repository was last updated on October 9, 2026.

Source: davila7/claude-code-templates on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.