nums-remotion-replay

Project-specific skill for the Nums Remotion package that generates game replay videos by reusing the existing client React components. Covers the cross-package webpack setup, client-component overrides, Torii data fetching, font loading, render flow quirks, and hosting. Use when working on `remotion/` or the `SlidingNumber` component, adding new compositions, debugging font/animation issues, or setting up hosting for the Remotion Studio. Pairs with the generic `remotion-best-practices` skill.

9 stars

Best use case

nums-remotion-replay is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Project-specific skill for the Nums Remotion package that generates game replay videos by reusing the existing client React components. Covers the cross-package webpack setup, client-component overrides, Torii data fetching, font loading, render flow quirks, and hosting. Use when working on `remotion/` or the `SlidingNumber` component, adding new compositions, debugging font/animation issues, or setting up hosting for the Remotion Studio. Pairs with the generic `remotion-best-practices` skill.

Teams using nums-remotion-replay should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/nums-remotion-replay/SKILL.md --create-dirs "https://raw.githubusercontent.com/cartridge-gg/nums/main/.agents/skills/nums-remotion-replay/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/nums-remotion-replay/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How nums-remotion-replay Compares

Feature / Agentnums-remotion-replayStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Project-specific skill for the Nums Remotion package that generates game replay videos by reusing the existing client React components. Covers the cross-package webpack setup, client-component overrides, Torii data fetching, font loading, render flow quirks, and hosting. Use when working on `remotion/` or the `SlidingNumber` component, adding new compositions, debugging font/animation issues, or setting up hosting for the Remotion Studio. Pairs with the generic `remotion-best-practices` skill.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

## When to use

Load this skill when:

- Working in the `remotion/` workspace package
- Adding a new composition that reuses client components
- Debugging font loading, animation desync, or webpack alias issues
- Fetching game state from Torii for a replay
- Setting up hosting for the Remotion Studio (Railway, Render.com, etc.)
- Modifying the `SlidingNumber` component in `client/src/components/ui/sliding-number.tsx`

For generic Remotion patterns (compositions, sequencing, timing, fonts API, transitions, Tailwind in Remotion), **also load** `remotion-best-practices`.

## Core principle

The `remotion/` package **reuses** the client's existing React components (`GameScene`, `WelcomeScene`, `GameOver`, `Num`, `Slot`, etc.) via a webpack `@/` alias pointing to `client/src/`. **No duplication.** Visual fidelity with the live game is guaranteed because the exact same components render in both contexts.

The trade-off: Remotion uses webpack, but the client is a Vite app. Several Vite-only patterns must be shimmed in the Remotion webpack config (`import.meta.env`, absolute `/assets/foo.svg` imports, etc.).

## Project structure

```
remotion/
├── package.json              # @cartridge/nums-remotion workspace package
├── tsconfig.json             # paths: @/* → ../client/src/*
├── remotion.config.ts        # webpack aliases, DefinePlugin, WASM
├── tailwind.config.ts        # reuses client's preset, forces mobile breakpoints
├── postcss.config.js
├── src/
│   ├── index.ts              # registerRoot(RemotionRoot)
│   ├── root.tsx              # single `replay` Composition + calculateMetadata
│   ├── replay.tsx            # intro → game → outro + audio
│   ├── types.ts              # GameSnapshot interface
│   ├── fonts.ts              # useFonts() hook with delayRender
│   ├── styles.css            # imports client themes + @font-face
│   ├── data/
│   │   └── torii.ts          # fetchGameReplay() SQL query + unpacking
│   └── overrides/
│       ├── countup.tsx       # replaces @/components/animations/countup
│       └── numbers-svg.ts    # replaces /assets/numbers.svg import
```

## Rule files

- [rules/webpack-setup.md](rules/webpack-setup.md) — Cross-package webpack aliases, `import.meta.env` shimming, client-component overrides, WASM support
- [rules/torii-data.md](rules/torii-data.md) — Fetching game state from Torii SQL, unpacking Power/Trap bitmasks, `calculateMetadata` pattern
- [rules/fonts-and-animations.md](rules/fonts-and-animations.md) — PixelGame font loading via `delayRender`, `SlidingNumber` re-measure after `document.fonts.ready`, `MotionConfig reducedMotion` for render-vs-studio desync
- [rules/hosting.md](rules/hosting.md) — Why Vercel doesn't work, Railway/Render.com/Fly.io setup, licensing considerations, Lambda alternative

## Quick commands

From the repo root:

```bash
# Studio (local dev, hot reload)
pnpm remotion:studio

# Render a specific game (needs Torii reachable)
pnpm remotion:render:game '{"gameId":343,"numsPrice":0.0115}'

# Render a single frame (fast sanity check)
npx -C remotion remotion still src/index.ts replay out/frame.png --frame=60 --props='{"gameId":343,"numsPrice":0.0115}'
```

From the `remotion/` directory:

```bash
pnpm studio
pnpm render
pnpm render:game '{"gameId":343}'
```

## Non-obvious gotchas (READ FIRST)

1. **Video dimensions must be even**. H264 rejects odd widths/heights. `width=376` is OK, `width=375` will error at render time.

