Communitygithub.com

flow-capture

Base skill for recording a web UI flow with Playwright and rendering it as a calm, honest demo video. The real screencast is retimed so actions play at real speed and waits shrink; zoom, cursor, captions and provenance are drawn on top. Also renders before/after comparisons side by side, synced per step, and a screenshot summary. Use it directly for "record this flow" or "make a video of this". For PR proof use flow-proof; for prototype walkthroughs use flow-mockup.

What is flow-capture?

flow-capture is a Cursor agent skill that base skill for recording a web UI flow with Playwright and rendering it as a calm, honest demo video. The real screencast is retimed so actions play at real speed and waits shrink; zoom, cursor, captions and provenance are drawn on top. Also renders before/after comparisons side by side, synced per step, and a screenshot summary. Use it directly for "record this flow" or "make a video of this". For PR proof use flow-proof; for prototype walkthroughs use flow-mockup.

Works with~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/M-Subhan1/skills/tree/HEAD/flow-capture

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Flow capture

This skill covers the mechanics: how to record, how to render, and how to make a recording good. When a recording counts as proof, and how to label mockups, is up to the skill that uses it (flow-proof, flow-mockup, or a project skill).

Files:

  • capture.ts: the Playwright helper. Copy it into the project's e2e folder.
  • stitch.py: the renderer. Run it with uv run, which brings its own Pillow. It also needs ffmpeg.

Requires Playwright 1.59 or later, for page.screencast, and Chromium.

Record

import { createFlowCapture, FLOW_CAPTURE_CONTEXT_OPTIONS, FLOW_CAPTURE_TEST_OPTIONS } from './capture';

test.skip(!process.env.FLOW_OUT, 'Set FLOW_OUT to record this flow');
test.use(FLOW_CAPTURE_TEST_OPTIONS);

test('invite a teammate', async ({ browser }) => {
  const context = await browser.newContext({ storageState, ...FLOW_CAPTURE_CONTEXT_OPTIONS });
  const page = await context.newPage();
  const flow = await createFlowCapture(page, { outDir: process.env.FLOW_OUT, title: 'Invite a teammate' });

  await page.goto('/team');
  await flow.verify('Team page', () => expect(page.getByRole('table')).toBeVisible());
  await flow.click('Open the invite dialog', page.getByRole('button', { name: 'Invite' }));
  await flow.type('Enter their email', page.getByLabel('Email'), '[email protected]');
  await flow.press('Send with Enter', 'Enter');
  await flow.verify('Sam is listed as invited', () => expect(page.getByText('[email protected]')).toBeVisible(), page.getByRole('table'));
  await flow.finish();
  await context.close();
});
MethodRecordsShown as
click(label, target, perform?)a click; pass perform for a custom click, such as a retrythe cursor travels, presses, and a ripple spreads
hover(label, target)a hoverthe cursor travels; no ripple
type(label, target, text)a click, then typing at 35 ms per keya click, then the text appearing at real speed
press(label, key)a keyboard pressno cursor motion; the camera stays put
scrollTo(label, target)a smooth scrollthe real scroll, in overview
act(label, action, target?)anything elsethe cursor travels if there is a target; no click is drawn
shot(label, target?)a stilla hold, focused on the target if given
verify(label, assertion, target?)runs the assertion, then a stilla hold, with a check mark in the caption

The recording saves:

  • a 2× screencast of the whole run, as JPEG frames with timestamps
  • for each step: its kind, the target's position, the start and end times of the action, and before/after screenshots
  • provenance: time, origin, browser version, and for the directory the spec runs from, the git branch (or "detached"), commit, whether there are uncommitted changes, and the number of untracked files
  • every document, fetch or XHR response that no server answered, meaning it was fulfilled by page.route or came from cache. WebSockets, EventSource, scripts and images aren't checked.

Each capture first deletes what an earlier capture left in the same folder (frames/, video/, manifest.json, summary.md, and the flow-* and compare-* videos and GIFs), and writes the manifest only once the flow passes. A failed run therefore leaves nothing a renderer could pass off as a result.

Render

