OR Key
drop another .md file to compare - side-by-side diff against remotion

remotion

Creates videos automatically from a template.
description: "Triggers on prompt mention of 'remotion'."
personal 2 files 10 recent evals

What it does for you

Creates videos automatically from a template.

What it produces

A recent result, so you can see the kind of work it returns.

loading…

How to get it

These run inside the Snappy workspace. Want this working in your business? I set skills like this up with you, in one focused week.

Work with me
For developers how this skill is built, graded, and how it runs

at a glance- the short version

actorExported functions in state/lib/remotion.ts.
auditorNone wired yet - eval is manual (Robert review).
eval modeshape
categoryContent
stages1

what's inside - the parts that make up a skill 3/4 present

A skill is just a few plain-text files. Only the main one is required. The rest are optional, added as the work needs them. This is what the skill is made of; how it runs is just below.

The skill
state/skills/remotion/SKILL.md present
the skill itself, in plain text
The main file. It says what the skill is and lays out the steps in plain English.
Code
state/lib/remotion.ts present
code the skill can run
Reusable code this skill can call when it needs to.
Scripts
state/bin/remotion/ not present
helper scripts
Optional. Added when a skill has a few commands to run.
Loader
state/skills/remotion/AGENTS.md present
what the AI loads on the fly
Loaded automatically the moment this skill is needed. Kept short on purpose.

how it's graded - what counts as a good run 4 criteria · 3 deterministic · 1 judge

Each row is one thing a good run has to get right. deterministic means a quick check decides, pass or fail. judge means the AI reads the result and rates it. Grading each piece on its own (instead of one overall score) shows exactly where a run fell short, so the fix is obvious.

name
kind
check
imports_all_required_inputs
deterministic
The skill execution successfully uses the 'useFadeIn_input', 'useSlideIn_input', and 'useScaleIn_input' values as specified by the 'requires' field.
function_call_accuracy
judge
The skill's output demonstrates a correct and logical application of the called Remotion function (e.g., useFadeIn(), scaffoldProject()) based on the provided inputs.
side_effect_honesty
deterministic
The skill execution modifies files or system state only as expected by its intended purpose (e.g., 'scaffoldProject' creates new files in the specified location, 'render' outputs a video file).
error_handling_graceful
deterministic
If an invalid input is provided, the skill terminates gracefully with an informative error message, rather than crashing or producing undefined behavior.

how it runs - the shared frame every skill uses 5/5 present

Every skill runs the same way. One part does the work, a separate part checks it, and a short loader hands the AI exactly what it needs for the job. Anything this skill doesn't use shows a one-line note saying why, on purpose, not by accident.

makes the work The worker
present
Exported functions in state/lib/remotion.ts. the worker
Does the actual work. Whatever it produces is what gets checked next.
checks the work The reviewer
present
None wired yet - eval is manual (Robert review). the checker
A separate checker grades the work, so the part that made it can't approve its own work.
frame
learns Self-correction
present
fixes itself learns from gaps
When a run hits a gap, the skill gets edited on the spot [FIXED] or queued for a bigger rewrite [LOGGED], so it keeps getting better.
tidies up Background fixes
present
queued for rewrite runs in the background
Bigger fixes that can't be made on the spot get queued and rewritten in the background later.
remembers Run history
present
state/log/pending-eval.ndjson pending runs
Every run is written down here, then reviewed by hand each week.
Critical rules the things this skill must not get wrong
  1. ALWAYS use BRAND() / brand() helpers from state/lib/remotion.ts for brand-consistent colors and fonts. Do not hardcode brand tokens.
  2. ALWAYS scaffold via scaffoldProject() for new compositions instead of hand-rolling Remotion config.
  3. The animation hooks (useFadeIn, useSlideIn, useScaleIn) live on the lib; do not reimplement.

what it has learned - fixes written back in over time sample

When a run hits something this skill didn't handle, the fix gets written back into the skill so it doesn't happen again. FIXED means it was corrected on the spot. LOGGED means it's queued for a bigger rewrite. Either way, the skill gets a little better and never makes the same mistake twice.

  1. Loading feedback rows…

how the work flows- who makes it, who checks it

actor Exported functions in state/lib/remotion.ts.
auditor None wired yet - eval is manual (Robert review).
1 data
eval log
`state/log/pending-eval.ndjson` (skill: "remotion") — manual until auditor wired

SKILL.md- the skill, written out in plain English

remotion

Programmatic video generation via Remotion.

Ported from kernel snappy-remotion in Phase 0.5. See state/lib/remotion.ts for the full API surface.

