[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M70HAA3G38GY2J0PCH3RN2P6":3,"skill-same:01M70HAA3G38GY2J0PCH3RN2P6":78},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":28,"publishedAt":49,"linkOnly":50,"markdownContent":51,"markdownBody":52,"frontMatter":53,"refName":56,"commitSha":57,"skillDirectory":58,"forksCount":59,"repositoryHtmlUrl":60,"repositoryHomepageUrl":6,"ownerHtmlUrl":61,"ownerBlogUrl":6,"ownerDescription":62,"updatedAt":63,"install":64,"resources":77},"01M70HAA3G38GY2J0PCH3RN2P6","ui-demo",null,"Record polished UI demo videos using Playwright. Use when the user asks to create a demo, walkthrough, screen recording, or tutorial video of a web application. Produces WebM videos with visible cursor, natural pacing, and professional feel.","mdnaimul22\u002Fhuman-skills","mdnaimul22","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F64520358?v=4","01M70FH95MH2H796Q01TYSFZ03","Naimul","01M70FH96798CQR4YHA13F17GA",3,"MIT","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Fui-demo\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000016","图像与多媒体","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000032","设计师","PROFESSION","适用职业",[29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],"ui","demo","ui demo","user","videos","cursor","web","record","playwright","with","use","screen recording","tutorial","screen","create","when","walkthrough","professional","recording","Video","2026-11-10 10:12:30",false,"---\nname: ui-demo\ndescription: Record polished UI demo videos using Playwright. Use when the user asks to create a demo, walkthrough, screen recording, or tutorial video of a web application. Produces WebM videos with visible cursor, natural pacing, and professional feel.\nmetadata:\n  origin: ECC\n---\n\n# UI Demo Video Recorder\n\nRecord polished demo videos of web applications using Playwright's video recording with an injected cursor overlay, natural pacing, and storytelling flow.\n\n## When to Use\n\n- User asks for a \"demo video\", \"screen recording\", \"walkthrough\", or \"tutorial\"\n- User wants to showcase a feature or workflow visually\n- User needs a video for documentation, onboarding, or stakeholder presentation\n\n## Three-Phase Process\n\nEvery demo goes through three phases: **Discover -> Rehearse -> Record**. Never skip straight to recording.\n\n---\n\n## Phase 1: Discover\n\nBefore writing any script, explore the target pages to understand what is actually there.\n\n### Why\n\nYou cannot script what you have not seen. Fields may be `\u003Cinput>` not `\u003Ctextarea>`, dropdowns may be custom components not `\u003Cselect>`, and comment boxes may support `@mentions` or `#tags`. Assumptions break recordings silently.\n\n### How\n\nNavigate to each page in the flow and dump its interactive elements:\n\n```javascript\n\u002F\u002F Run this for each page in the flow BEFORE writing the demo script\nconst fields = await page.evaluate(() => {\n  const els = [];\n  document.querySelectorAll('input, select, textarea, button, [contenteditable]').forEach(el => {\n    if (el.offsetParent !== null) {\n      els.push({\n        tag: el.tagName,\n        type: el.type || '',\n        name: el.name || '',\n        placeholder: el.placeholder || '',\n        text: el.textContent?.trim().substring(0, 40) || '',\n        contentEditable: el.contentEditable === 'true',\n        role: el.getAttribute('role') || '',\n      });\n    }\n  });\n  return els;\n});\nconsole.log(JSON.stringify(fields, null, 2));\n```\n\n### What to look for\n\n- **Form fields**: Are they `\u003Cselect>`, `\u003Cinput>`, custom dropdowns, or comboboxes?\n- **Select options**: Dump option values AND text. Placeholders often have `value=\"0\"` or `value=\"\"` which looks non-empty. Use `Array.from(el.options).map(o => ({ value: o.value, text: o.text }))`. Skip options where text includes \"Select\" or value is `\"0\"`.\n- **Rich text**: Does the comment box support `@mentions`, `#tags`, markdown, or emoji? Check placeholder text.\n- **Required fields**: Which fields block form submission? Check `required`, `*` in labels, and try submitting empty to see validation errors.\n- **Dynamic content**: Do fields appear after other fields are filled?\n- **Button labels**: Exact text such as `\"Submit\"`, `\"Submit Request\"`, or `\"Send\"`.\n- **Table column headers**: For table-driven modals, map each `input[type=\"number\"]` to its column header instead of assuming all numeric inputs mean the same thing.\n\n### Output\n\nA field map for each page, used to write correct selectors in the script. Example:\n\n```text\n\u002Fpurchase-requests\u002Fnew:\n  - Budget Code: \u003Cselect> (first select on page, 4 options)\n  - Desired Delivery: \u003Cinput type=\"date\">\n  - Context: \u003Ctextarea> (not input)\n  - BOM table: inline-editable cells with span.cursor-pointer -> input pattern\n  - Submit: \u003Cbutton> text=\"Submit\"\n\n\u002Fpurchase-requests\u002FN (detail):\n  - Comment: \u003Cinput placeholder=\"Type a message...\"> supports @user and #PR tags\n  - Send: \u003Cbutton> text=\"Send\" (disabled until input has content)\n```\n\n---\n\n## Phase 2: Rehearse\n\nRun through all steps without recording. Verify every selector resolves.\n\n### Why\n\nSilent selector failures are the main reason demo recordings break. Rehearsal catches them before you waste a recording.\n\n### How\n\nUse `ensureVisible`, a wrapper that logs and fails loudly:\n\n```javascript\nasync function ensureVisible(page, locator, label) {\n  const el = typeof locator === 'string' ? page.locator(locator).first() : locator;\n  const visible = await el.isVisible().catch(() => false);\n  if (!visible) {\n    const msg = `REHEARSAL FAIL: \"${label}\" not found - selector: ${typeof locator === 'string' ? locator : '(locator object)'}`;\n    console.error(msg);\n    const found = await page.evaluate(() => {\n      return Array.from(document.querySelectorAll('button, input, select, textarea, a'))\n        .filter(el => el.offsetParent !== null)\n        .map(el => `${el.tagName}[${el.type || ''}] \"${el.textContent?.trim().substring(0, 30)}\"`)\n        .join('\\n  ');\n    });\n    console.error('  Visible elements:\\n  ' + found);\n    return false;\n  }\n  console.log(`REHEARSAL OK: \"${label}\"`);\n  return true;\n}\n```\n\n### Rehearsal script structure\n\n```javascript\nconst steps = [\n  { label: 'Login email field', selector: '#email' },\n  { label: 'Login submit', selector: 'button[type=\"submit\"]' },\n  { label: 'New Request button', selector: 'button:has-text(\"New Request\")' },\n  { label: 'Budget Code select', selector: 'select' },\n  { label: 'Delivery date', selector: 'input[type=\"date\"]:visible' },\n  { label: 'Description field', selector: 'textarea:visible' },\n  { label: 'Add Item button', selector: 'button:has-text(\"Add Item\")' },\n  { label: 'Submit button', selector: 'button:has-text(\"Submit\")' },\n];\n\nlet allOk = true;\nfor (const step of steps) {\n  if (!await ensureVisible(page, step.selector, step.label)) {\n    allOk = false;\n  }\n}\nif (!allOk) {\n  console.error('REHEARSAL FAILED - fix selectors before recording');\n  process.exit(1);\n}\nconsole.log('REHEARSAL PASSED - all selectors verified');\n```\n\n### When rehearsal fails\n\n1. Read the visible-element dump.\n2. Find the correct selector.\n3. Update the script.\n4. Re-run rehearsal.\n5. Only proceed when every selector passes.\n\n---\n\n## Phase 3: Record\n\nOnly after discovery and rehearsal pass should you create the recording.\n\n### Recording Principles\n\n#### 1. Storytelling Flow\n\nPlan the video as a story. Follow user-specified order, or use this default:\n\n- **Entry**: Login or navigate to the starting point\n- **Context**: Pan the surroundings so viewers orient themselves\n- **Action**: Perform the main workflow steps\n- **Variation**: Show a secondary feature such as settings, theme, or localization\n- **Result**: Show the outcome, confirmation, or new state\n\n#### 2. Pacing\n\n- After login: `4s`\n- After navigation: `3s`\n- After clicking a button: `2s`\n- Between major steps: `1.5-2s`\n- After the final action: `3s`\n- Typing delay: `25-40ms` per character\n\n#### 3. Cursor Overlay\n\nInject an SVG arrow cursor that follows mouse movements:\n\n```javascript\nasync function injectCursor(page) {\n  await page.evaluate(() => {\n    if (document.getElementById('demo-cursor')) return;\n    const cursor = document.createElement('div');\n    cursor.id = 'demo-cursor';\n    cursor.innerHTML = `\u003Csvg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\">\n      \u003Cpath d=\"M5 3L19 12L12 13L9 20L5 3Z\" fill=\"white\" stroke=\"black\" stroke-width=\"1.5\" stroke-linejoin=\"round\"\u002F>\n    \u003C\u002Fsvg>`;\n    cursor.style.cssText = `\n      position: fixed; z-index: 999999; pointer-events: none;\n      width: 24px; height: 24px;\n      transition: left 0.1s, top 0.1s;\n      filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.3));\n    `;\n    cursor.style.left = '0px';\n    cursor.style.top = '0px';\n    document.body.appendChild(cursor);\n    document.addEventListener('mousemove', (e) => {\n      cursor.style.left = e.clientX + 'px';\n      cursor.style.top = e.clientY + 'px';\n    });\n  });\n}\n```\n\nCall `injectCursor(page)` after every page navigation because the overlay is destroyed on navigate.\n\n#### 4. Mouse Movement\n\nNever teleport the cursor. Move to the target before clicking:\n\n```javascript\nasync function moveAndClick(page, locator, label, opts = {}) {\n  const { postClickDelay = 800, ...clickOpts } = opts;\n  const el = typeof locator === 'string' ? page.locator(locator).first() : locator;\n  const visible = await el.isVisible().catch(() => false);\n  if (!visible) {\n    console.error(`WARNING: moveAndClick skipped - \"${label}\" not visible`);\n    return false;\n  }\n  try {\n    await el.scrollIntoViewIfNeeded();\n    await page.waitForTimeout(300);\n    const box = await el.boundingBox();\n    if (box) {\n      await page.mouse.move(box.x + box.width \u002F 2, box.y + box.height \u002F 2, { steps: 10 });\n      await page.waitForTimeout(400);\n    }\n    await el.click(clickOpts);\n  } catch (e) {\n    console.error(`WARNING: moveAndClick failed on \"${label}\": ${e.message}`);\n    return false;\n  }\n  await page.waitForTimeout(postClickDelay);\n  return true;\n}\n```\n\nEvery call should include a descriptive `label` for debugging.\n\n#### 5. Typing\n\nType visibly, not instant-fill:\n\n```javascript\nasync function typeSlowly(page, locator, text, label, charDelay = 35) {\n  const el = typeof locator === 'string' ? page.locator(locator).first() : locator;\n  const visible = await el.isVisible().catch(() => false);\n  if (!visible) {\n    console.error(`WARNING: typeSlowly skipped - \"${label}\" not visible`);\n    return false;\n  }\n  await moveAndClick(page, el, label);\n  await el.fill('');\n  await el.pressSequentially(text, { delay: charDelay });\n  await page.waitForTimeout(500);\n  return true;\n}\n```\n\n#### 6. Scrolling\n\nUse smooth scroll instead of jumps:\n\n```javascript\nawait page.evaluate(() => window.scrollTo({ top: 400, behavior: 'smooth' }));\nawait page.waitForTimeout(1500);\n```\n\n#### 7. Dashboard Panning\n\nWhen showing a dashboard or overview page, move the cursor across key elements:\n\n```javascript\nasync function panElements(page, selector, maxCount = 6) {\n  const elements = await page.locator(selector).all();\n  for (let i = 0; i \u003C Math.min(elements.length, maxCount); i++) {\n    try {\n      const box = await elements[i].boundingBox();\n      if (box && box.y \u003C 700) {\n        await page.mouse.move(box.x + box.width \u002F 2, box.y + box.height \u002F 2, { steps: 8 });\n        await page.waitForTimeout(600);\n      }\n    } catch (e) {\n      console.warn(`WARNING: panElements skipped element ${i} (selector: \"${selector}\"): ${e.message}`);\n    }\n  }\n}\n```\n\n#### 8. Subtitles\n\nInject a subtitle bar at the bottom of the viewport:\n\n```javascript\nasync function injectSubtitleBar(page) {\n  await page.evaluate(() => {\n    if (document.getElementById('demo-subtitle')) return;\n    const bar = document.createElement('div');\n    bar.id = 'demo-subtitle';\n    bar.style.cssText = `\n      position: fixed; bottom: 0; left: 0; right: 0; z-index: 999998;\n      text-align: center; padding: 12px 24px;\n      background: rgba(0, 0, 0, 0.75);\n      color: white; font-family: -apple-system, \"Segoe UI\", sans-serif;\n      font-size: 16px; font-weight: 500; letter-spacing: 0.3px;\n      transition: opacity 0.3s;\n      pointer-events: none;\n    `;\n    bar.textContent = '';\n    bar.style.opacity = '0';\n    document.body.appendChild(bar);\n  });\n}\n\nasync function showSubtitle(page, text) {\n  await page.evaluate((t) => {\n    const bar = document.getElementById('demo-subtitle');\n    if (!bar) return;\n    if (t) {\n      bar.textContent = t;\n      bar.style.opacity = '1';\n    } else {\n      bar.style.opacity = '0';\n    }\n  }, text);\n  if (text) await page.waitForTimeout(800);\n}\n```\n\nCall `injectSubtitleBar(page)` alongside `injectCursor(page)` after every navigation.\n\nUsage pattern:\n\n```javascript\nawait showSubtitle(page, 'Step 1 - Logging in');\nawait showSubtitle(page, 'Step 2 - Dashboard overview');\nawait showSubtitle(page, '');\n```\n\nGuidelines:\n\n- Keep subtitle text short, ideally under 60 characters.\n- Use `Step N - Action` format for consistency.\n- Clear the subtitle during long pauses where the UI can speak for itself.\n\n## Script Template\n\n```javascript\n'use strict';\nconst { chromium } = require('playwright');\nconst path = require('path');\nconst fs = require('fs');\n\nconst BASE_URL = process.env.QA_BASE_URL || 'http:\u002F\u002Flocalhost:3000';\nconst VIDEO_DIR = path.join(__dirname, 'screenshots');\nconst OUTPUT_NAME = 'demo-FEATURE.webm';\nconst REHEARSAL = process.argv.includes('--rehearse');\n\n\u002F\u002F Paste injectCursor, injectSubtitleBar, showSubtitle, moveAndClick,\n\u002F\u002F typeSlowly, ensureVisible, and panElements here.\n\n(async () => {\n  const browser = await chromium.launch({ headless: true });\n\n  if (REHEARSAL) {\n    const context = await browser.newContext({ viewport: { width: 1280, height: 720 } });\n    const page = await context.newPage();\n    \u002F\u002F Navigate through the flow and run ensureVisible for each selector.\n    await browser.close();\n    return;\n  }\n\n  const context = await browser.newContext({\n    recordVideo: { dir: VIDEO_DIR, size: { width: 1280, height: 720 } },\n    viewport: { width: 1280, height: 720 }\n  });\n  const page = await context.newPage();\n\n  try {\n    await injectCursor(page);\n    await injectSubtitleBar(page);\n\n    await showSubtitle(page, 'Step 1 - Logging in');\n    \u002F\u002F login actions\n\n    await page.goto(`${BASE_URL}\u002Fdashboard`);\n    await injectCursor(page);\n    await injectSubtitleBar(page);\n    await showSubtitle(page, 'Step 2 - Dashboard overview');\n    \u002F\u002F pan dashboard\n\n    await showSubtitle(page, 'Step 3 - Main workflow');\n    \u002F\u002F action sequence\n\n    await showSubtitle(page, 'Step 4 - Result');\n    \u002F\u002F final reveal\n    await showSubtitle(page, '');\n  } catch (err) {\n    console.error('DEMO ERROR:', err.message);\n  } finally {\n    await context.close();\n    const video = page.video();\n    if (video) {\n      const src = await video.path();\n      const dest = path.join(VIDEO_DIR, OUTPUT_NAME);\n      try {\n        fs.copyFileSync(src, dest);\n        console.log('Video saved:', dest);\n      } catch (e) {\n        console.error('ERROR: Failed to copy video:', e.message);\n        console.error('  Source:', src);\n        console.error('  Destination:', dest);\n      }\n    }\n    await browser.close();\n  }\n})();\n```\n\nUsage:\n\n```bash\n# Phase 2: Rehearse\nnode demo-script.cjs --rehearse\n\n# Phase 3: Record\nnode demo-script.cjs\n```\n\n## Checklist Before Recording\n\n- [ ] Discovery phase completed\n- [ ] Rehearsal passes with all selectors OK\n- [ ] Headless mode enabled\n- [ ] Resolution set to `1280x720`\n- [ ] Cursor and subtitle overlays re-injected after every navigation\n- [ ] `showSubtitle(page, 'Step N - ...')` used at major transitions\n- [ ] `moveAndClick` used for all clicks with descriptive labels\n- [ ] `typeSlowly` used for visible input\n- [ ] No silent catches; helpers log warnings\n- [ ] Smooth scrolling used for content reveal\n- [ ] Key pauses are visible to a human viewer\n- [ ] Flow matches the requested story order\n- [ ] Script reflects the actual UI discovered in phase 1\n\n## Common Pitfalls\n\n1. Cursor disappears after navigation - re-inject it.\n2. Video is too fast - add pauses.\n3. Cursor is a dot instead of an arrow - use the SVG overlay.\n4. Cursor teleports - move before clicking.\n5. Select dropdowns look wrong - show the move, then pick the option.\n6. Modals feel abrupt - add a read pause before confirming.\n7. Video file path is random - copy it to a stable output name.\n8. Selector failures are swallowed - never use silent catch blocks.\n9. Field types were assumed - discover them first.\n10. Features were assumed - inspect the actual UI before scripting.\n11. Placeholder select values look real - watch for `\"0\"` and `\"Select...\"`.\n12. Popups create separate videos - capture popup pages explicitly and merge later if needed.\n","# UI Demo Video Recorder\n\nRecord polished demo videos of web applications using Playwright's video recording with an injected cursor overlay, natural pacing, and storytelling flow.\n\n## When to Use\n\n- User asks for a \"demo video\", \"screen recording\", \"walkthrough\", or \"tutorial\"\n- User wants to showcase a feature or workflow visually\n- User needs a video for documentation, onboarding, or stakeholder presentation\n\n## Three-Phase Process\n\nEvery demo goes through three phases: **Discover -> Rehearse -> Record**. Never skip straight to recording.\n\n---\n\n## Phase 1: Discover\n\nBefore writing any script, explore the target pages to understand what is actually there.\n\n### Why\n\nYou cannot script what you have not seen. Fields may be `\u003Cinput>` not `\u003Ctextarea>`, dropdowns may be custom components not `\u003Cselect>`, and comment boxes may support `@mentions` or `#tags`. Assumptions break recordings silently.\n\n### How\n\nNavigate to each page in the flow and dump its interactive elements:\n\n```javascript\n\u002F\u002F Run this for each page in the flow BEFORE writing the demo script\nconst fields = await page.evaluate(() => {\n  const els = [];\n  document.querySelectorAll('input, select, textarea, button, [contenteditable]').forEach(el => {\n    if (el.offsetParent !== null) {\n      els.push({\n        tag: el.tagName,\n        type: el.type || '',\n        name: el.name || '',\n        placeholder: el.placeholder || '',\n        text: el.textContent?.trim().substring(0, 40) || '',\n        contentEditable: el.contentEditable === 'true',\n        role: el.getAttribute('role') || '',\n      });\n    }\n  });\n  return els;\n});\nconsole.log(JSON.stringify(fields, null, 2));\n```\n\n### What to look for\n\n- **Form fields**: Are they `\u003Cselect>`, `\u003Cinput>`, custom dropdowns, or comboboxes?\n- **Select options**: Dump option values AND text. Placeholders often have `value=\"0\"` or `value=\"\"` which looks non-empty. Use `Array.from(el.options).map(o => ({ value: o.value, text: o.text }))`. Skip options where text includes \"Select\" or value is `\"0\"`.\n- **Rich text**: Does the comment box support `@mentions`, `#tags`, markdown, or emoji? Check placeholder text.\n- **Required fields**: Which fields block form submission? Check `required`, `*` in labels, and try submitting empty to see validation errors.\n- **Dynamic content**: Do fields appear after other fields are filled?\n- **Button labels**: Exact text such as `\"Submit\"`, `\"Submit Request\"`, or `\"Send\"`.\n- **Table column headers**: For table-driven modals, map each `input[type=\"number\"]` to its column header instead of assuming all numeric inputs mean the same thing.\n\n### Output\n\nA field map for each page, used to write correct selectors in the script. Example:\n\n```text\n\u002Fpurchase-requests\u002Fnew:\n  - Budget Code: \u003Cselect> (first select on page, 4 options)\n  - Desired Delivery: \u003Cinput type=\"date\">\n  - Context: \u003Ctextarea> (not input)\n  - BOM table: inline-editable cells with span.cursor-pointer -> input pattern\n  - Submit: \u003Cbutton> text=\"Submit\"\n\n\u002Fpurchase-requests\u002FN (detail):\n  - Comment: \u003Cinput placeholder=\"Type a message...\"> supports @user and #PR tags\n  - Send: \u003Cbutton> text=\"Send\" (disabled until input has content)\n```\n\n---\n\n## Phase 2: Rehearse\n\nRun through all steps without recording. Verify every selector resolves.\n\n### Why\n\nSilent selector failures are the main reason demo recordings break. Rehearsal catches them before you waste a recording.\n\n### How\n\nUse `ensureVisible`, a wrapper that logs and fails loudly:\n\n```javascript\nasync function ensureVisible(page, locator, label) {\n  const el = typeof locator === 'string' ? page.locator(locator).first() : locator;\n  const visible = await el.isVisible().catch(() => false);\n  if (!visible) {\n    const msg = `REHEARSAL FAIL: \"${label}\" not found - selector: ${typeof locator === 'string' ? locator : '(locator object)'}`;\n    console.error(msg);\n    const found = await page.evaluate(() => {\n      return Array.from(document.querySelectorAll('button, input, select, textarea, a'))\n        .filter(el => el.offsetParent !== null)\n        .map(el => `${el.tagName}[${el.type || ''}] \"${el.textContent?.trim().substring(0, 30)}\"`)\n        .join('\\n  ');\n    });\n    console.error('  Visible elements:\\n  ' + found);\n    return false;\n  }\n  console.log(`REHEARSAL OK: \"${label}\"`);\n  return true;\n}\n```\n\n### Rehearsal script structure\n\n```javascript\nconst steps = [\n  { label: 'Login email field', selector: '#email' },\n  { label: 'Login submit', selector: 'button[type=\"submit\"]' },\n  { label: 'New Request button', selector: 'button:has-text(\"New Request\")' },\n  { label: 'Budget Code select', selector: 'select' },\n  { label: 'Delivery date', selector: 'input[type=\"date\"]:visible' },\n  { label: 'Description field', selector: 'textarea:visible' },\n  { label: 'Add Item button', selector: 'button:has-text(\"Add Item\")' },\n  { label: 'Submit button', selector: 'button:has-text(\"Submit\")' },\n];\n\nlet allOk = true;\nfor (const step of steps) {\n  if (!await ensureVisible(page, step.selector, step.label)) {\n    allOk = false;\n  }\n}\nif (!allOk) {\n  console.error('REHEARSAL FAILED - fix selectors before recording');\n  process.exit(1);\n}\nconsole.log('REHEARSAL PASSED - all selectors verified');\n```\n\n### When rehearsal fails\n\n1. Read the visible-element dump.\n2. Find the correct selector.\n3. Update the script.\n4. Re-run rehearsal.\n5. Only proceed when every selector passes.\n\n---\n\n## Phase 3: Record\n\nOnly after discovery and rehearsal pass should you create the recording.\n\n### Recording Principles\n\n#### 1. Storytelling Flow\n\nPlan the video as a story. Follow user-specified order, or use this default:\n\n- **Entry**: Login or navigate to the starting point\n- **Context**: Pan the surroundings so viewers orient themselves\n- **Action**: Perform the main workflow steps\n- **Variation**: Show a secondary feature such as settings, theme, or localization\n- **Result**: Show the outcome, confirmation, or new state\n\n#### 2. Pacing\n\n- After login: `4s`\n- After navigation: `3s`\n- After clicking a button: `2s`\n- Between major steps: `1.5-2s`\n- After the final action: `3s`\n- Typing delay: `25-40ms` per character\n\n#### 3. Cursor Overlay\n\nInject an SVG arrow cursor that follows mouse movements:\n\n```javascript\nasync function injectCursor(page) {\n  await page.evaluate(() => {\n    if (document.getElementById('demo-cursor')) return;\n    const cursor = document.createElement('div');\n    cursor.id = 'demo-cursor';\n    cursor.innerHTML = `\u003Csvg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\">\n      \u003Cpath d=\"M5 3L19 12L12 13L9 20L5 3Z\" fill=\"white\" stroke=\"black\" stroke-width=\"1.5\" stroke-linejoin=\"round\"\u002F>\n    \u003C\u002Fsvg>`;\n    cursor.style.cssText = `\n      position: fixed; z-index: 999999; pointer-events: none;\n      width: 24px; height: 24px;\n      transition: left 0.1s, top 0.1s;\n      filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.3));\n    `;\n    cursor.style.left = '0px';\n    cursor.style.top = '0px';\n    document.body.appendChild(cursor);\n    document.addEventListener('mousemove', (e) => {\n      cursor.style.left = e.clientX + 'px';\n      cursor.style.top = e.clientY + 'px';\n    });\n  });\n}\n```\n\nCall `injectCursor(page)` after every page navigation because the overlay is destroyed on navigate.\n\n#### 4. Mouse Movement\n\nNever teleport the cursor. Move to the target before clicking:\n\n```javascript\nasync function moveAndClick(page, locator, label, opts = {}) {\n  const { postClickDelay = 800, ...clickOpts } = opts;\n  const el = typeof locator === 'string' ? page.locator(locator).first() : locator;\n  const visible = await el.isVisible().catch(() => false);\n  if (!visible) {\n    console.error(`WARNING: moveAndClick skipped - \"${label}\" not visible`);\n    return false;\n  }\n  try {\n    await el.scrollIntoViewIfNeeded();\n    await page.waitForTimeout(300);\n    const box = await el.boundingBox();\n    if (box) {\n      await page.mouse.move(box.x + box.width \u002F 2, box.y + box.height \u002F 2, { steps: 10 });\n      await page.waitForTimeout(400);\n    }\n    await el.click(clickOpts);\n  } catch (e) {\n    console.error(`WARNING: moveAndClick failed on \"${label}\": ${e.message}`);\n    return false;\n  }\n  await page.waitForTimeout(postClickDelay);\n  return true;\n}\n```\n\nEvery call should include a descriptive `label` for debugging.\n\n#### 5. Typing\n\nType visibly, not instant-fill:\n\n```javascript\nasync function typeSlowly(page, locator, text, label, charDelay = 35) {\n  const el = typeof locator === 'string' ? page.locator(locator).first() : locator;\n  const visible = await el.isVisible().catch(() => false);\n  if (!visible) {\n    console.error(`WARNING: typeSlowly skipped - \"${label}\" not visible`);\n    return false;\n  }\n  await moveAndClick(page, el, label);\n  await el.fill('');\n  await el.pressSequentially(text, { delay: charDelay });\n  await page.waitForTimeout(500);\n  return true;\n}\n```\n\n#### 6. Scrolling\n\nUse smooth scroll instead of jumps:\n\n```javascript\nawait page.evaluate(() => window.scrollTo({ top: 400, behavior: 'smooth' }));\nawait page.waitForTimeout(1500);\n```\n\n#### 7. Dashboard Panning\n\nWhen showing a dashboard or overview page, move the cursor across key elements:\n\n```javascript\nasync function panElements(page, selector, maxCount = 6) {\n  const elements = await page.locator(selector).all();\n  for (let i = 0; i \u003C Math.min(elements.length, maxCount); i++) {\n    try {\n      const box = await elements[i].boundingBox();\n      if (box && box.y \u003C 700) {\n        await page.mouse.move(box.x + box.width \u002F 2, box.y + box.height \u002F 2, { steps: 8 });\n        await page.waitForTimeout(600);\n      }\n    } catch (e) {\n      console.warn(`WARNING: panElements skipped element ${i} (selector: \"${selector}\"): ${e.message}`);\n    }\n  }\n}\n```\n\n#### 8. Subtitles\n\nInject a subtitle bar at the bottom of the viewport:\n\n```javascript\nasync function injectSubtitleBar(page) {\n  await page.evaluate(() => {\n    if (document.getElementById('demo-subtitle')) return;\n    const bar = document.createElement('div');\n    bar.id = 'demo-subtitle';\n    bar.style.cssText = `\n      position: fixed; bottom: 0; left: 0; right: 0; z-index: 999998;\n      text-align: center; padding: 12px 24px;\n      background: rgba(0, 0, 0, 0.75);\n      color: white; font-family: -apple-system, \"Segoe UI\", sans-serif;\n      font-size: 16px; font-weight: 500; letter-spacing: 0.3px;\n      transition: opacity 0.3s;\n      pointer-events: none;\n    `;\n    bar.textContent = '';\n    bar.style.opacity = '0';\n    document.body.appendChild(bar);\n  });\n}\n\nasync function showSubtitle(page, text) {\n  await page.evaluate((t) => {\n    const bar = document.getElementById('demo-subtitle');\n    if (!bar) return;\n    if (t) {\n      bar.textContent = t;\n      bar.style.opacity = '1';\n    } else {\n      bar.style.opacity = '0';\n    }\n  }, text);\n  if (text) await page.waitForTimeout(800);\n}\n```\n\nCall `injectSubtitleBar(page)` alongside `injectCursor(page)` after every navigation.\n\nUsage pattern:\n\n```javascript\nawait showSubtitle(page, 'Step 1 - Logging in');\nawait showSubtitle(page, 'Step 2 - Dashboard overview');\nawait showSubtitle(page, '');\n```\n\nGuidelines:\n\n- Keep subtitle text short, ideally under 60 characters.\n- Use `Step N - Action` format for consistency.\n- Clear the subtitle during long pauses where the UI can speak for itself.\n\n## Script Template\n\n```javascript\n'use strict';\nconst { chromium } = require('playwright');\nconst path = require('path');\nconst fs = require('fs');\n\nconst BASE_URL = process.env.QA_BASE_URL || 'http:\u002F\u002Flocalhost:3000';\nconst VIDEO_DIR = path.join(__dirname, 'screenshots');\nconst OUTPUT_NAME = 'demo-FEATURE.webm';\nconst REHEARSAL = process.argv.includes('--rehearse');\n\n\u002F\u002F Paste injectCursor, injectSubtitleBar, showSubtitle, moveAndClick,\n\u002F\u002F typeSlowly, ensureVisible, and panElements here.\n\n(async () => {\n  const browser = await chromium.launch({ headless: true });\n\n  if (REHEARSAL) {\n    const context = await browser.newContext({ viewport: { width: 1280, height: 720 } });\n    const page = await context.newPage();\n    \u002F\u002F Navigate through the flow and run ensureVisible for each selector.\n    await browser.close();\n    return;\n  }\n\n  const context = await browser.newContext({\n    recordVideo: { dir: VIDEO_DIR, size: { width: 1280, height: 720 } },\n    viewport: { width: 1280, height: 720 }\n  });\n  const page = await context.newPage();\n\n  try {\n    await injectCursor(page);\n    await injectSubtitleBar(page);\n\n    await showSubtitle(page, 'Step 1 - Logging in');\n    \u002F\u002F login actions\n\n    await page.goto(`${BASE_URL}\u002Fdashboard`);\n    await injectCursor(page);\n    await injectSubtitleBar(page);\n    await showSubtitle(page, 'Step 2 - Dashboard overview');\n    \u002F\u002F pan dashboard\n\n    await showSubtitle(page, 'Step 3 - Main workflow');\n    \u002F\u002F action sequence\n\n    await showSubtitle(page, 'Step 4 - Result');\n    \u002F\u002F final reveal\n    await showSubtitle(page, '');\n  } catch (err) {\n    console.error('DEMO ERROR:', err.message);\n  } finally {\n    await context.close();\n    const video = page.video();\n    if (video) {\n      const src = await video.path();\n      const dest = path.join(VIDEO_DIR, OUTPUT_NAME);\n      try {\n        fs.copyFileSync(src, dest);\n        console.log('Video saved:', dest);\n      } catch (e) {\n        console.error('ERROR: Failed to copy video:', e.message);\n        console.error('  Source:', src);\n        console.error('  Destination:', dest);\n      }\n    }\n    await browser.close();\n  }\n})();\n```\n\nUsage:\n\n```bash\n# Phase 2: Rehearse\nnode demo-script.cjs --rehearse\n\n# Phase 3: Record\nnode demo-script.cjs\n```\n\n## Checklist Before Recording\n\n- [ ] Discovery phase completed\n- [ ] Rehearsal passes with all selectors OK\n- [ ] Headless mode enabled\n- [ ] Resolution set to `1280x720`\n- [ ] Cursor and subtitle overlays re-injected after every navigation\n- [ ] `showSubtitle(page, 'Step N - ...')` used at major transitions\n- [ ] `moveAndClick` used for all clicks with descriptive labels\n- [ ] `typeSlowly` used for visible input\n- [ ] No silent catches; helpers log warnings\n- [ ] Smooth scrolling used for content reveal\n- [ ] Key pauses are visible to a human viewer\n- [ ] Flow matches the requested story order\n- [ ] Script reflects the actual UI discovered in phase 1\n\n## Common Pitfalls\n\n1. Cursor disappears after navigation - re-inject it.\n2. Video is too fast - add pauses.\n3. Cursor is a dot instead of an arrow - use the SVG overlay.\n4. Cursor teleports - move before clicking.\n5. Select dropdowns look wrong - show the move, then pick the option.\n6. Modals feel abrupt - add a read pause before confirming.\n7. Video file path is random - copy it to a stable output name.\n8. Selector failures are swallowed - never use silent catch blocks.\n9. Field types were assumed - discover them first.\n10. Features were assumed - inspect the actual UI before scripting.\n11. Placeholder select values look real - watch for `\"0\"` and `\"Select...\"`.\n12. Popups create separate videos - capture popup pages explicitly and merge later if needed.\n",{"name":5,"metadata":54,"description":7},{"origin":55},"ECC","main","74715deacdc69119d739f38916f8ee4f0f979ebf","skills\u002Fstorage\u002Faffaan-m_ECC\u002Fui-demo",0,"https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills","https:\u002F\u002Fgithub.com\u002Fmdnaimul22","AI Agents Workflows Automation | Specializing in Python, FastAPI, MCP Agents & Custom ERP.","2026-11-11 21:16:57",{"source":8,"skillName":5,"commands":65,"prompt":75,"zipAvailable":76},[66,69,72],{"tool":67,"command":68},"npx","npx skills add mdnaimul22\u002Fhuman-skills --skill ui-demo",{"tool":70,"command":71},"bunx","bunx skills add mdnaimul22\u002Fhuman-skills --skill ui-demo",{"tool":73,"command":74},"pnpm","pnpm dlx skills add mdnaimul22\u002Fhuman-skills --skill ui-demo","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Fui-demo\u002FSKILL.md",true,[],[79,87,95,102,109,116],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":86},"01M767791C1KRP2ZRW2Z73VZ5Q","system-lifecycle-designer","Universal architectural methodology for designing granular, atomic, and sub-atomic lifecycles and end-to-end workflows for single functionality integrations across any domain (daemons, batch jobs, request transactions, resource pools). Provides patterns for deterministic identity, pre-commit validation, differential reconciliation, sticky leasing, state machines, transactional persistence, and closed-loop feedback.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Fmy_skills\u002Fsystem-lifecycle-designer\u002FSKILL.md",[],[],"2026-11-12 13:55:43",{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":94},"01M748ABPN5F1FANHH6HKZQMXT","style-sampling","Make a new episode in a proven video style - Collage Explainer, Finance Explainer, Animated Science Explainer, 3D Brand Explainer, 3D True Crime - on the person's topic. Use for \"an episode of\", \"in the style of\", \"sample this style\", 「用这个风格做一集」. One video to copy is reverse-any-video.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Fheygen-com_hyperframes\u002Fstyle-sampling\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":94},"01M748A59V04PKW4HA0XQ81FGP","reverse-any-video","Rebuild any video file as an editable HyperFrames project - motion graphics, talking heads, live action or AI-generated footage - checked against the original frame by frame. Use to reverse, recreate, remake, replicate or copy a video, or 「复刻这个视频」「照着这个视频做一个」.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Fheygen-com_hyperframes\u002Freverse-any-video\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":94},"01M7487T50P55CSXMWXZ0G9KRG","typescript-patterns","TypeScript patterns for strict, type-safe, maintainable code in modern TypeScript and JavaScript applications. Covers strict compiler configuration, type design, narrowing, discriminated unions, generics, async and error handling, module boundaries, dependency hygiene, and type-level testing. Use when writing or reviewing TypeScript or JavaScript code.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Ftypescript-patterns\u002FSKILL.md",[],[],{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":94},"01M7487ERZRGPC5NJ75077Y238","test-collaboration","Inventory and govern a project's test assets. Connect requirements, business rules, risks, bugs, and cross-boundary contracts to stable TEST-IDs and executable evidence in the repository's existing test registry or TESTS.md. Use for test inventory, test gap analysis, unit\u002Fintegration\u002Fcontract\u002FE2E\u002Fsmoke classification, bug-to-test regression protection, consumer\u002Fprovider contract testing, test-necessity review, and pre-delivery evidence review.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Ftest-collaboration\u002FSKILL.md",[],[],{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":120,"categories":121,"keywords":122,"publishedAt":94},"01M748721J3GKR2WS6K0QWFC35","story-lifecycle","Manage a file-based epic → story → sprint development loop without requiring an external project management tool. Creates and tracks epics, breaks them into user stories, assigns them to sprints, and drives implementation story by story. Use when starting a new feature initiative or when the team has no Jira\u002FLinear\u002FTaiga but needs structured delivery tracking.","https:\u002F\u002Fgithub.com\u002Fmdnaimul22\u002Fhuman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fstorage\u002Faffaan-m_ECC\u002Fstory-lifecycle\u002FSKILL.md",[],[]]