diff --git a/README.md b/README.md index c2c1879d5..0ca718a23 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ npx skills add heygen-com/hyperframes This teaches your agent (Claude Code, Cursor, Gemini CLI, Codex) how to write correct compositions and GSAP animations. In Claude Code, the skills register as slash commands — invoke `/hyperframes` to author compositions, `/hyperframes-cli` for CLI commands, and `/gsap` for animation help. -For Claude Design, use the GitHub-hosted entry point at [`skills/claude-design-hyperframes/SKILL.md`](https://github.com/heygen-com/hyperframes/blob/main/skills/claude-design-hyperframes/SKILL.md) and let Claude fetch the repo's `skills/` tree from there. See the [Claude Design guide](https://hyperframes.heygen.com/guides/claude-design). +For Claude Design, download [`skills/claude-design-hyperframes/SKILL.md`](https://github.com/heygen-com/hyperframes/blob/main/skills/claude-design-hyperframes/SKILL.md) and attach it to your chat. Claude Design produces a valid first draft; refine it in any AI coding agent. See the [Claude Design guide](https://hyperframes.heygen.com/guides/claude-design). For Codex specifically, the same skills are also exposed as an [OpenAI Codex plugin](./.codex-plugin/plugin.json) — sparse-install just the plugin surface: @@ -184,14 +184,14 @@ HyperFrames ships [skills](https://github.com/vercel-labs/skills) that teach AI npx skills add heygen-com/hyperframes ``` -| Skill | What it teaches | -| --------------------------- | ------------------------------------------------------------------------------------------------------- | -| `claude-design-hyperframes` | Claude Design entry point that pulls the upstream `skills/` tree and standardizes player-based previews | -| `hyperframes` | HTML composition authoring, captions, TTS, audio-reactive animation, transitions | -| `hyperframes-cli` | CLI commands: init, lint, preview, render, transcribe, tts, doctor | -| `hyperframes-registry` | Block and component installation via `hyperframes add` | -| `website-to-hyperframes` | Capture a URL and turn it into a video — full website-to-video pipeline | -| `gsap` | GSAP animation API, timelines, easing, ScrollTrigger, plugins, React/Vue/Svelte, performance | +| Skill | What it teaches | +| --------------------------- | ------------------------------------------------------------------------------------------------------------------ | +| `claude-design-hyperframes` | Template-first Claude Design skill — pre-valid skeletons, produces video drafts for refinement in any coding agent | +| `hyperframes` | HTML composition authoring, captions, TTS, audio-reactive animation, transitions | +| `hyperframes-cli` | CLI commands: init, lint, preview, render, transcribe, tts, doctor | +| `hyperframes-registry` | Block and component installation via `hyperframes add` | +| `website-to-hyperframes` | Capture a URL and turn it into a video — full website-to-video pipeline | +| `gsap` | GSAP animation API, timelines, easing, ScrollTrigger, plugins, React/Vue/Svelte, performance | ## Contributing diff --git a/docs/guides/claude-design.mdx b/docs/guides/claude-design.mdx index 069652222..91ccee584 100644 --- a/docs/guides/claude-design.mdx +++ b/docs/guides/claude-design.mdx @@ -1,31 +1,37 @@ --- title: Claude Design -description: "Use HyperFrames from Claude Design with a GitHub-hosted skill entry point that pulls the repo's existing skills and preview patterns." +description: "Create HyperFrames video drafts in Claude Design using a template-first skill, then refine in any AI coding agent." --- -Claude Design needs a different setup than Claude Code, Cursor, or Codex. The local `npx skills add heygen-com/hyperframes` flow is the right path for coding agents. For Claude Design, attach the HyperFrames skill file to your chat — empirically that produces sharper, more rule-compliant output than pasting the URL. - -## Get the skill - - - - Save the file, then drag it into a Claude Design chat as an attachment. - - - Read the skill, copy sections, or link to it in a prompt. - - +Claude Design produces a **valid first draft** of a HyperFrames video — brand identity, scene content, layout, animations, and transitions. You then download the ZIP and refine in any AI coding agent (Claude Code, Cursor, Codex, Windsurf, etc.) with linting and live preview. + +## Get started + + + + Save [`SKILL.md`](https://raw.githubusercontent.com/heygen-com/hyperframes/main/skills/claude-design-hyperframes/SKILL.md) to your computer. + + + Start a new chat at [claude.ai](https://claude.ai) with Claude Design enabled. + + + Drag the SKILL.md file into the chat. Describe what you want — include screenshots, brand assets, or a palette if you have them. + + + Claude Design produces `index.html`, `preview.html`, `README.md`, and `DESIGN.md`. Download the ZIP. + + + Open the project in Claude Code, Cursor, Codex, or any agent with terminal access for animation polish, timing, and production QA. + ```bash + npx skills add heygen-com/hyperframes # install skills (one-time) + npx hyperframes lint # should pass with zero errors + npx hyperframes preview # open the studio + ``` + + - **Prefer attaching the file over pasting the URL.** Claude Design reads file attachments natively with detail preserved. URL-driven runs produce usable output but consistently miss more rules than attachment-driven runs. + **Attach the file, don't paste the URL.** Claude Design reads file attachments natively with detail preserved. URL-driven runs produce usable output but consistently miss more rules. ## Which setup to use @@ -36,127 +42,99 @@ Claude Design needs a different setup than Claude Code, Cursor, or Codex. The lo | Claude Code | `npx skills add heygen-com/hyperframes`, then use `/hyperframes` | | Cursor / Codex / Gemini CLI | `npx skills add heygen-com/hyperframes` | -## Prompt shape for Claude Design - -Claude Design does not use slash commands. Lead with the skill file (attached or URL), describe the video, and ideally give Claude Design something to synthesize from — screenshots, a brand PDF, a reference video, a pasted palette, or at minimum a vibe in words. +## How the skill works -The skill reads inputs in this order of reliability: **attachments → pasted content → web research → URLs**. A modern SPA homepage returns almost nothing via `web_fetch` because JavaScript isn't executed, so brand-accurate output on brief like "make a video for linear.app" depends on attaching screenshots or letting Claude Design search for the brand's blog, press, or Wikipedia. +The skill gives Claude Design **pre-valid HTML skeletons** — the structural rules (data attributes, timeline registration, scene visibility, preview token forwarding) are already embedded. Claude Design fills in the creative work: -Strong Claude Design prompts usually include: +1. **Palette + typography** — CSS custom properties on `:root` +2. **Scene content** — text, images, layout inside `.scene-content` wrappers +3. **Animations** — GSAP entrance tweens and mid-scene activity +4. **Transitions** — hard cuts for most scenes, shader transitions at 2-3 key moments -- the attached skill file (or its URL) -- the source material: screenshots, a brand PDF, a reference video, pasted copy, or a URL -- duration and aspect ratio -- tone or visual direction (if you have one — otherwise let Claude Design ask) -- explicit deliverables: `index.html`, `preview.html`, `README.md` +This template-first approach means the output passes `npx hyperframes lint` with zero errors on first download — Claude Code can start refining immediately without structural fixes. -## Copy-paste prompts +## Example prompts - + ```text - Use the attached skill. Make a 30-second 16:9 product walkthrough for my app, - matching the design in these screenshots. 5 scenes: hero, three features, - closing CTA. Shader transitions between scenes. + Use the attached skill. I just shipped dark mode for my app. Make me a + 15-second Instagram reel announcing it. + + - App name: Taskflow + - Primary color: #6C5CE7 + - The vibe is clean, minimal, dark + - Key stat: "47% of users requested this" ``` - + ```text - Use the attached skill. 30s hero reel with this copy for each scene: + Use the attached skill. 25-second LinkedIn video for my startup. - 1. "The fast web broke us." - 2. "Every app optimized for attention. None for thought." - 3. "Something is changing. Blogs are back." - 4. "Welcome to the slow web." + Problem: Sales teams waste 3 hours/day on manual CRM updates. + Solution: AutoCRM — AI that logs every call, email, and meeting. + Traction: 200+ teams, $1.2M ARR, 18% MoM growth. + CTA: autocrmhq.com - Dark theme, editorial, serif typography (not Playfair). + Professional but not corporate. Think Linear or Vercel energy. ``` - + ```text - Use the attached skill. Make a 30-second launch video for Orbit. - ``` + Use the attached skill. 10-second reel. Just one big number: - The skill will ask ONE short question offering five input channels - (screenshot, PDF, reference video, vibe word, must-have element) plus - a "just build" escape hatch before generating. + "$4.2 billion processed in Q1 2026" + + Dark background, the number should animate up from zero. Subtle, + confident. End with logo placeholder and "stripe.com" + ``` - + ```text - Use the HyperFrames Claude Design skill at - https://github.com/heygen-com/hyperframes/blob/main/skills/claude-design-hyperframes/SKILL.md - and turn https://www.anthropic.com/news/claude-design-anthropic-labs into a - 45-second editorial explainer. Keep copy close to the article's real headlines. + Use the attached skill. Make a 30-second launch video for Orbit. ``` + + The skill asks ONE short clarifying question before generating. -## Preview with `@hyperframes/player` - -When Claude Design generates a `preview.html`, it embeds the composition with `` and forwards the Claude Design sandbox's preview token into the iframe src. Without the token forward, the in-pane preview renders black (the sandbox serves a `"preview token required"` placeholder to the iframe). - -Copy this template verbatim: - -```html - - - - - HyperFrames Preview - - - - - - - - -``` +## What to include in your prompt -When `location.search` is empty (opened locally, outside Claude Design's sandbox), the token-forward line is a no-op and the player loads `./index.html` as expected. +Claude Design reads inputs in this order of reliability: **attachments > pasted content > web research > URLs**. -The composition (`index.html`) must also pre-load the HyperFrames runtime right after GSAP so the player can drive playback inside Claude Design's sandbox: +| Input type | What it gives Claude Design | +| --- | --- | +| Screenshots / PDFs / brand guides | Palette, typography, UI patterns, tone — strongest source | +| Pasted hex codes, typefaces, copy | Authoritative for what it covers | +| Brand name (well-known) | Claude Design can research blogs, press, Wikipedia | +| SPA URL (React/Vue homepage) | Returns near-empty shell — pivot to blog/press instead | -```html - - -``` +The more specific your prompt, the better the output. Include palette, fonts, duration, and scene ideas when you have them. -If a classic script tag is needed instead of ESM, use the global player build with the same token-forwarding script: - -```html - - - -``` +## Known limitations + +- **In-pane preview** — scrubbing is unreliable in Claude Design's iframe sandbox. Download and use `npx hyperframes preview` locally for reliable playback. +- **No linting** — Claude Design can't run `npx hyperframes lint`. The template-first skeletons handle structural validity, but the self-review checklist is the only QA before download. +- **No shaders on vertical** — HyperShader's WebGL canvas is hardcoded to 1920x1080. Vertical (1080x1920) compositions use hard cuts only. +- **3 fetch limit** — Claude Design limits web fetches per turn. All critical rules are inlined in the skill; external references are for edge cases only. +- **Seeking backwards** — scrubbing backwards in the in-pane preview can show blank frames (async capture race condition). Forward seeking usually works. -See [`@hyperframes/player`](/packages/player) for the full API and framework examples. +## The handoff to your coding agent -## What the skill teaches Claude Design +Claude Design's output is a valid first draft. Open it in Claude Code, Cursor, Codex, or any AI coding agent with terminal access: + +```bash +npx skills add heygen-com/hyperframes # one-time setup +npx hyperframes lint # verify structure +npx hyperframes preview # open the studio +``` -The skill is self-contained — it includes every HyperFrames-specific contract and every known Claude Design sandbox workaround, so Claude Design rarely needs to fetch additional references. Highlights: +Then iterate: -- An explicit opening redirect: Claude Design is told NOT to reach for its default video artifacts (`copy_starter_component` with `kind: "animations.jsx"`, the built-in "Animated video" skill, React + Babel JSX, hand-rolled scale-to-fit stage wrappers). This is the single change that most reliably keeps Claude Design on the HyperFrames path -- Correct `data-*` composition structure, the clip contract on scenes, and paused GSAP timelines registered on `window.__timelines` -- Shader-transition timing rules: transitions must span the scene boundary (not start at it), animated content must be wrapped in `
` so its pre-animation state doesn't leak into the WebGL texture, and the `scenes.length === transitions.length + 1` invariant (with `flash-through-white` as the invisible-bridge escape hatch) -- Sandbox-compatible preview: token-forwarding `preview.html` template, runtime pre-load in `index.html`, `data-composition-id` ↔ `__timelines` key match (and a convention that the root element's DOM `id` matches too) -- Attachment-first input model: read screenshots / PDFs / reference videos when provided, otherwise ask one short clarifying question before generating -- A banned-font list (including Fraunces, Inter Tight, and common AI defaults) plus a banned-pairings line to break the training-data monoculture -- Deterministic render-safe animation choices (no `Date.now()`, no unseeded `Math.random()`, no `repeat: -1`, no `stagger: { from: "random" }`) -- Four worked-example anti-patterns with WRONG/RIGHT code pairs — exit tweens before shader transitions, non-deterministic `stagger` origins, absolute-positioned content containers, and SVG filter data URLs as `background-image` (the last one causes `SecurityError` on Safari + cross-origin iframe environments) -- A `README.md` template for the end user with `npx hyperframes doctor` / `preview` / `render` commands and FFmpeg install instructions +- "Make scene 3's entrance snappier" +- "Add a counter animation to the stat in scene 5" +- "Tighten the pacing — scenes 4 and 6 feel too long" +- "Change the shader on transition 2 to glitch" ## Next steps diff --git a/docs/guides/prompting.mdx b/docs/guides/prompting.mdx index 69a3cc765..47e94d479 100644 --- a/docs/guides/prompting.mdx +++ b/docs/guides/prompting.mdx @@ -29,13 +29,18 @@ In Claude Code, restart the session after installing. Skills register as **slash ## Claude Design -Claude Design uses a different setup. Instead of local slash commands, point it at the GitHub-hosted Claude Design entry point for HyperFrames: +Claude Design uses a different setup. Download [`SKILL.md`](https://raw.githubusercontent.com/heygen-com/hyperframes/main/skills/claude-design-hyperframes/SKILL.md) and **attach it to your chat** (don't paste the URL — file attachments produce better output): ```text -Use https://github.com/heygen-com/hyperframes/blob/main/skills/claude-design-hyperframes/SKILL.md and make a 30-second product video about [topic]. Deliver index.html, preview.html, and README.md. +Use the attached skill. 25-second LinkedIn video for my startup. + +Problem: Sales teams waste 3 hours/day on manual CRM updates. +Solution: AutoCRM — AI that logs every call, email, and meeting. +Traction: 200+ teams, $1.2M ARR, 18% MoM growth. +CTA: autocrmhq.com ``` -That entry point tells Claude Design to fetch the broader [`skills/`](https://github.com/heygen-com/hyperframes/tree/main/skills) tree, apply the same HyperFrames rules, and use `@hyperframes/player` for preview pages. See the [Claude Design guide](/guides/claude-design) for the recommended prompt shape. +Claude Design produces a valid first draft (brand identity, scene content, animations, transitions). Download the ZIP and refine in any AI coding agent with `npx hyperframes preview` running. See the [Claude Design guide](/guides/claude-design) for the full workflow. ## The two prompt shapes diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx index 86e815a48..fb40364a7 100644 --- a/docs/quickstart.mdx +++ b/docs/quickstart.mdx @@ -16,7 +16,7 @@ npx skills add heygen-com/hyperframes This teaches your agent (Claude Code, Cursor, Gemini CLI, Codex) how to write correct compositions and GSAP animations. In Claude Code the skills register as slash commands — `/hyperframes` for composition authoring, `/hyperframes-cli` for CLI commands, and `/gsap` for animation help. Invoking the slash command loads the skill context explicitly, which produces correct output the first time. - Claude Design uses a different entry path. Point Claude Design at [`skills/claude-design-hyperframes/SKILL.md`](https://github.com/heygen-com/hyperframes/blob/main/skills/claude-design-hyperframes/SKILL.md) so it can fetch the repo's `skills/` tree and generate a HyperFrames handoff. See the [Claude Design guide](/guides/claude-design). + Claude Design uses a different entry path. Download [`skills/claude-design-hyperframes/SKILL.md`](https://github.com/heygen-com/hyperframes/blob/main/skills/claude-design-hyperframes/SKILL.md) and attach it to your Claude Design chat. It produces a valid first draft you can refine in any AI coding agent. See the [Claude Design guide](/guides/claude-design). ### Try it: example prompts diff --git a/skills/claude-design-hyperframes/SKILL.md b/skills/claude-design-hyperframes/SKILL.md index 3ec47654c..35e45f1bf 100644 --- a/skills/claude-design-hyperframes/SKILL.md +++ b/skills/claude-design-hyperframes/SKILL.md @@ -1,677 +1,445 @@ --- name: claude-design-hyperframes -description: Claude Design entry point for HyperFrames. Produce renderable HyperFrames videos in Claude Design with a working in-pane preview. Use for any request to create a video, animation, launch teaser, editorial explainer, product tour, social reel, or motion deliverable. +description: Use when running inside Claude Design specifically. Produces a valid, brand-accurate HyperFrames video draft using pre-valid skeletons. For Claude Code / Cursor / Codex, use the `hyperframes` skill instead. --- -# Claude Design + HyperFrames +# Claude Design + HyperFrames (Template-First) -For this project, your medium is **HyperFrames compositions**: plain HTML + CSS + a paused GSAP timeline. A separate CLI (`npx hyperframes render index.html`) turns the HTML into an MP4. You are authoring the HTML files — the user runs the CLI locally. You do NOT need a CLI environment to produce these files. +Your medium is **HyperFrames compositions**: plain HTML + CSS + a paused GSAP timeline. The CLI (`npx hyperframes render index.html`) turns the HTML into an MP4. You author the HTML -- the user renders locally. -**HyperFrames replaces your default video-artifact workflow for this project.** When the user asks for a video, animation, launch teaser, editorial explainer, product tour, social reel, or any motion deliverable: - -- Do **NOT** call `copy_starter_component` with `kind: "animations.jsx"`. The animations.jsx starter is the wrong format here — HyperFrames uses plain HTML + GSAP, not React Sprites. -- Do **NOT** invoke the built-in "Animated video" skill. HyperFrames replaces it for this project. -- Do **NOT** use React, Babel, or ` - -``` +Use at least 3 different eases per scene. Don't default to `power2.out` on everything. -**Scene-count invariant — `scenes.length === transitions.length + 1`:** HyperShader enforces this at init. Pick one anchor scene BEFORE the first transition, and one anchor AFTER each transition. A video with three act-boundary transitions needs exactly four anchor scenes. Scenes between anchors (non-bracketing, runtime-managed) carry `style="visibility:hidden;"` instead of `style="opacity:0;"` — they're not HyperShader-managed so nothing animates their opacity back to 1. +| Feeling | Ease | Duration | +| ---------- | --------------- | -------- | +| Smooth | `power2.out` | 0.4-0.6s | +| Snappy | `power4.out` | 0.2-0.3s | +| Bouncy | `back.out(1.6)` | 0.3-0.5s | +| Dramatic | `expo.out` | 0.3-0.5s | +| Dreamy | `sine.inOut` | 0.5-0.8s | +| Mechanical | `steps(5)` | 0.3-0.5s | -The simplest working pattern: list only the scene just before AND just after each shader cut. Do NOT list every scene in Act II just because they "span" a transition — that violates the invariant. If you genuinely need MORE listed anchors than real shader transitions (rare — e.g., tracking an additional fade beat that's not a visible shader bridge), insert `{ shader: "flash-through-white", duration: 0.01 }` as an invisible no-op bridge to satisfy the invariant. This is a workaround; the cleaner fix is almost always to drop the extra anchor. +--- -**Transition timing (critical — the scene boundary must fall INSIDE the transition window):** +## Step 4: Transitions -Scene windows are half-open (`[start, start+duration)`). At time `B` (the boundary), the runtime has already flipped the outgoing scene to `visibility:hidden`. If `transition.time === B`, `html2canvas` captures a blank outgoing texture → shader transitions from blank → incoming → visible blink. +### The professional rule: most cuts are hard cuts -Rule: `transition.time < B` AND `transition.time + duration > B`. Simplest — center it: `transition.time = B - duration/2`. Example: scene-1 ends at 6, duration 0.5 → `time: 5.75`. +In professional video, ~95% of scene changes are hard cuts. Effect transitions (shaders, dissolves) are reserved for 2-3 key moments — a hero reveal, an energy shift, the CTA landing. Using a shader on every cut is the video equivalent of bolding every word in a paragraph. -**Scene visibility: HANDS OFF.** HyperShader owns scene `opacity` end-to-end. Do NOT add `tl.set(#scene-N, {autoAlpha: …}, …)` on scene containers. If you do, you create the same visibility race that produces the blink. +The skeleton pre-wires **2 shader transitions at key moments** and **hard cuts everywhere else**. This gives you varied rhythm: cut-cut-SHADER-cut-cut-SHADER-cut. -### Sub-compositions — default NO for videos ≤ 3 minutes +### Three transition types -Default to a single `index.html` with scenes tiled inline. 30-second to 2-minute compositions fit cleanly in one file (~1500–2000 lines). Single file = single HyperShader instance = no canvas conflicts = everything works. +**Hard cut (default -- most scenes use this):** +No transition code needed. Scene N disappears, scene N+1 appears. The entrance animations on the new scene do all the visual work. This is the professional default. -Split into sub-compositions ONLY when one of these is true: +**Shader transition (2-3 per video -- hero/climax/CTA moments):** +Pre-wired in the skeleton at key positions. HyperShader captures both scenes as textures and composites them pixel-by-pixel via WebGL. -- Video length > 3 minutes AND you need organizational structure. -- You're extracting a REUSABLE sub-comp that appears in multiple places (chart block, logo outro). -- A single scene is so complex it deserves its own file (full UI recreation, heavy data-vis). +**When to use shaders vs hard cuts:** -If you do split, **HyperShader lives at the ROOT `index.html` ONLY** — never inside a sub-composition. HyperShader hardcodes `#gl-canvas` as its canvas ID (see the canvas creation path in `packages/shader-transitions/src/hyper-shader.ts`); multiple HyperShader instances can't share one canvas. When a sub-comp's HyperShader fails silently on canvas conflict, its fallback code calls `document.querySelectorAll(".scene")` document-wide and sets every scene's opacity to 0 — corrupting visibility across the whole document. Symptom: only scene-1 of each act shows, scenes 2+ never appear. +| Use shader for | Use hard cut for | +| ------------------------------- | ------------------------------------ | +| Hero reveal / product unveil | Connective scenes between features | +| Major energy shift or act break | Rapid-fire lists or stats | +| CTA / final brand moment | 3+ consecutive quick scene changes | +| Any moment the music punctuates | Scenes where pacing should feel fast | -#### Sub-composition file shape +Rule of thumb: a 6-8 scene video wants **2 shader transitions** and the rest hard cuts. -Every sub-comp file in `compositions/` is wrapped in a `