Steps

  • useFadeIn() - see state/lib/remotion.ts
  • useSlideIn() - see state/lib/remotion.ts
  • useScaleIn() - see state/lib/remotion.ts
  • scaffoldProject() - see state/lib/remotion.ts
  • listCompositions() - see state/lib/remotion.ts
  • render() - see state/lib/remotion.ts
  • preview() - see state/lib/remotion.ts
  • addComposition() - see state/lib/remotion.ts
  • BRAND() - see state/lib/remotion.ts
  • brand() - see state/lib/remotion.ts

Eval

Actor: the exported functions in state/lib/remotion.ts. Auditor: none wired yet - eval is manual (Robert review). File a state/log/pending-eval.ndjson row on each run.

Score convention:

OutcomeScore
Pass on first try1.0
Failed first, auto-fix applied, re-check passed0.5
Still failing or unrecoverable0.0

Gotchas

via the Phase 0.5 driver. Only these rewrites were applied: already in state/lib/)

  1. realpathSync(process.argv[1]) CLI guard wrapped in try/catch
  • See the kernel SKILL.md for the original long-form guidance if you need it

(read-only reference at the kernel path above).

Graduation

This skill is prose. Graduate by defining a deterministic auditor and flipping eval: auto.

Rubric

criteria:
  - name: imports_all_required_inputs
    kind: deterministic
    check: "The skill execution successfully uses the 'useFadeIn_input', 'useSlideIn_input', and 'useScaleIn_input' values as specified by the 'requires' field."
  - name: function_call_accuracy
    kind: judge
    check: "The skill's output demonstrates a correct and logical application of the called Remotion function (e.g., useFadeIn(), scaffoldProject()) based on the provided inputs."
  - name: side_effect_honesty
    kind: deterministic
    check: "The skill execution modifies files or system state only as expected by its intended purpose (e.g., 'scaffoldProject' creates new files in the specified location, 'render' outputs a video file)."
  - name: error_handling_graceful
    kind: deterministic
    check: "If an invalid input is provided, the skill terminates gracefully with an informative error message, rather than crashing or producing undefined behavior."

AGENTS.md- what the AI loads when this skill comes up

remotion - loader

Per-turn rules for the remotion skill. Full reference: state/skills/remotion/SKILL.md.

Critical Rules

_(no failures recorded yet - this skill has not produced hard-won rules. It is a Phase 0.5 port from kernel snappy-remotion. Read state/lib/remotion.ts for the actual API surface before invoking.)_

  • ALWAYS use BRAND() / brand() helpers from state/lib/remotion.ts for brand-consistent colors and fonts. Do not hardcode brand tokens.
  • ALWAYS scaffold via scaffoldProject() for new compositions instead of hand-rolling Remotion config.
  • The animation hooks (useFadeIn, useSlideIn, useScaleIn) live on the lib; do not reimplement.

Commands

| ui dashboard | state/skills/remotion/resources/ui.openui | |invoke (TS): import { scaffoldProject, listCompositions, render, preview, addComposition, BRAND } from "../lib/remotion.ts" |eval log: state/log/pending-eval.ndjson (skill: "remotion") - manual until auditor wired

OpenUI Resource

  • Skill-owned OpenUI Lang resource: state/skills/remotion/resources/ui.openui. Read it before rendering or editing this skill's generated component surface.
  • Treat this resource as a first-class artifact of the skill, not a generic chat response. Improve it when the skill's user-facing output needs to become richer.
  • System resources compose OpenUI primitives and inherit SnappyChat tokens. Use ui_contract: branded in SKILL.md only for deliberate platform or client visuals.

Known Pitfalls

  • Phase 0.5 port stub - the skill .md is thin. The state/lib/remotion.ts file is the real reference.
  • Render is expensive; prefer preview() for iteration.

Self-Test

An agent reading this should correctly:

  1. [ ] Use BRAND() not hardcoded hex colors
  2. [ ] Use scaffoldProject() for new compositions
  3. [ ] Log to pending-eval.ndjson since this is manual-eval

Self-report

If this loader fell short, append a line:

echo "[$(date -u +%FT%TZ)] remotion: <what was missing>" >> state/log/loader-feedback.log

<!-- kernel-ok: historical attribution for the PID-loader pattern. -->

Self-correcting loader (PID feedback)

This is the rule that makes loaders learn. Ported from snappy-kernel, where it demonstrably worked: the snappy-dom-cartographer skill mapped Skool admin UI once, every later ship-agent inherited the full map for free.

Before you finish, do two things:

1. Fix gaps (P - proportional). MANDATORY. If this loader didn't cover your case - if you had to read another file, run an undocumented command, work around a wrong selector, or discover a quirk - you MUST attempt an Edit to this AGENTS.md before you log.

  • Default action: edit this file. Surgical. Add the missing line, table

row, or code example where it belongs. No restructuring.

  • Only LOGGED is allowed when: the fix needs >10 lines, spans multiple

