microsoft/hve-core/vscode-playwright
Claude Code and agent skill by microsoft/hve-core
- vendor
Checking that the SKILL.md file is still in the repository.
Capture VS Code screenshots and self-contained browser animation scenes through Playwright. Use for editor evidence, slide imagery, or silent WebM scene clips.
Install
npx vskill@latest install microsoft/hve-core/vscode-playwrightSKILL.md
The same SKILL.md was published earlier as microsoft/hve-core/vscode-playwright.
VS Code and Browser Capture Skill
Captures VS Code editor views, code walkthroughs, and Copilot Chat examples, and records self-contained browser animation scenes as silent WebM clips.
Overview
This skill provides a complete workflow for capturing high-quality VS Code screenshots suitable for embedding in slide decks, documentation, and other visual media. It handles server lifecycle management, viewport configuration, UI cleanup, and screenshot validation.
Two paths share the same constraints. Prefer the scripted path for any repeatable or unattended capture, including CI. Use the interactive Playwright MCP path for exploratory or one-off captures.
Scripted Capture
scripts/capture_vscode.py runs a YAML capture plan headless: it starts serve-web, applies capture settings, opens each file in Monaco, measures the rendered font, and writes one screenshot per capture. It drives Playwright directly, so it needs no MCP server and runs on a CI runner.
A plan names each capture's id, a workspace-relative file, and an output path relative to the plan directory, or to --output-root when given. An id is one filename-safe token of letters, digits, ., _, or -. An output is a relative .png path with / separators and no .., and the script refuses to write outside the output root or through a symlink:
The script exits 0 only when every capture was written and met min_font_pt, and prints one JSON result on its last stdout line with each capture's measured rendered_font_size_pt, zoom, and source_resolution. A failed capture also writes debug-<id>.png. It rejects markdown targets at plan validation and fails when the dark theme does not apply, so a clashing light capture cannot pass. When piping its output in CI, run the step under shell: bash so pipefail preserves the exit code.
Browser Animation Recording
scripts/record_browser_video.py records one self-contained HTML animation to a silent WebM clip from ready-scene frames. The scene must set data-animation-ready="true" on its body after local assets and animation state are ready and define window.startAnimation() to reset narrative motion and timers. Recording starts at that handshake, not at page navigation. The browser context is offline, service workers are blocked, WebSocket traffic is intercepted without forwarding, and popups are closed. A synthetic origin serves only files below the approved asset root; traversal and escaping symlinks are rejected. The default root is the scene directory; use --asset-root for a caller-approved shared asset directory containing the scene. Do not grant the workspace or home directory as an asset root.
The recorder writes a silent clip. Pair it with the matching narration WAV in a demo-video segment; that assembler trims or loops the browser clip to the declared narration duration and supplies the final audio. Frames are sampled at 24 fps using virtual scene time, then encoded with FFmpeg. Startup and closing browser frames are excluded; duration is accurate to a video-frame boundary.
Prerequisites
Scripted screenshots require the VS Code or VS Code Insiders CLI (code or code-insiders). Interactive VS Code capture also requires genuine Playwright MCP browser tools and curl. Browser animation recording requires uv, the skill environment with Playwright 1.48 or newer, Chromium, and FFmpeg with libvpx-vp9; it does not require VS Code or MCP.
Tool names in this skill use an mcp_microsoft_pla_browser_* prefix. The actual prefix is derived from the MCP server's registration name in your host, so it may differ, for example mcp_playwright_browser_*. Match the prefix your host exposes.
Verified Constraints
These three constraints were confirmed against a running serve-web instance. Each one invalidates an approach that looks reasonable but does not work.
- User settings live in the browser's IndexedDB, not on disk. Seeding
--server-data-dir/data/User/settings.jsonhas no effect on VS Code Web. Write them throughPreferences: Open User Settings (JSON)by dispatching a paste event, because paste avoids both EditContext key handling and bracket auto-closing, then save and reload the page. The reload closes the settings editor, which Insiders opens as a modal that holds focus, and applies window-level settings such as workspace trust. A persistent browser context keeps the settings across the reload. - Markdown files open as a cross-origin preview webview rather than a Monaco editor. The webview DOM is unreachable from the page, so rendered text inside it cannot be inspected or measured. Capture a code or configuration file when the screenshot needs measurable editor text.
- Confirm browser tooling by attempting a navigation rather than by matching tool names, because MCP tool prefixes vary by server registration. VS Code's built-in browser tools are a known case that loads the page but delivers neither keyboard nor mouse events to the VS Code Web workbench, so an attempt using them fails at the first command-palette step.
Architecture
The serve-web CLI is a Rust-based proxy ("server of servers") that downloads the VS Code Server release and proxies connections to the inner Node.js server. The outer CLI accepts a limited set of flags; --server-data-dir is the key flag that controls where server-side data such as the downloaded server build, extensions, and machine state is stored. It does not control user settings, which the browser holds in IndexedDB.
Quick Start
- Detect the VS Code CLI variant and start the web server.
- Navigate Playwright to the VS Code web instance.
- Clean up the UI (close panels, tabs, notifications).
- Open files and capture screenshots.
- Stop the server and clean up.
Workflow Steps
Step 1: Detect VS Code CLI Variant
Check the VSCODE_QUALITY environment variable first; if it contains insider, use code-insiders. Otherwise, test availability with command -v code-insiders and fall back to code. Store the result for reuse:
Step 2: Start the VS Code Web Server
Create a temporary server data directory and launch serve-web. The --server-data-dir flag must receive a literal path, because shell variables from other terminal sessions are not available in background terminals:
Do not write a data/User/settings.json file under that directory. VS Code Web keeps user settings in the browser's IndexedDB, so a seeded settings file changes nothing. Set the theme, close restored editors, and hide UI through Command Palette commands after the workbench loads (Step 5), and raise rendered text size with document.body.style.zoom.
Do not try to edit the settings JSON editor by typing into a textarea selector either. VS Code Insiders uses the EditContext API instead of a textarea, so that element does not exist.
The serve-web command and mktemp must execute in the same terminal session so the $VSCODE_SERVE_DIR variable resolves. If using a background terminal (isBackground: true), inline the entire block — do not reference variables set in a different terminal.
Verify the server is ready before proceeding: curl -s -o /dev/null -w "%{http_code}" http://localhost:8765/ must return 200.
If the server log contains Ignoring option 'server-data-dir': Value must not be empty, the variable was empty — the server is using the default data directory instead of the ephemeral one. Kill the process and re-launch with the literal path.
Step 3: Navigate and Wait
- Navigate to the workspace:
mcp_microsoft_pla_browser_navigatetohttp://localhost:8765/?folder=/path/to/workspace. - Wait for VS Code to load:
mcp_microsoft_pla_browser_wait_forwithtime: 5to allow the editor UI to fully render.
Step 4: Resize Viewport
Resize the viewport to match the target placement ratio: mcp_microsoft_pla_browser_resize to a resolution whose aspect ratio matches the slide or document region where the screenshot will be inserted.
Calculate dimensions using width_px = 1200 and height_px = int(1200 / (target_width_inches / target_height_inches)). For example, a 5.5" x 4.2" placeholder produces a 1200 x 916 viewport.
When the screenshot fills a full 16:9 slide, size the viewport to 1920x1080 instead of deriving it from the 1200 px width rule. Use the width rule for every other placement, and do not use 1920x1080 there. Resize before cleanup so UI elements render at the target resolution.
Step 5: Clean Up the UI
Prepare the editor for clean screenshots using mcp_microsoft_pla_browser_run_code with the Command Palette pattern:
- Dismiss workspace trust dialog if present: take a
mcp_microsoft_pla_browser_snapshot, look for a trust dialog, and click "Yes, I trust the authors" viamcp_microsoft_pla_browser_clickif visible. - Close all editors and tabs: Command Palette ->
View: Close All Editors. - Clear notifications: Command Palette ->
Notifications: Clear All Notifications. - Enable Do Not Disturb: Command Palette ->
Notifications: Toggle Do Not Disturb Mode. - Close Primary Side Bar: Command Palette ->
View: Close Primary Side Bar. - Close bottom panel: Take a
mcp_microsoft_pla_browser_snapshotfirst. If the panel (Terminal, Problems, Output) is visible, run Command Palette ->View: Close Panel. Do not run this command blindly — it toggles visibility and opens a hidden panel. - Close Secondary Side Bar: Take a
mcp_microsoft_pla_browser_snapshotfirst. If the secondary side bar (Chat) is visible, run Command Palette ->View: Close Secondary Side Bar. - Zoom in for readability: use
mcp_microsoft_pla_browser_run_codewithawait page.evaluate(() => { document.body.style.zoom = '1.75'; })for full-UI zoom. Treat no single factor as sufficient: raise the zoom and re-measure the rendered text size until it clears the caller's readability floor. At a 14 px base editor font, 18 pt is 24 CSS pixels, so roughly 1.75x is a starting point rather than a guarantee, because the base font size varies. Default font sizes become illegible (~7pt) when screenshots are shrunk to fit slide placeholders.
Step 6: Open Files and Capture
Open files via mcp_microsoft_pla_browser_run_code using the Command Palette pattern: Go to File command opens Quick Open, then type the filename and press Enter:
Set up the view: selectively open only the panels needed for this screenshot (split views, Copilot Chat, Explorer) via click-based navigation using mcp_microsoft_pla_browser_snapshot to find refs followed by mcp_microsoft_pla_browser_click. Keep the view focused on the subject.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 2 Oct 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.github/skills/experimental/vscode-playwright/SKILL.md
Popularity
- Repository stars
- 1,492
- Repository forks
- 318
- 7-day trend score
- 37
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 Mar 2026, 8 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/microsoft/hve-core/vscode-playwright)