使用 Playwright MCP 截取高质量 VS Code 画面
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "vscode-playwright" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/hve-core/main/.github/skills/experimental/vscode-playwright/SKILL.md 2. 保存为 ~/.claude/skills/vscode-playwright/SKILL.md 3. 装好后重载技能,告诉我可以用了
请帮我用 VS Code Playwright Screenshot Skill 为演示文稿截取一张干净的 VS Code 编辑器截图,并在截图前关闭多余面板和通知。
得到适合放进幻灯片的整洁 VS Code 截图。
请生成一套用于文档的 VS Code 代码讲解截图流程,包含打开文件、整理界面并验证截图质量。
得到可直接用于技术文档的截图流程说明。
请协助准备一张包含 Copilot Chat 示例的 VS Code 截图,要求界面清晰、适合嵌入教程。
得到适合教程插图的 Copilot Chat 截图。
讲师、产品或开发者在制作课件时,需要稳定、干净的 VS Code 画面。这个技能帮助他们启动 web 端 VS Code 并截取适合展示的图片。
写作者或开发者在编写教程时,可以用它获得代码浏览、编辑器界面和 Copilot Chat 的截图。它强调界面清理和截图验证,便于直接嵌入文档。
当需要多张风格一致的截图时,它可以通过预设设置、固定视口和服务器流程减少界面波动。适合重复生成统一视觉素材。
这份文档介绍了一个用于截取 VS Code 高质量截图的技能,重点面向幻灯片、技术文档和 Copilot Chat 示例。它说明了所需前置条件、serve-web 架构,以及从识别 CLI、启动服务、清理界面到验证和停止服务的完整流程,并强调要用预设设置和同一终端会话来保证截图稳定一致。
Captures VS Code editor views, code walkthroughs, and Copilot Chat examples using Playwright MCP tools with serve-web.
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.
code or code-insiders)mcp_microsoft_pla_browser_*)curl for server readiness checksThe 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 all server data (settings, extensions, state) is stored.
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:
if [[ "${VSCODE_QUALITY:-}" == *insider* ]] || command -v code-insiders &>/dev/null; then
VSCODE_CLI="code-insiders"
else
VSCODE_CLI="code"
fi
Create a temporary server data directory, pre-seed settings (including the color theme) to prevent state restoration, and launch serve-web. The --server-data-dir flag must receive a literal path — shell variables from other terminal sessions are not available in background terminals:
VSCODE_SERVE_DIR=$(mktemp -d)
mkdir -p "$VSCODE_SERVE_DIR/data/User"
cat > "$VSCODE_SERVE_DIR/data/User/settings.json" <<'EOF'
{
"window.restoreWindows": "none",
"workbench.editor.restoreEditors": false,
"workbench.startupEditor": "none",
"workbench.editor.restoreViewState": false,
"workbench.editor.sharedViewState": false,
"files.hotExit": "off",
"telemetry.telemetryLevel": "off",
"workbench.colorTheme": "Default Dark Modern",
"workbench.activityBar.location": "hidden"
}
EOF
$VSCODE_CLI serve-web --port 8765 --without-connection-token \
--accept-server-license-terms --server-data-dir "$VSCODE_SERVE_DIR"
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.
mcp_microsoft_pla_browser_navigate to http://localhost:8765/?folder=/path/to/workspace.mcp_microsoft_pla_browser_wait_for with time: 5 to allow the editor UI to fully render.Resize the viewport to match the target placement ratio: mcp_microsoft_pla_browser_resize to a resolution whose aspect ratio matches the PPTX placeholder 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.
…
它用于通过 Playwright MCP 和 serve-web 捕获 VS Code 编辑器画面、代码讲解截图和 Copilot Chat 示例。主要面向幻灯片、文档和其他视觉素材。
需要 VS Code 或 VS Code Insiders CLI、可用的 Playwright MCP 工具,以及 `curl` 用于检查服务就绪。文档还要求使用 `serve-web` 启动 VS Code Web。
文档提到会管理服务器生命周期、视口配置、界面清理和截图验证。还建议预置设置并在同一终端会话中启动 `serve-web`。
为设计思维教练提供身份、流程与状态基线
帮助你写出更规范、可维护的 Python 代码
将设计思维成果整理为可交接的 RPI 输入与上下文
将回复压缩为极简风格,同时保留技术准确性
通过 Python CLI 自动读写 Mural 内容并管理小组件
从多视角审查代码变更,输出结构化问题与风险。
让 AI 直接操控 VS Code 编码、调试、截图并执行测试自动化流程
通过真实浏览器自动化网页操作、截图抓取并生成测试代码与脚本。
通过浏览器自动化与调试能力,帮助开发者高效测试和排查网页问题
通过 Playwright 驱动 Chromium 并用快照高效操作网页
通过 MCP 提供网页开发辅助,可截图并列出页面屏幕信息。
帮助用户通过 Chrome 扩展完成截图与录屏,并接入 Claude Code 自动处理。