files, or requires a structural rewrite. In that case the state/regen/drain.sh queue picks it up asynchronously.

  • "I didn't have time" / "it's minor" / "the next agent will figure it out"

are NOT valid reasons. Minor gaps compound - that's the whole point of this loop.

  • Concrete example of a valid P-fix: discover agent-browser screenshot

takes path positionally not as --output <path>. One line in a table. Edit it in. Do not just log it.

  • The goal: the next agent never has to leave the loader.

2. Log the result.

echo "[$(date -u +%FT%TZ)] remotion: <what was missing or fixed> [FIXED|LOGGED]" >> state/log/loader-feedback.log
  • FIXED = you patched this loader inline (P-fix).
  • LOGGED = too large for inline; the PostToolUse enqueue + Stop-hook drain

will rewrite the loader from scratch on next session-end.

Do not skip this. Every agent run must leave the system better than it found it. The loader is the setpoint; you are the sensor; the gap is the error signal; closing the gap is the correction.

api.ts- the code it can call

#!/usr/bin/env npx tsx
/**
 * snappy-remotion/api.ts -- Programmatic video generation via Remotion.
 *
 * Generates video from React components: quote cards, social clips, course intros,
 * data visualizations, branded overlays. The Remotion project lives at
 * ~/projects/snappy-remotion and must be scaffolded before first use.
 *
 * Usage:
 *   npx tsx api.ts scaffold
 *   npx tsx api.ts list
 *   npx tsx api.ts render QuoteCard --props '{"text":"Ship it"}'
 *   npx tsx api.ts preview
 *   npx tsx api.ts add ToolDemo "Animated tool walkthrough"
 *
 * Or import as module:
 *   import { scaffoldProject, listCompositions, render, preview, addComposition } from "./remotion.ts";
 */

import { execSync, spawn } from "child_process";
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, writeFileSync } from "fs";
import { join, basename } from "path";
import { env } from "./env.ts";

// ---------------------------------------------------------------------------
// Constants
// ---------------------------------------------------------------------------

const PROJECT_DIR = join(process.env.HOME || "/Users/robertboulos", "projects/snappy-remotion");
const SRC_DIR = join(PROJECT_DIR, "src");
const COMP_DIR = join(SRC_DIR, "compositions");
const LIB_DIR = join(SRC_DIR, "lib");

/** Snappy brand constants used by all compositions. */
export const BRAND = {
  primary: "#2563EB",
  dark: "#0F172A",
  light: "#F8FAFC",
  accent: "#F59E0B",
  cream: "#F5F0E6",
  ink: "#3d3929",
  cta: "#c96442",
  font: "Inter",
  serifFont: "EB Garamond",
} as const;

/** Default render dimensions per format. */
export const FORMATS: Record<string, { width: number; height: number; fps: number; durationInFrames: number }> = {
  "vertical":   { width: 1080, height: 1920, fps: 30, durationInFrames: 150 },
  "square":     { width: 1080, height: 1080, fps: 30, durationInFrames: 150 },
  "landscape":  { width: 1920, height: 1080, fps: 30, durationInFrames: 150 },
  "youtube":    { width: 1280, height: 720,  fps: 30, durationInFrames: 300 },
  "story":      { width: 1080, height: 1920, fps: 30, durationInFrames: 450 },
};

// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------

function ensureProject(): void {
  if (!existsSync(join(PROJECT_DIR, "package.json"))) {
    throw new Error(
      `Remotion project not found at ${PROJECT_DIR}. Run \`npx tsx ~/.claude/skills/snappy-remotion/api.ts scaffold\` first.`,
    );
  }
}

function exec(cmd: string, cwd?: string, timeoutMs = 300000): string {
  return execSync(cmd, {
    encoding: "utf-8",
    timeout: timeoutMs,
    cwd: cwd || PROJECT_DIR,
    stdio: ["pipe", "pipe", "pipe"],
  }).trim();
}

// ---------------------------------------------------------------------------
// Template content (used by scaffold)
// ---------------------------------------------------------------------------

const PACKAGE_JSON = JSON.stringify(
  {
    name: "snappy-remotion",
    version: "1.0.0",
    private: true,
    scripts: {
      start: "remotion studio",
      build: "remotion render src/index.ts",
      upgrade: "remotion upgrade",
    },
    dependencies: {
      "@remotion/cli": "^4",
      "@remotion/player": "^4",
      react: "^18",
      "react-dom": "^18",
      remotion: "^4",
    },
    devDependencies: {
      "@types/react": "^18",
      typescript: "^5",
    },
  },
  null,
  2,
);

const TSCONFIG = JSON.stringify(
  {
    compilerOptions: {
      target: "ES2022",
      module: "ES2022",
      moduleResolution: "bundler",
      jsx: "react-jsx",
      strict: true,
      esModuleInterop: true,
      skipLibCheck: true,
      outDir: "dist",
    },
    include: ["src"],
  },
  null,
  2,
);

