/proof-demo
Same engine as /proof (proofkit.mjs, which lives in the sibling proof skill: ${CLAUDE_SKILL_DIR}/../proof/scripts/proofkit.mjs, called <kit> below), run with --demo. In demo mode:
- Playwright's own screencast records the page with a 1600×900 layout captured at 2× (3200×1800 frames, Chrome's real scale factor forced), so all page animations, hovers and transitions are captured as they really render and zoomed-in shots stay sharp. Screenshots in demo mode are 2× too.
- A cursor is injected into the page. Each helper moves the real mouse along a slightly curved path with ease-in-out timing, so the cursor glides, hover states fire on the way, and the click shows a ripple.
- Typing is per character at human speed; there are pauses after every action.
- After recording, ffmpeg adds a camera that zooms into each action and pans between nearby actions (smooth in and out), then frames the page in a window with a title bar and URL on a gradient, as
demo.mp4(1920×1080, H.264).
Steps
Run it end to end without asking the user anything: work out the story from the conversation and the diff. Only ask if the feature can't be reached (e.g. it needs credentials you can't find in .env, seeds or the README).
-
Pick the story. From the conversation (and
git diffif it's a repo), decide which feature(s) to show and the shortest flow that shows them off: 20–60 seconds, one chapter per feature, ending on the result. -
Get the app running (start the dev server in the background if nothing answers). Find the port in
package.json/the dev config. Check that the URL serves your app (e.g.curl -s <url> | grep <something from the app>): another process can hold the same port on IPv6, so iflocalhostreaches the wrong app, usehttp://127.0.0.1:<port>. Stop only the server you started when done. The first time, runnpm installin${CLAUDE_SKILL_DIR}/../proofif itsnode_modulesis missing.ffmpegmust be on PATH. -
Write the flow to
.proof/flows/<slug>.mjs(create the folder). The same file works with/proof, so if one already exists, reuse it.export const config = { url: 'http://localhost:3000/', title: 'Saved searches', // opening title card subtitle: 'Find it again in one click', // optional // label: 'app.acme.com', zoom: 1.5 (false to disable), overview: 2000 (ms, false to disable), viewport: { width: 1600, height: 900 } }; export default async ({ page, click, type, press, hover, scroll, shot, chapter, overview, pause }) => { await chapter('Save a search'); await type('input[name=q]', 'red shoes'); await click(page.getByRole('button', { name: 'Save search' })); await page.getByText('Search saved').waitFor(); await pause(1200); // let the viewer read the result };Helpers (
target= selector string or Playwright locator):click(target),type(target, text)(replaces the field's value, typing per character),press(key),hover(target),scroll(target | pixels),shot(name),chapter(title, description?),overview(ms = 2000)(zoom out and hold the full screen),pause(ms = 1000).pageis a normal Playwright page.How the camera behaves, so you can direct it:
- It zooms in (default 1.5×) as the cursor starts moving to a target, and frames a point between the target and the page centre so the context stays visible.
- Actions less than 1.6 s apart stay zoomed and the camera pans between them. A longer gap, a
scroll()or achapter()zooms back out, and cards always show un-zoomed. - Screen changes get a wide shot. After every
click()/press(), the kit checks whether the screen changed drastically: the URL changed (including SPA and hash routes), a dialog opened, or less than 60% of the visible text is still the same. If so, the camera zooms out and holds the whole new screen for 2 s (config.overview) before the next action. For a change it can't detect (a chart redraw, a canvas, an image swap), calloverview()yourself after the action. - Typing follows the caret.
type()aims at where the text starts, moves the pointer just below the field so it doesn't cover the text, and the camera tracks the caret as it moves (long inputs, multi-line textareas, contenteditable). hover()doesn't hide text. On short, text-like elements the arrow's tip sits on the bottom edge, so the arrow hangs below the text while the hover state stays on.- To keep the camera on a result,
hover()it right after the action. For narrow layouts (a 500 px column) setzoom: 2; for wide dashboards setzoom: 1.3orfalse.
Rules for a good demo:
- Every interaction goes through a helper (
click,type,press,hover,scroll). Rawpage.click()works but the cursor jumps instead of gliding and the camera does not follow it. - Use
hover()on things worth pointing at before clicking them, andpause()after results appear. - Use
chapter(title, description)between features; it shows a blurred title card and resets the zoom. - Wait for real results (
waitFor) rather than fixed sleeps around network calls, so the pacing comes from the helpers, not from loading. - Skip login and setup screens that add nothing: authenticate before the story starts, or start on a URL past it.
-
Run it from the project root (takes about the flow's length plus ~15 s of rendering):
node "${CLAUDE_SKILL_DIR}/../proof/scripts/proofkit.mjs" .proof/flows/<slug>.mjs --demo --out .proof/<slug>-demoIt prints JSON. If
"ok"is false the flow threw: the demo is not rendered (onlyraw.webmis kept), so readerrorand fix the flow. Don't pipe the output throughtailand miss it. -
Watch it before you hand it over. Read the
sheetfrom the JSON (.proof/<slug>-demo/sheet.png, 48 frames spread over the whole video). Check the cursor lands on the right elements, the zoom keeps the action in frame, and the result is visible at the end. Tune the flow (pauses, hovers,zoom) and re-run if not. -
Wrap up. If this is a git repo and
.gitignoredoesn't cover.proof/, add it. Report the path todemo.mp4(and the screenshots if you took any), with one line on what the video shows. If you have a tool to send files to the user (e.g. SendUserFile), send the video.