Communitygithub.com

josueh04/product-video-skills

確保 HyperFrames 平行渲染工作線程不會遺失、閃爍或抖動元素的動畫規則,以及一個靜態檢查工具(lint_motion.py),能在影片模板耗費渲染成本前找出違規處。

product-video-skills 是什麼?

這組技能專門解決 HyperFrames 0.8.x 平行渲染引擎(三個工作線程各取每三幀)因「seek 而非播放」導致的元素閃爍、遺失或抖動問題。它提供一系列硬性動畫規則(例如 fromTo 中 fromVars 的每個屬性也必須出現在 toVars、禁止使用 display/visibility 動畫、禁止依賴 Date / Math.random / setTimeout 等),以及一個靜態檢查工具 lint_motion.py,能在編輯後或渲染前掃描 index.html、src/*.tpl 及同目錄的 .js 檔案,找出違反規則之處。此技能支援 Claude Code、Cursor 等開發環境,特別適合處理 HyperFrames 組合中的 GSAP 動畫(時間軸、游標、滾動、打字效果、彈出視窗等),以及修復 scan_render.py 或 qa.py 回報的「WORKER PATTERN」錯誤。使用方式包括在編輯時間軸後立即執行 lint,以及透過 hyperframes snapshot 指令對比不同 seek 路徑下的幀截圖來重現疑似錯誤。

相容平台✓Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/josueh04/product-video-skills/tree/HEAD/skills/seek-safe-motion

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

安全尋幀動畫

HyperFrames 並非播放時間軸,而是「尋幀」:對於每一幀,渲染器將時間軸設為該幀的時間並捕獲頁面。使用 HyperFrames 0.8.x 時,它會透過三個平行工作線程進行,每個線程負責每三幀中的一幀,且每次尋幀會先回退 1 毫秒再向前移動以穩定狀態。因此,每一幀必須是其時間的純函數。任何依賴先前渲染內容、系統時鐘或隨機性的行為,都會在各工作線程中產生不同結果,導致元素在每三幀中遺失一次。

該錯誤在 Studio 預覽(按順序播放)和單張快照中不可見。在實際生產環境中,這是唯一能送到審查員面前的缺陷:開場標題在前七秒「抖動並閃爍」。

優先執行 lint

PVS_HOME="$(cd "$(cd "${CLAUDE_SKILL_DIR}" && pwd -P)/../.." && pwd)"
"$PVS_HOME/bin/pvs-py" "$PVS_HOME/skills/seek-safe-motion/scripts/lint_motion.py" <video_dir>/video

它會讀取 index.html、src/*.tpl 以及與之相鄰的 *.js(僅內聯腳本),輸出 file:line: severity RULE: why 加上修復建議,並在發現任何錯誤時以狀態碼 1 退出(--strict 會將警告也視為失敗,--json 供工具使用)。在每次編輯時間軸後及每次渲染前執行。此工具為靜態分析:無法看到執行時期計算的變數(會將其標記為「無法檢查」)或兩個重疊的補間動畫。這些情況仍需您自行檢查,搭配下方的重現方法。qa.py(render-qa)也會執行此 lint,並在發現錯誤時使報告失敗。

規則及其存在原因

  1. fromTo 的 fromVars 中每個鍵也必須出現在 toVars 中(SS001,錯誤)。當工作線程的幀正好落在補間動畫的起始點時,1 毫秒的回退會將補間狀態還原到開始前,而僅存在於 fromVars 中的鍵將永遠不會再被寫入。標題補間動畫為 fromTo(sel, {yPercent: 110, opacity: 1}, {yPercent: 0}):opacity: 1 只存在於 fromVars,因此一個工作線程會讓標題在該補間動畫期間保持不透明度 0。請將 {yPercent: 110, opacity: 1} 改為 {yPercent: 0, opacity: 1},或使用 tl.set() 後接 tl.to()。to() 內部的 startAt 也適用相同規則(SS002)。
  2. 在時間點 0 之後的每個 fromTo 上設定 immediateRender: false(SS003,警告)。否則補間動畫在時間軸建立時就會寫入其起始值,覆蓋先前補間動畫設定的內容,導致從時間軸中間開始尋幀時狀態錯誤。
  3. 優先使用 fromTo 而非 from(SS004,警告)。from() 的結束狀態取決於元素在建構時的狀態;一旦先前的補間動畫觸及該元素,不同工作線程的結果就會不一致。
  4. 永遠不要動畫 display 或 visibility(SS005,錯誤)。這兩個屬性無法進行插值;它們會在補間動畫的任意時間點突然切換。請改用零持續時間的 tl.set() 在明確時間點進行切換,並使用 opacity 或 autoAlpha 來實現淡入淡出效果。
  5. 禁止使用時鐘、隨機性和計時器(SS006,錯誤):不可使用 Date、performance.now()、Math.random()、setTimeout、setInterval 或 requestAnimationFrame 來控制任何可見元素。打字抖動或波形效果應使用帶種子的生成器;螢幕上顯示的呼叫計時器應透過時間軸的 onUpdate 回調中的 tl.time() 計算。
  6. 一個暫停的時間軸,已註冊,永不播放(SS007、SS011、SS012)。使用 gsap.timeline({ paused: true }) 建立時間軸,完全構建完成(如果位置依賴文字度量,則在 document.fonts.ready 內部構建),然後才賦值 window.__timelines["<composition id>"] = tl。在構建完成前註冊空時間軸會導致空白影片;tl.play() 會與渲染器的尋幀操作衝突。
  7. 滾動效果使用帶有明確起始和結束的 fromTo,以便每個工作線程計算相同的偏移量,且偏移量應限制在實際內容範圍內,避免線條或圖示停在邊緣處。
  8. 永遠不要在同一元素上同時有兩個補間動畫作用於相同屬性。 游標重置若落在下一次移動之內,會導致尋幀後指針位置錯誤。此規則無法透過 lint 檢查:請檢查建構時間表。
  9. 動畫變形屬性,而非佈局屬性(SS009,警告):使用 x、y、scale、clip-path 而非 left、top、width、margin。佈局補間動畫會使每一幀發生回流,且 hyperframes check 會將其標記為 gsap_non_transform_motion。若實際產品控制項(如側邊欄展開)需要短暫的寬度變化,在能重現產品行為的前提下可接受。
  10. 永遠不要對 .clip 元素進行補間動畫(SS010,錯誤)。HyperFrames 透過 data-start 和 data-duration 控制剪輯的可見性;請改為對剪輯內部的包裝元素進行動畫。
  11. 有限次數的重複(SS008,警告)。repeat: -1 僅允許在有限的根 data-duration 下使用;請使用 Math.max(0, Math.floor(span / period) - 1) 計算重複次數。
  12. 在時間點 0 明確設定所有初始狀態。 若輔助函數執行 gsap.set(sel, vars),也應執行 tl.set(sel, vars, 0),這樣在尋幀回到 0 時才能恢復第一幀,而不是保持工作線程渲染的最後一個狀態。

渲染前重現疑似錯誤

lint 找到的是模式;快照才能證明像素。對於一個從 t0 開始的可疑補間動畫:

npx --yes hyperframes@<pinned> snapshot . --at <t0 + 0.3> --no-end --describe false -o a
npx --yes hyperframes@<pinned> snapshot . --at <t0>,<t0 + 0.3> --no-end --describe false -o b

從 t0 + 0.3 開始的幀在 a 和 b 中必須完全相同。如果不同,表示通過補間動畫起始點的尋幀操作改變了狀態。若要精確重現某個工作線程的行為,請依序對 0、3、6、... 等幀拍攝快照,直到超過補間動畫範圍。透過逐步縮小時間範圍來進行二分法,直到只剩一個補間動畫。渲染後,scan_render.py(render-qa)會將相同的錯誤回報為 WORKER PATTERN 執行結果:離群的幀都共享同一個幀索引模 3 的餘數。

參考資料

  • references/patterns.md:每個規則的前後對比程式碼、保持範本安全的輔助函數(lineIn、init、打字、滾動、游標點擊),以及 lint 能與不能檢查的內容。在編寫新的輔助函數或修正 lint 發現的問題時,請閱讀此文件。

Individual skills in this repo

This repo contains 14 individual skills — each has its own dedicated page.

josueh04/product-video-skills

Extract, once per product, everything every video of it reuses and write it to kit/ and product.yaml (design tokens, font subsets as woff2, icon subsets as SVG from the product's own icon packages, logos in light, dark and app-tile variants from the repo, a fictional cast proposed once for veto and then frozen, the canonical-names map, pronunciations, banned terms and the read-only tool list). Use it when a product is set up or its kit is missing or incomplete, when a video needs an icon, font or logo that is not in kit/ yet, when someone asks for demo names, fake customers, phone numbers or emails, when a brand word is mispronounced or an old product name shows up, and when checking that demo data is fictional.

josueh04/product-video-skills

Interview the user about a product, then create products/<slug>/ with its own git history, a filled product.yaml and linked skills, fetch its sources and build its kit. Run only when the user types /product-new.

josueh04/product-video-skills

Back every sentence of a video's narration (audio/lines.tsv) and every screen it shows with a citation into the pinned source code (role/path:line@sha) or a docs URL, mark what is visible in the UI versus backend-only, flag restricted or unreleased features, and cut or rewrite anything unbacked; writes the video's TRUTH.md and checks it with truth_check.py. Use it whenever a script or narration is drafted or edited, before voice is generated, before a build, when someone asks "can we say this?", "is this true?", "does the product really do X?", when a reviewer asks for a feature or a claim the product may not support, and when a source document (pitch deck, PRD, marketing page) makes claims the video wants to repeat.

josueh04/product-video-skills

Check a rendered product video before anyone else sees it: worker-pattern flicker, black frames, loudness and true peak, clipping, clicks at clip edges, overlapping narration, speech to text against the script, banned terms and legacy names, camera zoom, contact sheets, frame strips at transitions and parity against the approved version; then write qa/REPORT.json, the only thing deliver.py accepts. Use it after every HyperFrames render, whenever someone asks "is the render clean", "QA this", "check the video", "check the audio", "why does it flicker", "there is a click", "compare v3 with v2", "did the approved part change", or before showing, sending, uploading or delivering any MP4, even when the request does not say QA. Also use it to triage a defect a reviewer reported in a render.

josueh04/product-video-skills

Write a product video's narration and turn it into voice clips with word timings, pronunciation fixes, sound effects and even loudness. The script becomes a table of moments and then audio/lines.tsv (one clip per sentence, with role and speed columns); tts.py voices it with ElevenLabs or the free macOS say voice, maps brand respellings back to the on-screen spelling, normalizes every clip and writes audio/timings.json for the composer; make_sfx.py builds typing tracks from real keystrokes and places recorded click and pop sounds. Use it whenever a video needs a script, narration, voice-over, lines.tsv, timings.json, TTS, a new take, a voice or casting choice, a pronunciation fix ("it says the name wrong"), a changed sentence, a tone note ("too hype", "sounds cut off"), audio levels, a click at the end of a clip, typing or click sounds, or when the build stage asks for the voice. Also use it for silent loops, which still need a moment table and SFX.

josueh04/product-video-skills

Pin a product's source code (read-only exports in sources/ plus sources.lock), confirm that the pinned commit is what runs in production, and map every screen of a video brief to its route, components, i18n strings and state, written to the video's SOURCES.md. Use it whenever a video needs to know where a screen lives in the code, when sources/ is missing or stale, before ui-spec-from-code or product-truth start on a video, after the product's frontend changed ("what changed", "which videos are affected", "refresh the sources", "is this checkout current", "which commit is in prod"), and when there is no code and you need an inventory of the no-code references (recordings, recovered captures, docs) a screen can be rebuilt from.

josueh04/product-video-skills

Compose a narrated product demo in HyperFrames: the stage (the product UI rebuilt at its real viewport and scaled to 1080p, camera, rack focus with veil, chapter titles, cursor and clicks, typing, streaming text, pop-ups, toasts, scrolls, end screen and lockup) and the build.py that anchors every beat to a word of the narration. Use it whenever you write or edit a video's video/build.py, src/template.tpl or src/app.css, place a beat on a word, add a chapter, a click, a pop-up or a push-in, frame a screen, build the end screen or lockup, snapshot setup beats, or render a draft or delivery MP4 of a product video in this workbench. Also use it when someone says "the cursor is off", "too zoomed in", "too fast", "it feels chaotic", "the title flashes", "sync the UI to the voice", or asks for a walkthrough, demo or pitch video of a UI.

josueh04/product-video-skills

Gather pixel references for UI that the code cannot show, or to check a rebuild against the real thing, using frames and timed OCR text from screen recordings, captures recovered from past Claude Code session transcripts, a local instance of the app built like production, and web research for third-party apps, plus side-by-side parity images and contact sheets. Use it whenever someone hands over a screen recording (.mov or .mp4) of the product, when a screen has no usable source code (a stale checkout, another company's UI such as a sign-in page, calendar or CRM, runtime output from a backend not in the repos), when asked "what does it really look like", "match the recording", "how long does that animation take in the app", "compare our render to the real app", or when screenshots from an earlier session might already exist. Never uses the reviewer's personal browser.

josueh04/product-video-skills

Turn a product's real frontend code into 1:1 rebuild specs for a video, one read-only subagent per screen, each returning static HTML, CSS with every variable resolved to its literal value and cited (role/path:line@sha), every state, transitions with exact durations and easings, icons from the code's own icon sets, and the exact i18n strings; plus resolve_tokens.py to write the product's design tokens to kit/tokens.css. Use it whenever a screen of the product has to appear in a video, when writing or fixing video/src/app.css or the template markup, when someone asks for exact sizes, colors, fonts, paddings, animations or icons of a screen, when a rebuilt screen "looks off" next to the real app, and when the design tokens or theme of a product need extracting. Framework adapters cover Angular with PrimeNG (proven), React, Vue, Tailwind and plain HTML (unproven).

josueh04/product-video-skills

Say where this session stands in the Product Video Skills workbench (setup state, which product and video the current folder belongs to, the stage of every video) and the exact next command to type. Also answers "how do I..." questions about the workbench from its docs.

josueh04/product-video-skills

Coordinate the build of one or more signed videos of the current product with subagents (source recon, product truth, UI specs, voice, one builder per video), re-run QA itself, then deliver. A light coordinator that never builds itself. Run only when the user types /video-build.

josueh04/product-video-skills

Start a new video of the current product - create videos/<video>/, write BRIEF.md, the feature coverage matrix (COVERAGE.md) and the claims sheet (CLAIMS.md), propose chapters, then stop for the reviewer's sign-off. Never builds. Run only when the user types /video-new.

josueh04/product-video-skills

Turn a batch of reviewer feedback on the product's videos into one table per video, fix every video that got notes in parallel (one subagent each) while keeping approved parts, re-run QA and parity, bump versions and deliver. Run only when the user types /video-review.

josueh04/product-video-skills

Check this machine and install the pinned video toolchain of the Product Video Skills workbench (HyperFrames CLI, its rendering Chrome and its agent skills from the same release, the Python environment, the speech model for QA), then run the self-check. Safe to run again. `/video-setup check` only reports.

相關技能