const REMOTION_CONFIG = `import { Config } from "@remotion/cli/config";
Config.setVideoImageFormat("png");
Config.setOverwriteOutput(true);
`;

const BRAND_TS = `// Brand constants for all Remotion compositions.
// Source of truth: snappy-positioning AGENTS.md §8 + snappy-remotion/api.ts BRAND export.

export const brand = {
  primary: "${BRAND.primary}",
  dark: "${BRAND.dark}",
  light: "${BRAND.light}",
  accent: "${BRAND.accent}",
  cream: "${BRAND.cream}",
  ink: "${BRAND.ink}",
  cta: "${BRAND.cta}",
  font: "${BRAND.font}",
  serifFont: "${BRAND.serifFont}",
} as const;
`;

const TRANSITIONS_TS = `import { interpolate, useCurrentFrame, Easing } from "remotion";

/** Fade in over \`frames\` frames, starting at \`delay\`. */
export function useFadeIn(delay = 0, frames = 20): number {
  const frame = useCurrentFrame();
  return interpolate(frame, [delay, delay + frames], [0, 1], {
    extrapolateLeft: "clamp",
    extrapolateRight: "clamp",
    easing: Easing.out(Easing.ease),
  });
}

/** Slide in from direction over \`frames\` frames. Returns translateX or translateY px. */
export function useSlideIn(
  direction: "left" | "right" | "up" | "down" = "up",
  delay = 0,
  frames = 25,
  distance = 60,
): number {
  const frame = useCurrentFrame();
  const sign = direction === "right" || direction === "down" ? 1 : -1;
  return interpolate(frame, [delay, delay + frames], [sign * distance, 0], {
    extrapolateLeft: "clamp",
    extrapolateRight: "clamp",
    easing: Easing.out(Easing.cubic),
  });
}

/** Scale from 0 to 1 over \`frames\` frames. */
export function useScaleIn(delay = 0, frames = 20): number {
  const frame = useCurrentFrame();
  return interpolate(frame, [delay, delay + frames], [0, 1], {
    extrapolateLeft: "clamp",
    extrapolateRight: "clamp",
    easing: Easing.out(Easing.back(1.5)),
  });
}
`;

const QUOTE_CARD_TSX = `import { AbsoluteFill, useCurrentFrame, interpolate, Easing } from "remotion";
import { brand } from "../lib/brand";

export type QuoteCardProps = {
  text: string;
  speaker?: string;
  title?: string;
};

export const QuoteCard: React.FC<QuoteCardProps> = ({ text, speaker, title }) => {
  const frame = useCurrentFrame();
  const textOpacity = interpolate(frame, [10, 35], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
  const speakerOpacity = interpolate(frame, [30, 50], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
  const quoteY = interpolate(frame, [10, 35], [30, 0], { extrapolateLeft: "clamp", extrapolateRight: "clamp", easing: Easing.out(Easing.ease) });
  const lineWidth = interpolate(frame, [0, 25], [0, 80], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });

  return (
    <AbsoluteFill style={{ backgroundColor: brand.cream, justifyContent: "center", alignItems: "center", padding: 80, fontFamily: brand.serifFont }}>
      <div style={{ width: lineWidth, height: 3, backgroundColor: brand.cta, marginBottom: 40 }} />
      <div style={{ opacity: textOpacity, transform: \`translateY(\${quoteY}px)\`, fontSize: 52, lineHeight: 1.4, color: brand.ink, textAlign: "center", maxWidth: 800 }}>
        \\u201c{text}\\u201d
      </div>
      {speaker && (
        <div style={{ opacity: speakerOpacity, marginTop: 40, fontSize: 28, color: brand.ink, letterSpacing: 2, textTransform: "uppercase" }}>
          {speaker}{title ? \` \\u2014 \${title}\` : ""}
        </div>
      )}
    </AbsoluteFill>
  );
};
`;

const SOCIAL_CLIP_TSX = `import { AbsoluteFill, useCurrentFrame, interpolate, Easing } from "remotion";
import { brand } from "../lib/brand";

export type SocialClipProps = {
  text: string;
  subtitle?: string;
  background?: string;
};

export const SocialClip: React.FC<SocialClipProps> = ({ text, subtitle, background }) => {
  const frame = useCurrentFrame();
  const titleOpacity = interpolate(frame, [5, 25], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
  const titleY = interpolate(frame, [5, 25], [40, 0], { extrapolateLeft: "clamp", extrapolateRight: "clamp", easing: Easing.out(Easing.ease) });
  const subOpacity = interpolate(frame, [20, 40], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });

  return (
    <AbsoluteFill style={{ backgroundColor: background || brand.dark, justifyContent: "center", alignItems: "center", padding: 60, fontFamily: brand.font }}>
      <div style={{ opacity: titleOpacity, transform: \`translateY(\${titleY}px)\`, fontSize: 64, fontWeight: 700, color: brand.light, textAlign: "center", maxWidth: 900, lineHeight: 1.3 }}>
        {text}
      </div>
      {subtitle && (
        <div style={{ opacity: subOpacity, marginTop: 30, fontSize: 28, color: brand.accent, textAlign: "center" }}>
          {subtitle}
        </div>
      )}
    </AbsoluteFill>
  );
};
`;

