Video Proof
Record video demos of implemented features using Playwright's built-in screen recording. After a coding task completes, this skill starts your app, runs a scripted walkthrough, and captures video + screenshots + console logs as proof artifacts.
Works with any stack — Next.js, Vite, Django, Rails, Go, Docker, static files, or an already-running server. You provide the start command; the skill handles the rest.
Prerequisites
Run once per machine:
CODEBLOCK0
Installs Playwright (Chromium), ffmpeg, and the yaml npm package.
Quick Start
Option A: YAML Proof Spec (recommended)
Create a proof-spec.yaml:
CODEBLOCK1
Run it:
CODEBLOCK2
Option B: Inline CLI (simple cases)
CODEBLOCK3
Option C: Already-running server (no start_command)
Omit start_command — the script skips server startup and goes straight to recording:
CODEBLOCK4
Artifacts Produced
CODEBLOCK5
Exit code: 0 if all steps pass, 1 if any step fails. On failure, a FAILURE.png full-page screenshot is captured automatically.
Start Command Examples
The start_command field accepts any shell command. Examples:
| Stack | startcommand | startport |
|---|
| Next.js | INLINECODE7 | 3000 |
| Vite / React |
npm run dev | 5173 |
| Django |
python manage.py runserver 0.0.0.0:8000 | 8000 |
| Flask |
flask run --port 5000 | 5000 |
| Rails |
bin/rails server -p 3000 | 3000 |
| Go |
go run . -addr :8080 | 8080 |
| Rust (Actix/Axum) |
cargo run | 8080 |
| Docker Compose |
docker compose up | 3000 |
| Static files |
python3 -m http.server 8080 | 8080 |
| Already running |
(omit field) | — |
Step Actions
| Action | Value | Description |
|---|
| INLINECODE16 | INLINECODE17 or full URL | Navigate to a page |
| INLINECODE18 |
Playwright selector | Click an element (
text=Submit,
#btn,
.class) |
|
fill |
{selector, value} | Clear and fill an input field |
|
type |
{selector, text} | Type into an element keystroke by keystroke |
|
wait | milliseconds | Pause (let animations/data load) |
|
screenshot |
"name" | Save
screenshots/<name>.png |
|
scroll |
"down" or
"up" | Scroll 500px in direction |
|
assert_visible | Playwright selector | Fail the proof if element isn't visible |
|
assert_url | string | Fail if current URL doesn't contain string |
API-Only Proof (No Browser)
For backend/API changes with no UI, use api-proof.js:
CODEBLOCK6
CODEBLOCK7
Produces api-proof.md and api-results.json instead of video.
Integration with Coding Agents
Append to any coding task prompt:
CODEBLOCK8
The agent writes the proof spec based on what it built, runs it, and the video becomes part of the deliverable.
Spec Reference
See references/proof-spec.md for the full YAML schema, API proof schema, and a copy-paste PRD template.
Tips
- - Use
assert_visible to make proofs fail when the feature doesn't work — video of a broken page isn't useful proof - Keep specs focused on the specific feature, not the whole app
- INLINECODE40 steps between actions let data load and animations settle — 1-2s is usually enough
- The video captures real load times — doubles as a basic performance check
- If ffmpeg isn't available, the script still produces
.webm (just skips mp4 conversion)
视频验证
使用 Playwright 内置屏幕录制功能录制已实现功能的视频演示。编码任务完成后,此技能会启动您的应用程序,运行脚本化演示,并捕获视频 + 截图 + 控制台日志作为验证产物。
适用于任何技术栈 — Next.js、Vite、Django、Rails、Go、Docker、静态文件或已运行的服务器。您提供启动命令,技能处理其余部分。
前置条件
每台机器运行一次:
bash
bash scripts/setup.sh
安装 Playwright(Chromium)、ffmpeg 和 yaml npm 包。
快速开始
选项 A:YAML 验证规范(推荐)
创建 proof-spec.yaml:
yaml
proof:
start_command: npm run dev # 启动应用程序的任何 shell 命令
start_port: 3000 # 开始录制前轮询的端口
base_url: http://localhost:3000
steps:
- goto: /dashboard
- wait: 2000
- screenshot: dashboard-loaded
- click: text=Create New
- wait: 1000
- assert_visible: text=New Item
- screenshot: item-created
运行它:
bash
node scripts/record-proof.js --spec proof-spec.yaml --output ./proof-artifacts
选项 B:内联 CLI(简单情况)
bash
node scripts/record-proof.js \
--start python3 -m http.server 8080 \
--port 8080 \
--url http://localhost:8080 \
--goto / \
--screenshot home \
--output ./proof-artifacts
选项 C:已运行的服务器(无 start_command)
省略 start_command — 脚本跳过服务器启动,直接开始录制:
yaml
proof:
base_url: https://staging.myapp.com
steps:
- goto: /login
- screenshot: login-page
生成的产物
proof-artifacts/
├── video.webm # 完整屏幕录制
├── video.mp4 # 聊天友好版本(通过 ffmpeg 自动转换)
├── screenshots/ # 步骤中的命名截图
│ ├── dashboard-loaded.png
│ └── item-created.png
├── console.log # 浏览器控制台输出(错误、警告、日志)
└── proof-summary.md # Markdown 报告,包含每个步骤的通过/失败状态
退出代码:所有步骤通过为 0,任何步骤失败为 1。失败时,会自动捕获 FAILURE.png 全页截图。
启动命令示例
start_command 字段接受任何 shell 命令。示例:
| 技术栈 | startcommand | startport |
|---|
| Next.js | npm run dev | 3000 |
| Vite / React |
npm run dev | 5173 |
| Django | python manage.py runserver 0.0.0.0:8000 | 8000 |
| Flask | flask run --port 5000 | 5000 |
| Rails | bin/rails server -p 3000 | 3000 |
| Go | go run . -addr :8080 | 8080 |
| Rust (Actix/Axum) | cargo run | 8080 |
| Docker Compose | docker compose up | 3000 |
| 静态文件 | python3 -m http.server 8080 | 8080 |
| 已运行 |
(省略字段) | — |
步骤操作
| 操作 | 值 | 描述 |
|---|
| goto | /path 或完整 URL | 导航到页面 |
| click |
Playwright 选择器 | 点击元素(text=Submit、#btn、.class) |
| fill | {selector, value} | 清空并填充输入字段 |
| type | {selector, text} | 逐键输入到元素中 |
| wait | 毫秒 | 暂停(让动画/数据加载) |
| screenshot | name | 保存 screenshots/
.png |
| scroll | down 或 up | 向指定方向滚动 500px |
| assert_visible | Playwright 选择器 | 如果元素不可见则验证失败 |
| assert_url | 字符串 | 如果当前 URL 不包含字符串则失败 |
仅 API 验证(无浏览器)
对于没有 UI 的后端/API 更改,使用 api-proof.js:
bash
node scripts/api-proof.js --spec api-spec.yaml --output ./proof-artifacts
yaml
proof:
start_command: npm start
start_port: 3000
base_url: http://localhost:3000
requests:
- method: GET
path: /api/health
assert_status: 200
assertbodycontains: ok
- method: POST
path: /api/users
headers:
Content-Type: application/json
body: {name: test}
assert_status: 201
生成 api-proof.md 和 api-results.json 而不是视频。
与编码代理集成
附加到任何编码任务提示中:
完成实现后,创建一个 proof-spec.yaml,该文件:
- 1. 使用适合此项目的命令启动应用程序
- 导航到相关页面
- 根据需要点击/填充来演示功能
- 验证预期结果可见
- 拍摄前后截图
然后运行:
node /scripts/record-proof.js --spec proof-spec.yaml --output ./proof-artifacts
将 proof-artifacts/ 与您的更改一起提交。
代理根据其构建的内容编写验证规范,运行它,视频成为交付物的一部分。
规范参考
有关完整的 YAML 模式、API 验证模式和可复制粘贴的 PRD 模板,请参阅 references/proof-spec.md。
提示
- - 使用 assert_visible 使验证在功能不起作用时失败 — 损坏页面的视频不是有用的验证
- 保持规范专注于特定功能,而不是整个应用程序
- 操作之间的 wait 步骤让数据加载和动画完成 — 1-2 秒通常足够
- 视频捕获真实加载时间 — 兼作基本性能检查
- 如果 ffmpeg 不可用,脚本仍会生成 .webm(只是跳过 mp4 转换)