new-series
Skill17 starsChanged 6 months agoMITView on GitHub
Create a complete content series (carousel, IG reel, or YouTube video) from a script. Scaffolds hub page, all parts/slides with Canvas 2D animations, and export buttons in one shot. Use when you provides a script or transcript and wants visual content built.
- Reads credentials
In this repository5 other files it gives its agents.
- igcaptionSkill
- produceSkill
- reel-overlaySkill
- srtSkill
- ytdescriptionSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. About 0 are common, 18 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈18
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
Before doing ANYTHING, ask these two questions:
- Distinctive: line 48
Wait for answers before proceeding.
- Distinctive: line 75
Wait for approval or adjustments before building.
- Distinctive: line 86
If the script mentions a product (e.g., Coresignal, Replit, Vercel), research what it actually does
- Very specific: line 90
Search query: "<brand> svg path" site:simpleicons.org or "<brand> logo svg path data"
- Very specific: line 92
Use new Path2D(svgPathString) to render on Canvas 2D
- Distinctive: line 100
If referencing any UI (macOS window, terminal, VS Code, etc.), look up the exact pixel values -- never estimate
- Distinctive: line 142
Wait for your approval before building
- Distinctive: line 146
Every visual must be personalized to your brand: Never use generic placeholders.
- Distinctive: line 153
Terminal commands: Use real project names like "notifymotion" or "tiltit", not "my-app"
- Distinctive: line 164
Research phase: If researching 4+ topics, launch 4+ parallel agents (one per topic)
- Distinctive: line 165
Build phase: If building slides 3-8, launch 6 parallel agents (one per slide)
- Distinctive: line 167
Never sequential: If two tasks don't depend on each other, they MUST run in parallel
- Distinctive: line 168
Single message, multiple Agent calls: Always send one message with multiple Agent tool blocks
- Distinctive: line 266
Use the format-specific template below.
- Distinctive: line 296
Default wallpaper: macOS Sequoia Dark
- Very specific: line 539
Import LandscapeExportButton from @/components/reel-export/LandscapeExportButton
- Distinctive: line 716
After building everything, commit as one batch:
- Distinctive: line 728
MANDATORY: After building, open the hub page and first part/slide in the browser so you can preview immediately:
- Distinctive: line 736
If the dev server isn't running, start it first:
- Very specific: line 764
ALL rendering uses Canvas 2D: Every pixel is drawn via CanvasRenderingContext2D.
- Distinctive: line 771
NEVER recreate the engine: Never write your own spring physics, easing functions, or animation loop.
- Very specific: line 772
NEVER recreate export buttons: Use ReelExportButton (portrait) or LandscapeExportButton (landscape) from @/components/reel-export/.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/new-series -- Automated Content Series Builder
Note for the public release. This skill was extracted from a private content-production project. It references an internal Canvas 2D engine, renderer, fonts, and brand assets that are NOT bundled in this repo, so it will not run end-to-end out of the box. It is published as a reference blueprint: read it to see the full workflow and adapt the patterns to your own stack.
Note for the public release. This skill was extracted from a private content-production project. It references an internal Canvas 2D engine, renderer, fonts, and brand assets that are NOT bundled in this repo, so it will not run end-to-end out of the box. It is published as a reference blueprint: read it to see the full workflow and adapt the patterns to your own stack.
Note for the public release. This skill was extracted from a private content-production project. It references an internal Canvas 2D engine, renderer, fonts, and brand assets that are NOT bundled in this repo, so it will not run end-to-end out of the box. It is published as a reference blueprint: read it to see the full workflow and adapt the patterns to your own stack.
You are building a content series inside the your project project at <your-project>/.
MANDATORY: ALL rendering uses Canvas 2D (CanvasRenderingContext2D). Never use HTML/CSS for visual content. Never use WebGL/Three.js. Every visual element is drawn with ctx.fillRect(), ctx.fillText(), ctx.drawImage(), roundedRect(), Path2D, etc. The Canvas 2D engine at @/lib/engine/ is the foundation of every single animation in this project.
Step 1: Ask TWO Questions
Before doing ANYTHING, ask these two questions:
Question 1: Format
What are we making?
- Carousel -- Canvas 2D slides (1080x1440), exported as PNG at 4x (4320x5760)
- IG Reel -- Canvas 2D animation (1080x1920 portrait), exported as MP4 via WebCodecs
- YouTube video -- Canvas 2D animation (1920x1080 landscape), exported as MP4 via WebCodecs
Question 2: Visual Pattern
Pick a visual pattern or describe a new one?
Existing Canvas 2D patterns:
# Pattern Example Series Good For 1 Terminal typing coresignal, claude-plugins Commands, code, prompts 2 VS Code mockup claude-setup File structures, configs 3 Split view (terminal + result) claude-plugins Before/after, input/output 4 Card reveal (spring pop) puttingonvercel Logos, comparisons, features 5 Apple Notes typing solofounder CTA CTA slides 6 Word-by-word spring reveal coresignal part3 Hero text, headings 7 Dot-flow board newseo Flowcharts, processes 8 Film strip layout claude-shortcuts Multi-frame sequences 9 Number count-up solofounder part10 Stats, revenue, metrics 10 Staggered list entry claude-plugins CTA Feature lists, bullet points 11 New -- describe it -- Custom visual concept
Wait for answers before proceeding.
Step 2: Auto-Name the Series + Parse the Script
Auto-generate the series name and slug by understanding the script's topic. Do NOT ask you for the name. Examples:
- Script about Claude Code tricks -> slug:
claude-tricks, title: "Claude Code Tricks" - Script about Vercel deployment -> slug:
vercel-deploy, title: "Deploying on Vercel" - Script about Coresignal data -> slug:
coresignal, title: "Coresignal"
Rules for slugs: lowercase, hyphenated, short (1-3 words max), descriptive.
Then break the script into individual parts/slides. Each distinct line, concept, or visual idea = one part.
Present a table for approval (include the auto-generated name):
Series: "<Auto-Generated Title>" (/<auto-slug>)
| Part | Script Line | Canvas 2D Visual Concept |
|------|------------|--------------------------|
| 1 | "line..." | Terminal window with typing animation (roundedRect + fillText) |
| 2 | "line..." | Card reveal with spring pop (scale transform + springInterpolate) |
| ... | ... | ... |Wait for approval or adjustments before building. you can override the name if needed.
Step 3: Research (MANDATORY -- ALWAYS DO THIS)
Before writing a single line of code, ALWAYS research the topic on the web. This is not optional. Even if you think you know, verify.
3a: Topic Research
- WebSearch the topic/product/brand mentioned in the script
- Understand what it is, how it works, key features -- so your visuals are accurate
- If the script mentions a product (e.g., Coresignal, Replit, Vercel), research what it actually does
3b: Logo Research (MANDATORY for any brand/product)
- WebSearch for the exact SVG path data from Simple Icons (https://simpleicons.org) or the brand's GitHub repo
- Search query:
"<brand> svg path" site:simpleicons.orgor"<brand> logo svg path data" - Extract the EXACT
d="..."attribute from the SVG -- do NOT approximate or draw logos freehand - Use
new Path2D(svgPathString)to render on Canvas 2D - NEVER use PNG/image assets for logos -- always SVG paths via Canvas 2D
Path2DAPI - NEVER guess or approximate a logo -- if you can't find the exact SVG path, tell you
3c: Design Research (pixel-perfect)
- WebSearch for exact hex colors, dimensions, typography, corner radii, spacing
- Get platform-specific measurements (iOS notification height, Slack sidebar width, etc.)
- Every visual must be pixel-perfect -- research actual screenshots, design specs, Apple HIG, Material Design, etc.
- If referencing any UI (macOS window, terminal, VS Code, etc.), look up the exact pixel values -- never estimate
3d: Google Trends Validation (MANDATORY for new content ideas)
ALWAYS pull real Google Trends data before committing to a topic. Use the SerpAPI Google Trends API to validate that the topic has real search interest and is trending in the right direction.
API endpoint: https://serpapi.com/search.json?engine=google_trends&q=<topics>&date=today+3-m&api_key=<SERPAPI_KEY>
- Compare up to 5 topics in one query (comma-separated)
- Use
date=today+3-mfor 3-month trend (best for content decisions) - Look for: Average interest score, peak value, growth trajectory (surging vs flat vs declining)
- Reject topics with flat/declining trends unless they have very high baseline interest
- Prioritize topics with 100+ peak and clear upward trajectory
- Present the trend data to you in a table format before finalizing topics
The SerpAPI key is stored in the project memory at memory/api-keys.md. Always use WebFetch to call the API.
Example query for Claude Code content:
https://serpapi.com/search.json?engine=google_trends&q=claude+code+mcp,claude+code+hooks,claude+code+plugins&date=today+3-m&api_key=<KEY>This step applies to content ideation and topic selection. Skip it only when you has already decided on the exact topic and just needs it built.
3e: ASCII Wireframe Before Building (MANDATORY)
Before coding ANY slide layout, draw an ASCII wireframe in the chat showing the exact structure. This ensures both sides agree on what is being built before a single line of code is written.
Example:
┌──────────┬──────────────────────┐
│ │ SKILL.md editor │
│ Sidebar │ (syntax highlighted) │
│ (tree) │ │
├──────────┼──────────────────────┤
│ TERMINAL │ OUTPUT PREVIEW │
│ $ claude │ (mini webpage) │
└──────────┴──────────────────────┘Rules:
- Label every section with its name and purpose
- Show proportions (50/50, 30/70, etc.)
- Show borders, dividers, and panel hierarchy
- Wait for your approval before building
- Draw a new wireframe for EVERY layout variation or change
3f: Personalize All Content (MANDATORY)
Every visual must be personalized to your brand. Never use generic placeholders.
- Name: you
- Brand: Lead Gen Man (leadgenman)
- Products: your project (notifymotion.com), TiltIt (tiltit.video)
- VS Code title bars: Show "-- you" or the project name
- Code/config examples: Reference your real projects, brand colors (#FF6B35), tech stack (Next.js, Canvas 2D, Zustand, Supabase, Stripe)
- Terminal commands: Use real project names like "notifymotion" or "tiltit", not "my-app"
- SKILL.md content inside carousels: Reference your coding standards, not generic rules
This makes every piece of content feel authentic and personal -- not AI-generated template content.
Step 4: Build Everything
MANDATORY: Use parallel subagents for EVERYTHING possible. This is non-negotiable.
- Research phase: If researching 4+ topics, launch 4+ parallel agents (one per topic)
- Build phase: If building slides 3-8, launch 6 parallel agents (one per slide)
- Research + build: Launch research agent AND build agent simultaneously
- Never sequential: If two tasks don't depend on each other, they MUST run in parallel
- Single message, multiple Agent calls: Always send one message with multiple Agent tool blocks
you expects maximum parallelism at all times. Sequential work when parallel is possible = wasted time.
4a: Create the Hub Page
Reel/Video hub: app/<series-slug>/page.tsx
Carousel hub: app/<series-slug>/carousel/page.tsx
Hub page pattern:
'use client';
import Link from 'next/link';
const PARTS = [
{ num: 1, title: 'Title', desc: 'Description', href: '/<slug>/part1', ready: true },
// ... one entry per part
];
export default function SeriesHub() {
return (
<div style={{
minHeight: '100vh',
background: '#0A0A0F',
fontFamily: '-apple-system, SF Pro Display, system-ui',
padding: '60px 24px',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
gap: 40,
}}>
{/* Header */}
<div style={{ textAlign: 'center', maxWidth: 680 }}>
<div style={{ fontSize: 11, textTransform: 'uppercase', letterSpacing: 2, color: '#FF6B35', marginBottom: 12 }}>
SERIES TYPE
</div>
<h1 style={{ fontSize: 32, fontWeight: 700, color: '#FFFFFF', margin: 0 }}>
Series Title
</h1>
<p style={{ fontSize: 14, color: 'rgba(255,255,255,0.5)', marginTop: 8 }}>
N parts
</p>
</div>
{/* Items */}
<div style={{ display: 'flex', flexDirection: 'column', gap: 8, width: '100%', maxWidth: 480 }}>
{PARTS.map(p =>
p.ready ? (
<Link key={p.num} href={p.href} style={{ textDecoration: 'none' }}>
<div style={{
display: 'flex', alignItems: 'center', gap: 16,
padding: '14px 18px', borderRadius: 12,
border: '1px solid rgba(255,255,255,0.06)',
background: 'rgba(255,255,255,0.02)',
cursor: 'pointer',
}}>
<div style={{
width: 32, height: 32, borderRadius: 8,
background: 'rgba(255,107,53,0.12)', color: '#FF6B35',
display: 'flex', alignItems: 'center', justifyContent: 'center',
fontSize: 13, fontWeight: 700,
}}>{p.num}</div>
<div style={{ flex: 1 }}>
<div style={{ fontSize: 14, fontWeight: 600, color: '#FFFFFF' }}>{p.title}</div>
<div style={{ fontSize: 12, color: 'rgba(255,255,255,0.4)', marginTop: 2 }}>{p.desc}</div>
</div>
<span style={{ color: 'rgba(255,255,255,0.2)', fontSize: 14 }}>→</span>
</div>
</Link>
) : (
<div key={p.num} style={{
display: 'flex', alignItems: 'center', gap: 16,
padding: '14px 18px', borderRadius: 12,
border: '1px solid rgba(255,255,255,0.03)',
background: 'rgba(255,255,255,0.01)',
opacity: 0.4,
}}>
<div style={{
width: 32, height: 32, borderRadius: 8,
background: 'rgba(255,255,255,0.04)', color: 'rgba(255,255,255,0.3)',
display: 'flex', alignItems: 'center', justifyContent: 'center',
fontSize: 13, fontWeight: 700,
}}>{p.num}</div>
<div style={{ flex: 1 }}>
<div style={{ fontSize: 14, fontWeight: 600, color: 'rgba(255,255,255,0.4)' }}>{p.title}</div>
</div>
<span style={{ fontSize: 11, color: 'rgba(255,255,255,0.2)' }}>Soon</span>
</div>
)
)}
</div>
</div>
);
}4b: Create Each Part/Slide
Use the format-specific template below. ALL content is rendered via Canvas 2D API.
FORMAT A: IG Reel (1080x1920 Portrait Video)
File pattern: app/<slug>/part<N>/page.tsx
Canvas 2D Engine Imports (MANDATORY)
'use client';
import { useEffect, useRef } from 'react';
import { createPlaybackLoop } from '@/lib/engine/animation-loop';
import { springInterpolate } from '@/lib/engine/spring';
import { easings } from '@/lib/engine/easing';
import { roundedRect } from '@/lib/engine/drawing-utils';
import type { AnimationConfig } from '@/lib/templates/types';
import Link from 'next/link';
import ReelExportButton from '@/components/reel-export/ReelExportButton';Canvas Dimensions
const CW = 1080; // Canvas width (portrait)
const CH = 1920; // Canvas height (portrait)Wallpaper Background (Canvas 2D -- cover-fit + dark overlay)
Default wallpaper: macOS Sequoia Dark
const WALLPAPER_URL = 'https://wsrv.nl/?url=512pixels.net/downloads/macos-wallpapers-6k/15-Sequoia-Dark-6K.jpg&output=webp&w=1920';Other wallpapers available:
- macOS Ventura Dark:
https://wsrv.nl/?url=512pixels.net/downloads/macos-wallpapers-6k/13-Ventura-Dark.jpg&output=webp&w=1920 - macOS Sonoma Dark:
https://wsrv.nl/?url=512pixels.net/downloads/macos-wallpapers-6k/14-Sonoma-Dark.jpg&output=webp&w=1920 - Local Sonoma Horizon:
/wallpapers/sonoma-horizon.png
Canvas 2D wallpaper drawing (cover-fit math):
if (wallpaper && wallpaper.complete) {
const scale = Math.max(CW / wallpaper.naturalWidth, CH / wallpaper.naturalHeight);
const dw = wallpaper.naturalWidth * scale;
const dh = wallpaper.naturalHeight * scale;
ctx.drawImage(wallpaper, (CW - dw) / 2, (CH - dh) / 2, dw, dh);
ctx.fillStyle = 'rgba(0, 0, 0, 0.5)'; // Dark overlay (0.38-0.70 range)
ctx.fillRect(0, 0, CW, CH);
} else {
ctx.fillStyle = '#0A0A0F'; // Fallback solid
ctx.fillRect(0, 0, CW, CH);
}Animation Config
const ANIM_CONFIG: AnimationConfig = {
duration: 6.0, // Total seconds
fps: 60, // Always 60 for reels
entryAnimation: 'spring-drop',
entryDuration: 1.6, // Spring entry phase
holdDuration: 4.4, // Content visible phase
exitAnimation: 'fade',
exitDuration: 0, // NO exit (reel rules: no fade-out)
spring: { stiffness: 280, damping: 22, mass: 1 },
};drawScene Function (Canvas 2D -- the core)
5-param signature for ReelExportButton:
function drawScene(
ctx: CanvasRenderingContext2D,
entryProgress: number, // 0-1 during entry
holdProgress: number, // 0-1 during hold
exitProgress: number, // 0-1 during exit
wallpaper: HTMLImageElement | null
) {
ctx.clearRect(0, 0, CW, CH);
// 1. Wallpaper + dark overlay (Canvas 2D)
// ... (see wallpaper pattern above)
// 2. Spring entry transform (Canvas 2D transforms)
const sp = springInterpolate(entryProgress, { stiffness: 280, damping: 22, mass: 1 });
const alpha = easings.easeOutQuad(Math.min(1, entryProgress * 2.5));
const entryScale = 0.85 + 0.15 * Math.min(1.02, sp);
ctx.save();
ctx.globalAlpha = alpha;
ctx.translate(CW / 2, CH / 2);
ctx.scale(entryScale, entryScale);
ctx.translate(-CW / 2, -CH / 2);
// 3. ALL CONTENT drawn with Canvas 2D API:
// ctx.fillRect(), ctx.fillText(), ctx.drawImage(),
// roundedRect(), ctx.beginPath(), ctx.arc(),
// new Path2D(svgString) for logos,
// ctx.createLinearGradient() for gradients
// 4. Sequenced reveals during hold phase:
// if (holdProgress > 0.3) { ... draw element 2 ... }
// if (holdProgress > 0.6) { ... draw element 3 ... }
ctx.restore();
}Spring Physics Configs (from engine)
Common presets:
{ stiffness: 280, damping: 22, mass: 1 } // Default (most parts)
{ stiffness: 300, damping: 22, mass: 1 } // iOS notification
{ stiffness: 260, damping: 24, mass: 1 } // Gentle entry
{ stiffness: 350, damping: 20, mass: 1 } // Snappy pop
{ stiffness: 320, damping: 20, mass: 1 } // Fast settle
{ stiffness: 400, damping: 30, mass: 1 } // Snappy, no overshoot
{ stiffness: 300, damping: 15, mass: 1 } // Bouncy overshootEasing Functions Available
easings.linear // t
easings.easeInQuad // t^2
easings.easeOutQuad // t(2-t) -- most common for fade-in
easings.easeInOutQuad // smooth both
easings.easeInCubic // t^3
easings.easeOutCubic // (t-1)^3+1 -- MOST USED for deceleration
easings.easeInOutCubic // smooth both
easings.easeOutBack // overshoot
easings.easeOutElastic // elastic oscillationAnimation Sequencing Patterns
Time-based sequencing (preferred for complex animations):
const tProg = (t: number, s: number, d: number) => Math.max(0, Math.min(1, (t - s) / d));
// Title at t=0s, duration 0.6s
const titleP = springInterpolate(tProg(currentTime, 0, 0.6), SPRING);
// Subtitle at t=0.5s, duration 0.5s
const subP = springInterpolate(tProg(currentTime, 0.5, 0.5), SPRING);holdProgress-based sequencing (for simpler animations):
// Element 1: holdProgress 0.0-0.3
if (holdProgress > 0) {
const p = easings.easeOutCubic(Math.min(1, holdProgress / 0.3));
ctx.globalAlpha = p;
// draw element 1...
}
// Element 2: holdProgress 0.3-0.6
if (holdProgress > 0.3) {
const p = easings.easeOutCubic(Math.min(1, (holdProgress - 0.3) / 0.3));
ctx.globalAlpha = p;
// draw element 2...
}Staggered items:
items.forEach((item, i) => {
const delay = 0.05 * i;
const p = Math.max(0, Math.min(1, (holdProgress - 0.2 - delay) / 0.1));
const alpha = easings.easeOutQuad(p);
ctx.globalAlpha = alpha;
// draw item...
});React Component
export default function PartN() {
const canvasRef = useRef<HTMLCanvasElement>(null);
const loopRef = useRef<{ stop: () => void; restart: () => void } | null>(null);
const wallpaperRef = useRef<HTMLImageElement | null>(null);
useEffect(() => {
const canvas = canvasRef.current;
if (!canvas) return;
// DPR scaling for crisp Retina preview (MANDATORY)
const dpr = window.devicePixelRatio || 1;
canvas.width = CW * dpr;
canvas.height = CH * dpr;
const ctx = canvas.getContext('2d');
if (!ctx) return;
ctx.scale(dpr, dpr);
// Load wallpaper
const img = new Image();
img.crossOrigin = 'anonymous'; // REQUIRED for external URLs
img.src = WALLPAPER_URL;
img.onload = () => { wallpaperRef.current = img; };
wallpaperRef.current = img;
// Animation loop (Canvas 2D frame-by-frame)
const loop = createPlaybackLoop(
ANIM_CONFIG,
(frame) => {
ctx.setTransform(dpr, 0, 0, dpr, 0, 0); // Reset DPR transform each frame
drawScene(ctx, frame.entryProgress, frame.holdProgress, frame.exitProgress, wallpaperRef.current);
},
() => {} // No loop, no fade-out (reel rules)
);
loopRef.current = loop;
return () => loop.stop();
}, []);
return (
<div style={{
minHeight: '100vh', background: '#000',
display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center',
gap: 12, padding: '12px 0',
}}>
<div style={{ display: 'flex', gap: 12, alignItems: 'center' }}>
<Link href="/<SERIES-SLUG>" style={{ color: 'rgba(255,255,255,0.3)', fontFamily: '-apple-system', fontSize: 12, textDecoration: 'none' }}>
← All parts
</Link>
<span style={{ color: 'rgba(255,255,255,0.15)', fontSize: 12 }}>|</span>
<span style={{ color: 'rgba(255,255,255,0.3)', fontFamily: '-apple-system', fontSize: 12 }}>
Part N -- Description
</span>
</div>
<canvas ref={canvasRef} width={CW} height={CH}
style={{ height: 'calc(100vh - 80px)', width: 'auto', display: 'block', borderRadius: 8, boxShadow: '0 0 80px rgba(0,0,0,0.9)' }}
/>
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
<button onClick={() => loopRef.current?.restart()}
style={{ background: 'rgba(255,255,255,0.06)', border: '1px solid rgba(255,255,255,0.1)', color: 'rgba(255,255,255,0.45)', padding: '6px 20px', borderRadius: 8, fontFamily: '-apple-system', fontSize: 12, cursor: 'pointer' }}>
Restart
</button>
<ReelExportButton drawScene={drawScene} animConfig={ANIM_CONFIG} wallpaperRef={wallpaperRef} filename="<SERIES>-part<N>.mp4" quality="high" />
</div>
</div>
);
}ReelExportButton Props (exact API)
interface ReelExportButtonProps {
drawScene: ReelDrawScene | ReelDrawSceneWithTime; // 5-param or 6-param
animConfig: AnimationConfig;
wallpaperRef?: React.RefObject<HTMLImageElement | null>;
filename?: string; // default: 'animation.mp4'
quality?: 'low' | 'medium' | 'high'; // default: 'high'
size?: 'default' | 'lg'; // 'default' = compact ghost, 'lg' = full-width coral
}Export pipeline: Canvas 2D frame -> OffscreenCanvas.transferToImageBitmap() (zero-copy) -> WebCodecs VideoEncoder (H.264) -> Mediabunny muxer -> MP4 blob -> downloadBlob() (File System Access API with anchor fallback)
ALWAYS export at highest resolution (4x). For ReelExportButton, the button exports at 1080x1920 by default. For carousels, use dpr = 4 (4320x5760). For landscape, use exportScale={4} (7680x4320).
Bitrate: 28 Mbps at 1080p (high quality), scaled proportionally for other resolutions.
FORMAT B: YouTube Video (1920x1080 Landscape)
Same Canvas 2D engine as Format A but:
const CW = 1920; const CH = 1080;- Import
LandscapeExportButtonfrom@/components/reel-export/LandscapeExportButton - Canvas style:
width: 'calc(100vw - 48px)', maxWidth: 1200, height: 'auto' - drawScene uses 6-param signature (adds
currentTimeas second param):
function drawScene(
ctx: CanvasRenderingContext2D,
currentTime: number, // seconds (raw time)
entryProgress: number,
holdProgress: number,
exitProgress: number,
wallpaper: HTMLImageElement | null
) { ... }LandscapeExportButton Props (exact API)
interface LandscapeExportButtonProps {
drawScene: LandscapeDrawScene; // 6-param (always includes currentTime)
animConfig: AnimationConfig;
wallpaperRef?: React.RefObject<HTMLImageElement | null>;
filename?: string; // default: 'animation.mp4'
quality?: 'low' | 'medium' | 'high';
width?: number; // logical width, default 1920
height?: number; // logical height, default 1080
exportScale?: number; // 1=1080p, 2=4K, 4=8K. ALWAYS USE 4 (8K) for you
}Scale picker UI shows: 1080p / 4K / 8K / 16K buttons. ALWAYS default to exportScale={4} (8K) for you. Forces H.264 codec for Descript/Premiere compatibility. Auto-reduces FPS at 8K+ to 30fps.
FORMAT C: Carousel (1080x1440 Static PNG via Canvas 2D)
File pattern: app/<slug>/carousel/slide<N>/page.tsx
Shared module: app/<slug>/carousel/_shared.tsx
Shared Module (_shared.tsx) -- Canvas 2D Constants & Helpers
// Canvas dimensions (Canvas 2D logical coordinates)
export const CW = 1080;
export const CH = 1440;
export const TOTAL_SLIDES = N;
// Typography (for ctx.font)
export const SF = '-apple-system, SF Pro Text, system-ui, sans-serif';
export const MONO = 'Menlo, Monaco, Consolas, monospace';
// Colors (for ctx.fillStyle)
export const BG = '#F4F3EE';
export const ACCENT = '#C15F3C';
export const TEXT_PRIMARY = '#333333';
export const TEXT_SECONDARY = '#666666';
// Canvas 2D drawing helpers
export function drawSlideDots(ctx: CanvasRenderingContext2D, current: number, total: number, y: number) {
const dotR = 4;
const gap = 14;
const totalW = (total - 1) * gap;
const startX = (CW - totalW) / 2;
for (let i = 0; i < total; i++) {
ctx.beginPath();
ctx.arc(startX + i * gap, y, dotR, 0, Math.PI * 2);
ctx.fillStyle = i === current - 1 ? ACCENT : 'rgba(0,0,0,0.15)';
ctx.fill();
}
}
// Add more shared Canvas 2D helpers as needed (drawWindow, drawTerminal, etc.)Individual Slide (Canvas 2D static render + PNG export)
'use client';
import { useCallback, useEffect, useRef, useState } from 'react';
import { downloadBlob } from '@/lib/export/videoExporter';
import { CW, CH, SF, BG, ACCENT, TOTAL_SLIDES, drawSlideDots } from '../_shared';
const SLIDE_NUM = 1;
const FILENAME = '<series>-carousel-01.png';
// Canvas 2D render function -- ALL content drawn here
function renderSlide(ctx: CanvasRenderingContext2D) {
ctx.clearRect(0, 0, CW, CH);
// Background (Canvas 2D)
ctx.fillStyle = BG;
ctx.fillRect(0, 0, CW, CH);
// === ALL CONTENT DRAWN WITH CANVAS 2D API ===
// ctx.fillText(), ctx.fillRect(), roundedRect(),
// ctx.drawImage(), new Path2D(), ctx.arc(), etc.
// Slide dots at bottom (Canvas 2D)
drawSlideDots(ctx, SLIDE_NUM, TOTAL_SLIDES, CH - 60);
}
export default function Slide1() {
const canvasRef = useRef<HTMLCanvasElement>(null);
const [exporting, setExporting] = useState(false);
useEffect(() => {
const canvas = canvasRef.current;
if (!canvas) return;
const ctx = canvas.getContext('2d');
if (!ctx) return;
renderSlide(ctx); // One-time Canvas 2D render
}, []);
// PNG Export: Canvas 2D -> OffscreenCanvas at 4x -> PNG blob -> download
const handleExport = useCallback(async () => {
if (exporting) return;
setExporting(true);
try {
const dpr = 4; // 4x scale -> 4320x5760 final
const offscreen = new OffscreenCanvas(CW * dpr, CH * dpr);
const offCtx = offscreen.getContext('2d') as unknown as CanvasRenderingContext2D;
offCtx.scale(dpr, dpr); // Scale Canvas 2D context
renderSlide(offCtx); // Re-render at high res
const blob = await offscreen.convertToBlob({ type: 'image/png' });
await downloadBlob(blob, FILENAME);
} catch (err) {
console.error('[PNG export]', err);
} finally {
setExporting(false);
}
}, [exporting]);
return (
<div style={{
minHeight: '100vh', background: 'radial-gradient(ellipse at 50% 30%, #F5F3EE 0%, #E8E4DB 100%)',
display: 'flex', flexDirection: 'column', alignItems: 'center', paddingTop: 56, paddingBottom: 48,
}}>
<div style={{ marginBottom: 24 }}>
<span style={{ fontSize: 11, textTransform: 'uppercase', letterSpacing: 2, color: ACCENT }}>
SERIES NAME -- SLIDE {SLIDE_NUM} OF {TOTAL_SLIDES}
</span>
</div>
<canvas ref={canvasRef} width={CW} height={CH}
style={{ width: '100%', maxWidth: 500, height: 'auto', borderRadius: 16, boxShadow: '0 2px 4px rgba(0,0,0,0.04), 0 12px 40px rgba(0,0,0,0.06)' }}
/>
<div style={{ marginTop: 24, width: '100%', maxWidth: 500 }}>
<button onClick={handleExport} disabled={exporting}
style={{
width: '100%', height: 52, borderRadius: 12, border: 'none',
background: '#FF6B35', color: '#FFF', fontSize: 15, fontWeight: 700,
cursor: exporting ? 'default' : 'pointer', fontFamily: SF,
}}>
{exporting ? 'Exporting PNG...' : `Export PNG (${CW * 4} x ${CH * 4})`}
</button>
</div>
<p style={{ marginTop: 14, fontSize: 11, color: 'rgba(0,0,0,0.3)' }}>
<a href="/<SERIES-SLUG>/carousel" style={{ color: 'inherit', textDecoration: 'none' }}>All slides</a>
· 1080 x 1440
</p>
</div>
);
}Carousel Export Details
- PNG at 4x DPR: 1080x1440 -> 4320x5760 final pixels
- Uses
OffscreenCanvas.convertToBlob({ type: 'image/png' })(NOT WebCodecs) - Download via
downloadBlob()from@/lib/export/videoExporter(File System Access API with anchor fallback) - Some carousels also offer animated MP4 export using same
exportVideo()pipeline as reels
Step 5: Commit
After building everything, commit as one batch:
NM-XXX: Add <series-name> -- N parts/slides (<format>)Include Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> in every commit.
Step 6: Open in Browser
MANDATORY: After building, open the hub page and first part/slide in the browser so you can preview immediately:
open http://localhost:8000/<series-slug>
open http://localhost:8000/<series-slug>/part1 # for reels/videos
open http://localhost:8000/<series-slug>/carousel/slide1 # for carouselsIf the dev server isn't running, start it first:
cd ~/Desktop/your project && npm run devDev server runs on port 8000 (NEVER port 3000 -- that's TiltIt).
CRITICAL RULES
Pixel-Perfect & Highest Resolution (MANDATORY)
- EVERYTHING must be pixel-perfect. Research exact dimensions, colors, fonts, spacing, corner radii before drawing anything. Never estimate. Never approximate. If you're referencing a UI (macOS, iOS, VS Code, terminal), look up the exact pixel values.
0b. ALWAYS export at 4x resolution. Carousel PNG:
dpr = 4(4320x5760). Landscape video:exportScale={4}(7680x4320). Portrait reel: native 1080x1920. 0c. ALWAYS research the topic on the web BEFORE writing code. Understand what the script is about. Research brand logos, colors, and SVG paths. This is not optional. 0d. ALWAYS use DPR scaling on preview canvases (MANDATORY). Every preview canvas must scale bywindow.devicePixelRatiofor crisp Retina rendering. Pattern:
const dpr = window.devicePixelRatio || 1;
canvas.width = CW * dpr;
canvas.height = CH * dpr;
const ctx = canvas.getContext('2d');
ctx.scale(dpr, dpr);
// In animation loop, reset each frame:
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);CSS size stays the same (controlled by style). Only the canvas buffer is scaled. This does NOT affect export resolution.
Canvas 2D Engine (MANDATORY)
- ALL rendering uses Canvas 2D. Every pixel is drawn via
CanvasRenderingContext2D. No HTML/CSS mockups. No DOM-based visuals. No WebGL/Three.js. - Import from
@/lib/engine/-- the animation engine already exists:createPlaybackLoopfrom@/lib/engine/animation-loopspringInterpolatefrom@/lib/engine/springeasingsfrom@/lib/engine/easingroundedRectfrom@/lib/engine/drawing-utilsAnimationConfigtype from@/lib/templates/types
- NEVER recreate the engine. Never write your own spring physics, easing functions, or animation loop. Import from the existing engine.
- NEVER recreate export buttons. Use
ReelExportButton(portrait) orLandscapeExportButton(landscape) from@/components/reel-export/. - Always
ctx.save()/ctx.restore()around Canvas 2D state changes (transforms, alpha, clip, font). - SVG logos via Path2D:
const path = new Path2D(svgPathString); ctx.fill(path);-- never use PNG images for logos.
Animation Rules
- No loop, no fade-out on reel parts (per reel rules).
exitDuration: 0. Completion callback:() => {}. - No captions below the canvas (per reel rules).
- Wallpaper: always set
crossOrigin = 'anonymous'for external URLs via wsrv.nl.
File Structure
- Always
'use client'as first line of every part/slide page. - Hub page route for carousels:
app/<slug>/carousel/page.tsx(slides insidecarousel/subfolder). - Hub page route for reels/videos:
app/<slug>/page.tsx(parts as direct children). - Series slug: lowercase, hyphenated (e.g.,
claude-setup,design-prompts).
Build Process
- Use parallel agents to build multiple parts simultaneously when possible.
- Round canvas dimensions to even numbers for WebCodecs compatibility.
- Dev server: localhost:8000 (NEVER port 3000).
- After building, ALWAYS open links in browser so you can preview immediately.
Canvas 2D Typography Reference
System: '-apple-system, SF Pro Display, system-ui'
Mono: 'Menlo, Monaco, Consolas, monospace'
Hero text: 'bold 48-56px' system
Body: '400 24-28px' system
Labels: '500 14-18px' system
Code/terminal: '400 16-20px' mono
Window titles: '500 13-14px' systemCanvas 2D Drawing Helpers Available
roundedRect(ctx, x, y, w, h, radius) // from @/lib/engine/drawing-utils
ctx.fillText(text, x, y) // built-in
ctx.measureText(text).width // built-in
ctx.drawImage(img, x, y, w, h) // built-in
ctx.createLinearGradient(x0, y0, x1, y1) // built-in
ctx.createRadialGradient(x0, y0, r0, x1, y1, r1) // built-in
new Path2D(svgPathString) // for SVG logos
ctx.clip() // for masking/clipping
ctx.arc(x, y, r, 0, Math.PI * 2) // circlesDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