const COURSE_INTRO_TSX = `import { AbsoluteFill, useCurrentFrame, interpolate, Sequence, Easing } from "remotion";
import { brand } from "../lib/brand";

export type CourseIntroProps = {
  text: string;
  category?: string;
  lessonNumber?: number;
};

export const CourseIntro: React.FC<CourseIntroProps> = ({ text, category, lessonNumber }) => {
  const frame = useCurrentFrame();
  const bgScale = interpolate(frame, [0, 60], [1.05, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
  const categoryOpacity = interpolate(frame, [10, 25], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
  const titleOpacity = interpolate(frame, [20, 45], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
  const titleY = interpolate(frame, [20, 45], [50, 0], { extrapolateLeft: "clamp", extrapolateRight: "clamp", easing: Easing.out(Easing.ease) });
  const lineWidth = interpolate(frame, [15, 40], [0, 120], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });

  return (
    <AbsoluteFill style={{ backgroundColor: brand.cream, justifyContent: "center", alignItems: "center", fontFamily: brand.font, transform: \`scale(\${bgScale})\` }}>
      {category && (
        <div style={{ opacity: categoryOpacity, fontSize: 22, letterSpacing: 4, textTransform: "uppercase", color: brand.cta, marginBottom: 20, fontWeight: 600 }}>
          {lessonNumber != null ? \`Lesson \${lessonNumber} · \` : ""}{category}
        </div>
      )}
      <div style={{ width: lineWidth, height: 2, backgroundColor: brand.ink, marginBottom: 30 }} />
      <div style={{ opacity: titleOpacity, transform: \`translateY(\${titleY}px)\`, fontSize: 56, fontWeight: 700, color: brand.ink, textAlign: "center", maxWidth: 800, lineHeight: 1.3, fontFamily: brand.serifFont }}>
        {text}
      </div>
    </AbsoluteFill>
  );
};
`;

const DATA_VIZ_TSX = `import { AbsoluteFill, useCurrentFrame, interpolate, Easing } from "remotion";
import { brand } from "../lib/brand";

export type DataVizProps = {
  text: string;
  value?: string;
  subtitle?: string;
  unit?: string;
};

export const DataViz: React.FC<DataVizProps> = ({ text, value, subtitle, unit }) => {
  const frame = useCurrentFrame();
  const valueOpacity = interpolate(frame, [10, 30], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
  const valueScale = interpolate(frame, [10, 35], [0.5, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp", easing: Easing.out(Easing.back(1.3)) });
  const labelOpacity = interpolate(frame, [25, 45], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });
  const subOpacity = interpolate(frame, [35, 55], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });

  return (
    <AbsoluteFill style={{ backgroundColor: brand.dark, justifyContent: "center", alignItems: "center", fontFamily: brand.font, padding: 60 }}>
      {value && (
        <div style={{ opacity: valueOpacity, transform: \`scale(\${valueScale})\`, fontSize: 140, fontWeight: 800, color: brand.accent, textAlign: "center" }}>
          {value}{unit && <span style={{ fontSize: 60, color: brand.light }}>{unit}</span>}
        </div>
      )}
      <div style={{ opacity: labelOpacity, marginTop: 20, fontSize: 40, fontWeight: 600, color: brand.light, textAlign: "center", maxWidth: 700 }}>
        {text}
      </div>
      {subtitle && (
        <div style={{ opacity: subOpacity, marginTop: 16, fontSize: 24, color: "#94a3b8", textAlign: "center" }}>
          {subtitle}
        </div>
      )}
    </AbsoluteFill>
  );
};
`;