2. **The Studio URL cannot be used for routing**. When the user clicks "Render Video" in the Studio at `/some-path/1102`, the render's headless browser strips the path. Don't rely on `window.location.pathname` for composition registration. Use `defaultProps` populated from the Studio's props panel or CLI `--props`.

3. **framer-motion + Remotion frame clock desync**. framer-motion's `useSpring` runs on real-time `requestAnimationFrame`. During render, Remotion advances the clock frame-by-frame. This causes shivering/trembling animations. Fix: wrap the render tree in `<MotionConfig reducedMotion={isRendering ? "always" : "never"}>` using `getRemotionEnvironment().isRendering`.

4. **Fonts load AFTER the first render in the Studio**. If a component (like `SlidingNumber`) measures its dimensions on mount, it gets the fallback-font height, not PixelGame's. Re-measure after `document.fonts.ready` or use `delayRender` to block the first capture until fonts are loaded.

5. **Client components that use `import foo from "/assets/bar.svg"` (Vite absolute path) break webpack**. Create an override in `remotion/src/overrides/` that uses `staticFile()` and alias the resolved file path in `remotion.config.ts`. See [rules/webpack-setup.md](rules/webpack-setup.md).

6. **Mobile breakpoints**. The client uses Tailwind `md:` for desktop layout (768px). In Remotion Studio, the browser viewport is wider than 768px, so `md:` styles fire, showing the desktop layout at a 376px composition width → broken. `remotion/tailwind.config.ts` forces all breakpoints to `9999px` so `md:` never triggers → mobile layout always wins.

7. **`Power.from(n)` and `Power.index()` are NOT inverses**. `Power.from(1)` returns `Reroll` (enum index), but `Power(Reroll).index()` returns `0` (custom mapping). When storing/restoring powers, use `Power.into()` ↔ `Power.from()` — NOT `Power.index()` ↔ `Power.from()`.

## Related skills

- **`remotion-best-practices`** — Generic Remotion patterns (compositions, timing, sequencing, transitions, Zod schemas, audio, images, Tailwind)
- **`ui-architecture`** — Client component conventions (CVA variants, `data-slot`, Radix primitives)
- **`shadcn`** — Managing shadcn/ui components (where `SlidingNumber` came from)

Related Skills

render-daily-replay

9
from cartridge-gg/nums

Auto-render a Remotion video replay of a Nums game on Mainnet. Resolves the target `gameId` from Torii (best reward of the day OR best score of the day, OR a specific gameId the user provides), silently auto-fetches the current NUMS price from Ekubo, then runs `pnpm remotion:render:game` with the right props. Use when the user asks to render today's top game, the daily winner, the biggest reward, the highest score, or any specific gameId, without having to assemble the render command by hand.

remotion-best-practices

9
from cartridge-gg/nums

Best practices for Remotion - Video creation in React

ui-ux-pro-max

9
from cartridge-gg/nums

UI/UX design intelligence for web and mobile. Includes 50+ styles, 161 color palettes, 57 font pairings, 161 product types, 99 UX guidelines, and 25 chart types across 10 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui, and HTML/CSS). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, and check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, and mobile app. Elements: button, modal, navbar, sidebar, card, table, form, and chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, and flat design. Topics: color systems, accessibility, animation, layout, typography, font pairing, spacing, interaction states, shadow, and gradient. Integrations: shadcn/ui MCP for component search and examples.

ui-architecture

9
from cartridge-gg/nums

UI component patterns for the Nums game client — Radix primitives, elements, containers, theming, Storybook conventions. Use when creating or modifying UI components, adding storybook stories, or working with the design system.

ui-architecture-icon

9
from cartridge-gg/nums

Add SVG icons to the Nums game client — convert SVG, create component, export, update storybook. Use when adding, modifying, or removing icon components.

shadcn

9
from cartridge-gg/nums

Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI. Provides project context, component docs, and usage examples. Applies when working with shadcn/ui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for "shadcn init", "create an app with --preset", or "switch to --preset".

dojo

9
from cartridge-gg/nums

Dojo Engine framework patterns — World, Systems, Models, Events, Components, Store, permissions, testing with spawn_test_world, and deployment with sozo.

dojo-world

9
from cartridge-gg/nums

Manage world permissions, namespaces, resource registration, and access control. Use when configuring world ownership, setting up authorization policies, or managing resource permissions.

Cartridge VRF Integration

9
from cartridge-gg/nums

Integrate Cartridge's Verifiable Random Function (VRF) for provably fair, atomic randomness in Dojo games.

dojo-token

9
from cartridge-gg/nums

Implement, deploy, and index ERC20 and ERC721 tokens in Dojo. Use when adding token contracts, deploying them, or configuring Torii to index balances and transfers.

dojo-test

9
from cartridge-gg/nums

Write tests for Dojo models and systems using spawn_test_world, cheat codes, and assertions. Use when testing game logic, verifying state changes, or ensuring system correctness.

dojo-system

9
from cartridge-gg/nums

Create Dojo systems that implement game logic, modify model state, and handle player actions. Use when implementing game mechanics, player commands, or automated logic.