uv run stitch.py <capture> [--mode video|slides] [--compare <capture> --labels Before,After] [--motion subtle|full|none]
  [--zoom X] [--badge TEXT] [--no-header] [--no-captions] [--no-cursor] [--theme teal|blue|dark|light] [--bg <image>]
  [--width N] [--fps 30] [--gif] [--preview] [--out <file>]
  • --mode video (the default when frames exist) writes flow-video.mp4: the real recording from the first step to the last, retimed. Page loads before the first step aren't shown, so start with a verify or shot.
    • Each action plays at real speed for its first 1.2 s; typing plays in full, up to 4 s. Everything after that plays at 6×.
    • Stretches with no repaint longer than 0.2 s shrink to 0.08 s. Waits mostly disappear, but nothing is reordered or cut.
    • While sped up, each output frame averages up to 12 of the source frames it covers, so a state that flashed for 50 ms still shows as a faint flash. A small "Sped up" tag shows under the pane.
  • --mode slides writes flow-slides.mp4: crossfades between screenshots. The header always says "Stitched from screenshots", and --no-header doesn't remove it.
  • --compare DIR writes compare-<mode>.mp4: two captures of the same spec side by side. On the faster side, both the wait before each step and the step itself are padded, so both panes start and finish every step together. Each pane has its own caption and its own commit, and the renderer prints a note when the steps' labels differ.
  • --badge TEXT pins a label in the header, for example Mockup.
  • --preview renders at 960 px and 24 fps without motion blur, for quick checks.
  • --gif also writes a GIF, shrinking the width until it fits GitHub's 10 MB limit.
  • summary.md lists each step with its final screenshot, marks verified steps with ✓, and lists any responses no server answered.

Motion

The defaults follow one rule: motion exists only to show where to look or what happened, and should never pull attention from the app.

MotionPurposeBehaviour
Camera (subtle, the default)Show where the action isZooms 1.5× on small targets. It stays still while the next target is already well inside the view, so a menu sequence doesn't make it hop. Zooming in is deliberate and pulling back is quicker. There is no overshoot.
Camera (full)TutorialsZooms 1.8× and re-centres on every target
Camera (none)Reduced motionNever moves; the cursor and captions still show
CursorShow what was acted onTravels along a slight curve. The approach takes 0.45–0.9 s depending on distance (plus 0.25 s on long pans), and the cursor arrives with a quarter of it to spare. It is hidden until the first pointer action or targeted still, and while scrolling.
Press and rippleConfirm a real click90 ms dip to 0.88×, 160 ms release, one ring, no bounce. Only click and type get one.
CaptionSay what's happeningFades out in 120 ms and the next one rises in over 220 ms, both ease-out
IntroStart the videoThe frame fades in from 0.97× over 400 ms, ease-out
Motion blurHide stepping on fast movesOnly on frames that move more than 6 px
Long pansKeep the viewer orientedPans longer than 40% of the screen pull back to an overview mid-flight
Page changeShow the new pageThe camera pulls back after an action that changes the URL path; query-string changes such as filters don't count

Recording rules

These make a recording worth watching, and keep it truthful whoever ends up using it.

  1. One flow, one story: 4–12 steps, and under about 30 s once rendered. Split anything longer.
  2. Start on a settled page. The first step is a verify or shot after the page loads.
  3. Labels say what the user does, in under 6 words ("Open the filter menu"). Labels for result steps state the outcome ("Only archived projects remain").
  4. Back every claim with a verify. If a caption claims a result, it comes from a verify whose assertion passed. A failed assertion fails the test, so no video exists that claims something false.
  5. Act through locators, the way a user would. Don't change the page with page.evaluate, dispatchEvent or element.click() in the page context, because the video would show a result with no visible cause.
  6. Make typing visible. Use flow.type, not fill.
  7. Leave pacing to the renderer. Don't add waitForTimeout to slow the video down; the retimer controls pacing.
  8. Keep one viewport. Use the 1440×900 @2× from FLOW_CAPTURE_CONTEXT_OPTIONS and don't resize mid-flow. Build the context from browser, because fixtures that create their own context drop these options.
  9. Keep tracing off. FLOW_CAPTURE_TEST_OPTIONS turns it off: tracing runs its own 800 px screencast, and the recording would share it.
  10. Use test data only. Never record real people's data, secrets or tokens. Typed text and URLs end up in the video.
  11. Make transient states visible honestly. To show a loading state, hold the real response with page.route(..., route => route.continue()) after a short pause, not fulfill. That way the response still comes from the server.
  12. Watch it before sharing. Render with --preview, look at it, then do the full render.

Limits:

  • Only the page passed to createFlowCapture is recorded. A new tab needs its own capture.
  • Dev-only overlays from Next.js are hidden. Other frameworks' overlays may need their own CSS.

Individual skills in this repo

This repo contains 1 individual skill — each has its own dedicated page.

Related Skills