const BRANDED_OVERLAY_TSX = `import { AbsoluteFill, useCurrentFrame, interpolate, Easing } from "remotion";
import { brand } from "../lib/brand";

export type BrandedOverlayProps = {
  text: string;
  position?: "bottom-left" | "bottom-right" | "top-left" | "top-right";
};

export const BrandedOverlay: React.FC<BrandedOverlayProps> = ({ text, position = "bottom-left" }) => {
  const frame = useCurrentFrame();
  const slideIn = interpolate(frame, [5, 25], [-100, 0], { extrapolateLeft: "clamp", extrapolateRight: "clamp", easing: Easing.out(Easing.ease) });
  const opacity = interpolate(frame, [5, 25], [0, 0.95], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });

  const isBottom = position.startsWith("bottom");
  const isRight = position.endsWith("right");

  return (
    <AbsoluteFill>
      <div
        style={{
          position: "absolute",
          [isBottom ? "bottom" : "top"]: 40,
          [isRight ? "right" : "left"]: 40,
          opacity,
          transform: \`translateY(\${isBottom ? -slideIn : slideIn}px)\`,
          backgroundColor: "rgba(15, 23, 42, 0.85)",
          padding: "12px 24px",
          borderRadius: 8,
          borderLeft: \`3px solid \${brand.cta}\`,
          fontFamily: brand.font,
          fontSize: 22,
          color: brand.light,
          fontWeight: 500,
          maxWidth: 500,
        }}
      >
        {text}
      </div>
    </AbsoluteFill>
  );
};
`;

const ROOT_TSX = `import { Composition } from "remotion";
import { QuoteCard, QuoteCardProps } from "./compositions/QuoteCard";
import { SocialClip, SocialClipProps } from "./compositions/SocialClip";
import { CourseIntro, CourseIntroProps } from "./compositions/CourseIntro";
import { DataViz, DataVizProps } from "./compositions/DataViz";
import { BrandedOverlay, BrandedOverlayProps } from "./compositions/BrandedOverlay";

export const RemotionRoot: React.FC = () => {
  return (
    <>
      <Composition
        id="QuoteCard"
        component={QuoteCard}
        durationInFrames={150}
        fps={30}
        width={1080}
        height={1080}
        defaultProps={{ text: "Build and control agents to get huge results." } satisfies QuoteCardProps}
      />
      <Composition
        id="SocialClip"
        component={SocialClip}
        durationInFrames={150}
        fps={30}
        width={1080}
        height={1920}
        defaultProps={{ text: "Ship it." } satisfies SocialClipProps}
      />
      <Composition
        id="CourseIntro"
        component={CourseIntro}
        durationInFrames={150}
        fps={30}
        width={1920}
        height={1080}
        defaultProps={{ text: "Getting Started", category: "Agentic Development" } satisfies CourseIntroProps}
      />
      <Composition
        id="DataViz"
        component={DataViz}
        durationInFrames={150}
        fps={30}
        width={1080}
        height={1080}
        defaultProps={{ text: "Hours saved per week", value: "37", unit: "hrs" } satisfies DataVizProps}
      />
      <Composition
        id="BrandedOverlay"
        component={BrandedOverlay}
        durationInFrames={150}
        fps={30}
        width={1920}
        height={1080}
        defaultProps={{ text: "snappy.ai", position: "bottom-left" } satisfies BrandedOverlayProps}
      />
    </>
  );
};
`;

const INDEX_TS = `import { registerRoot } from "remotion";
import { RemotionRoot } from "./Root";
registerRoot(RemotionRoot);
`;

const COMP_TEMPLATE = (name: string, description: string) => `import { AbsoluteFill, useCurrentFrame, interpolate, Easing } from "remotion";
import { brand } from "../lib/brand";

export type ${name}Props = {
  text: string;
};

/** ${description} */
export const ${name}: React.FC<${name}Props> = ({ text }) => {
  const frame = useCurrentFrame();
  const opacity = interpolate(frame, [5, 25], [0, 1], { extrapolateLeft: "clamp", extrapolateRight: "clamp" });

  return (
    <AbsoluteFill style={{ backgroundColor: brand.cream, justifyContent: "center", alignItems: "center", fontFamily: brand.font, padding: 60 }}>
      <div style={{ opacity, fontSize: 48, fontWeight: 700, color: brand.ink, textAlign: "center" }}>
        {text}
      </div>
    </AbsoluteFill>
  );
};
`;

// ---------------------------------------------------------------------------
// Public API
// ---------------------------------------------------------------------------

/**
 * Create the Remotion project at ~/projects/snappy-remotion if it doesn't exist.
 * Writes all template files and installs dependencies.
 */
export function scaffoldProject(): string {
  if (existsSync(join(PROJECT_DIR, "package.json"))) {
    return `Project already exists at ${PROJECT_DIR}. Delete it to re-scaffold.`;
  }

  // Create directory structure
  for (const dir of [PROJECT_DIR, SRC_DIR, COMP_DIR, LIB_DIR]) {
    mkdirSync(dir, { recursive: true });
  }

  // Write all template files
  const files: [string, string][] = [
    [join(PROJECT_DIR, "package.json"), PACKAGE_JSON],
    [join(PROJECT_DIR, "tsconfig.json"), TSCONFIG],
    [join(PROJECT_DIR, "remotion.config.ts"), REMOTION_CONFIG],
    [join(SRC_DIR, "index.ts"), INDEX_TS],
    [join(SRC_DIR, "Root.tsx"), ROOT_TSX],
    [join(LIB_DIR, "brand.ts"), BRAND_TS],
    [join(LIB_DIR, "transitions.ts"), TRANSITIONS_TS],
    [join(COMP_DIR, "QuoteCard.tsx"), QUOTE_CARD_TSX],
    [join(COMP_DIR, "SocialClip.tsx"), SOCIAL_CLIP_TSX],
    [join(COMP_DIR, "CourseIntro.tsx"), COURSE_INTRO_TSX],
    [join(COMP_DIR, "DataViz.tsx"), DATA_VIZ_TSX],
    [join(COMP_DIR, "BrandedOverlay.tsx"), BRANDED_OVERLAY_TSX],
  ];

  for (const [path, content] of files) {
    writeFileSync(path, content, "utf-8");
  }

  // Install dependencies
  exec("npm install", PROJECT_DIR, 120000);

  return `Scaffolded Remotion project at ${PROJECT_DIR}. ${files.length} files written. Dependencies installed.`;
}

/**
 * List available compositions from the project's Root.tsx.
 * Parses composition IDs from <Composition id="..."> in Root.tsx.
 */
export function listCompositions(): string[] {
  ensureProject();
  const rootPath = join(SRC_DIR, "Root.tsx");
  if (!existsSync(rootPath)) {
    throw new Error(`Root.tsx not found at ${rootPath}`);
  }
  const content = readFileSync(rootPath, "utf-8");
  const ids: string[] = [];
  const re = /id="([^"]+)"/g;
  let m: RegExpExecArray | null;
  while ((m = re.exec(content)) !== null) {
    ids.push(m[1]);
  }
  return ids;
}

export type RenderOpts = {
  output?: string;
  width?: number;
  height?: number;
  fps?: number;
  durationInFrames?: number;
  format?: keyof typeof FORMATS;
};

/**
 * Render a composition to MP4.
 * Uses `npx remotion render` in the project directory.
 * Returns the absolute path to the output file.
 */
export function render(
  compositionId: string,
  props: Record<string, unknown> = {},
  opts: RenderOpts = {},
): string {
  ensureProject();

  const ts = Date.now();
  const outputPath = opts.output || `/tmp/snappy-remotion-${compositionId.toLowerCase()}-${ts}.mp4`;

  // Resolve format defaults
  const fmt = opts.format ? FORMATS[opts.format] : undefined;
  const width = opts.width || fmt?.width;
  const height = opts.height || fmt?.height;
  const fps = opts.fps || fmt?.fps;
  const duration = opts.durationInFrames || fmt?.durationInFrames;

  const parts = [
    "npx", "remotion", "render",
    "src/index.ts",
    compositionId,
    `"${outputPath}"`,
  ];

  if (Object.keys(props).length > 0) {
    // Write props to a temp file to avoid shell escaping issues
    const propsPath = `/tmp/snappy-remotion-props-${ts}.json`;
    writeFileSync(propsPath, JSON.stringify(props), "utf-8");
    parts.push("--props", propsPath);
  }

  if (width) parts.push("--width", String(width));
  if (height) parts.push("--height", String(height));
  if (fps) parts.push("--fps", String(fps));
  if (duration) parts.push("--frames", String(duration));

  exec(parts.join(" "), PROJECT_DIR, 600000);

  return outputPath;
}

/**
 * Start the Remotion Studio dev server for visual editing.
 * Returns the Studio URL (default http://localhost:3000).
 * Runs as a background process -- caller is responsible for stopping it.
 */
export function preview(compositionId?: string, props?: Record<string, unknown>): string {
  ensureProject();

  const parts = ["npx", "remotion", "studio", "src/index.ts"];
  const child = spawn(parts[0], parts.slice(1), {
    cwd: PROJECT_DIR,
    detached: true,
    stdio: "ignore",
  });
  child.unref();

  const url = "http://localhost:3000";
  return compositionId ? `${url}/?composition=${compositionId}` : url;
}

/**
 * Scaffold a new composition from the template.
 * Creates the .tsx file and registers it in Root.tsx.
 * Returns the path to the new composition file.
 */
export function addComposition(name: string, description: string): string {
  ensureProject();

  if (!/^[A-Z][a-zA-Z0-9]+$/.test(name)) {
    throw new Error(`Composition name must be PascalCase: ${name}`);
  }

  const filePath = join(COMP_DIR, `${name}.tsx`);
  if (existsSync(filePath)) {
    throw new Error(`Composition already exists: ${filePath}`);
  }

  // Write the composition file
  writeFileSync(filePath, COMP_TEMPLATE(name, description), "utf-8");

  // Register in Root.tsx
  const rootPath = join(SRC_DIR, "Root.tsx");
  let root = readFileSync(rootPath, "utf-8");

  // Add import
  const importLine = `import { ${name}, ${name}Props } from "./compositions/${name}";`;
  const lastImportIdx = root.lastIndexOf("import ");
  const lastImportEnd = root.indexOf("\n", lastImportIdx);
  root = root.slice(0, lastImportEnd + 1) + importLine + "\n" + root.slice(lastImportEnd + 1);

  // Add Composition before the closing </>
  const compBlock = `      <Composition
        id="${name}"
        component={${name}}
        durationInFrames={150}
        fps={30}
        width={1080}
        height={1080}
        defaultProps={{ text: "${description}" } satisfies ${name}Props}
      />\n`;
  const closingIdx = root.lastIndexOf("</>");
  root = root.slice(0, closingIdx) + compBlock + "    " + root.slice(closingIdx);

  writeFileSync(rootPath, root, "utf-8");

  return filePath;
}

// ---------------------------------------------------------------------------
// CLI
// ---------------------------------------------------------------------------

if ((() => { try { return import.meta.url === `file://${realpathSync(process.argv[1])}`; } catch { return false; } })()) {
  (async () => {
    const [, , cmd, ...args] = process.argv;

    switch (cmd) {
      case "scaffold": {
        console.log(scaffoldProject());
        break;
      }
      case "list": {
        const comps = listCompositions();
        for (const c of comps) console.log(c);
        break;
      }
      case "render": {
        const [comp, ...rest] = args;
        if (!comp) {
          console.error("Usage: api.ts render <compositionId> [--props '{...}'] [--format vertical|square|landscape|youtube|story] [--output path]");
          process.exit(1);
        }
        let props: Record<string, unknown> = {};
        let output = "";
        let format = "";
        let width: number | undefined;
        let height: number | undefined;
        let fps: number | undefined;
        let durationInFrames: number | undefined;
        for (let i = 0; i < rest.length; i++) {
          if (rest[i] === "--props" && rest[i + 1]) { props = JSON.parse(rest[++i]); continue; }
          if (rest[i] === "--output" && rest[i + 1]) { output = rest[++i]; continue; }
          if (rest[i] === "--format" && rest[i + 1]) { format = rest[++i]; continue; }
          if (rest[i] === "--width" && rest[i + 1]) { width = Number(rest[++i]); continue; }
          if (rest[i] === "--height" && rest[i + 1]) { height = Number(rest[++i]); continue; }
          if (rest[i] === "--fps" && rest[i + 1]) { fps = Number(rest[++i]); continue; }
          if (rest[i] === "--duration" && rest[i + 1]) { durationInFrames = Number(rest[++i]); continue; }
        }
        const outPath = render(comp, props, {
          output: output || undefined,
          format: (format as keyof typeof FORMATS) || undefined,
          width,
          height,
          fps,
          durationInFrames,
        });
        console.log(outPath);
        break;
      }
      case "preview": {
        const [comp] = args;
        const url = preview(comp || undefined);
        console.log(`Remotion Studio started: ${url}`);
        break;
      }
      case "add": {
        const [name, ...descParts] = args;
        const desc = descParts.join(" ");
        if (!name || !desc) {
          console.error("Usage: api.ts add <PascalCaseName> <description>");
          process.exit(1);
        }
        const path = addComposition(name, desc);
        console.log(`Created: ${path}`);
        break;
      }
      default:
        console.log("Usage: npx tsx api.ts [scaffold|list|render|preview|add] ...");
        console.log("");
        console.log("  scaffold                          Create the Remotion project");
        console.log("  list                              List available compositions");
        console.log("  render <comp> --props '{...}'     Render composition to MP4");
        console.log("  preview [comp]                    Start Remotion Studio");
        console.log("  add <Name> <description>          Add a new composition");
    }
  })();
}

scripts- helper scripts it can run

prose-only skill - 1 inline code block live in SKILL.md above (no state/bin/ sidecar yet).

how we check it- the checks, plus the last 10 runs

rubric shape schema-shape check (no inline rubric)
recent mean 1.00 · 10 runs actor/auditor: unverifiable
deps none declared
timestamp verb score primary_issue artifact
2026-04-25 04:11Z - 1.00 - -
2026-04-21 15:58Z - 1.00 - -
2026-04-21 15:57Z - 1.00 - -
2026-04-21 03:53Z - 1.00 - -
2026-04-25 04:11Z - 1.00 - -
2026-04-21 15:58Z - 1.00 - -
2026-04-21 15:57Z - 1.00 - -
2026-04-21 03:53Z - 1.00 - -
2026-04-25 04:11Z - 1.00 - -
2026-04-21 15:58Z - 1.00 - -