Automated summary
This skill turns a SPA site (Vue, React, Angular) into a set of static HTML files by driving a Playwright browser to explore routes, download assets, and clean up the captured HTML.
Strengths
- A complete five-phase workflow, from route discovery to local verification
- Extracts Vue Router / React Router route tables and triggers lazy-loaded chunks by clicking through navigation
- Parallelizes asset downloads with subagents and captures pages one by one
- A pitfalls table with concrete fixes (font CORS, image hashes, SVG escaping, auth redirects)
Limitations
- Heavily tied to the Playwright MCP tools and Bash, so it is not portable as-is to other editors
- Cleanup relies on ad hoc Python regexes rather than a robust HTML parser
- Pages behind Keycloak/OAuth are not handled and must be skipped or worked around manually
Use it to archive or demo a client-rendered site when you need a static copy that opens offline.
Avoid it on sites you do not have rights to copy, or when a plain crawl of server-rendered HTML would do the job.
Security analysis
CautionNo destructive commands, obfuscated payloads, or secret exfiltration — commands are ordinary `curl`/`mkdir`/`http.server` and Playwright browsing, used for a coherent legitimate purpose (static mirroring of a SPA). The risk profile is 'powerful tools used broadly': unsafe in-page JS evaluation, unchecked downloads of remote binaries, and site-wide copying without an authorization check. That warrants caution, not risky.
- •Declares `mcp__playwright__browser_run_code_unsafe`, permitting arbitrary JS execution in the target page context — powerful and easy to misuse.
- •Wholesale mirroring of third-party sites raises copyright/ToS issues; the skill never asks the user to confirm they are authorized to copy the target.
- •Uses `curl -sL` to pull arbitrary remote JS/CSS/fonts/binaries with no integrity verification, then serves them locally via `python3 -m http.server`.
- •Mentions OAuth/Keycloak-gated routes as a 'pitfall' to work around (skip route / grab login page) without stating that authentication must not be bypassed.
- •Parallel subagents + full-site download can produce heavy traffic against a target host with no rate-limiting guidance.
Examples
把 https://example.com 这个 Vue 网站整个扒下来,生成可以直接双击打开的静态 HTML,放到 ./mirror 目录静态化这个 React 站点:https://app.example.com,保留所有路由页面和图片字体,最后用本地 http.server 跑起来验证一遍整站下载 https://docs.example.com,去掉所有 script 标签,修复资源路径和 iconfont 的 CORS 问题,然后截图给我看看首页效果name: spa-scrape version: 1.0.0 description: | 将 SPA(单页应用)网站完整扒下来,生成纯静态 HTML 文件。 适用于 Vue/React/Angular 等前端框架渲染的网站。 触发词:"扒站"、"扒下来"、"抓取这个网站"、"spa scrape"、"静态化这个网站"。 allowed-tools:
- Bash
- Read
- Write
- Edit
- Grep
- Glob
- Agent
- AskUserQuestion
- mcp__playwright__browser_navigate
- mcp__playwright__browser_snapshot
- mcp__playwright__browser_evaluate
- mcp__playwright__browser_click
- mcp__playwright__browser_network_requests
- mcp__playwright__browser_network_request
- mcp__playwright__browser_take_screenshot
- mcp__playwright__browser_wait_for
- mcp__playwright__browser_run_code_unsafe triggers:
- 扒站
- 扒下来
- 把网站扒下来
- 抓取这个网站
- spa scrape
- 静态化这个网站
- 整站下载
SPA 网站扒站工具
将动态渲染的 SPA 网站(Vue/React/Angular)转换为纯静态 HTML 文件,保留布局和样式。
完整工作流程
阶段 1:探索网站结构
-
打开目标网站
browser_navigate → 目标 URL browser_wait_for → 等待 3-5 秒让 SPA 渲染完成 -
获取路由表(关键步骤)
browser_evaluate → 执行 JS 获取 Vue Router / React Router 路由表- Vue:
document.querySelector('#app').__vue_app__._instance.appContext.config.globalProperties.$router.options.routes - React: 查 Network 面板或遍历 DOM 导航链接
- 通用:
browser_snapshot获取页面结构,提取所有导航链接
- Vue:
-
发现静态资源
browser_network_requests → static=true → 列出所有 JS/CSS/图片/字体记录带 hash 的文件名(如
index-Cwp7s7md.js、a1-BKC9nY_U.png) -
触发懒加载
逐一点击导航链接 → browser_click → browser_wait_for → browser_network_requests发现微前端子应用、路由懒加载 chunk
阶段 2:下载资源
-
创建本地目录结构
mkdir -p <output-dir>/{assets,子应用目录...} -
下载入口 HTML
curl -sL -o <output-dir>/index.html <网站URL> -
批量下载静态资源
# 下载 JS/CSS curl -sL -o <output-dir>/assets/xxx.js <网站URL>/assets/xxx.js # 下载图片(带 hash 的文件名) curl -sL -o <output-dir>/assets/a1-XXX.png <网站URL>/assets/a1-XXX.png # 下载字体 curl -sL -o <output-dir>/assets/iconfont-XXX.woff2 <网站URL>/assets/iconfont-XXX.woff2并行下载: 用多个 subagent 同时下载不同目录的资源
阶段 3:捕获页面快照
- 逐个页面捕获渲染后的 HTML
并行处理: 用 subagent 同时抓取多个页面browser_navigate → 页面路由 browser_wait_for → 3 秒等待渲染 browser_evaluate → document.documentElement.outerHTML → 保存为 .html
阶段 4:清洗 HTML
-
去掉不需要的内容
import re # 去掉所有 <script> 标签 html = re.sub(r'<script[^>]*>.*?</script>', '', html, flags=re.DOTALL) # 去掉外部 JS 引用(保留模板语法如 {{ }}) # 去掉 <link rel="modulepreload"> html = re.sub(r'<link[^>]*modulepreload[^>]*>', '', html) -
修复资源路径
# 添加 <base> 标签让图片等资源从远程加载 html = html.replace('<head>', '<head><base href="https://原网站域名/">') # 修复相对路径 html = re.sub(r'url\(\./iconfont-', 'url(assets/iconfont-', html) html = re.sub(r'url\(\./(?!assets/)', 'url(https://原网站域名/', html) # 修复 CSS 中的 CORS 字体 html = html.replace("url(./", "url(assets/") -
修复渲染问题
# SVG 转义 html = html.replace('=\\"', '="') # 注入缺失的 Header/公共组件样式 # (某些页面依赖公共组件 CSS,需要手动注入)
阶段 5:验证
-
本地预览
# 启动简单 HTTP 服务器 cd <output-dir> && python3 -m http.server 8899然后在浏览器中逐个打开页面,检查:
- 布局是否正常
- 图片是否加载
- 字体图标是否显示
- 浏览器 Console 是否有 404/CORS 错误
-
修复问题
- CORS 错误 → 检查
base标签和资源路径 - 图片 404 → 检查 hash 文件名是否正确
- 样式缺失 → 注入缺失的 CSS
- 布局错乱 → 检查 CSS 文件是否完整下载
- CORS 错误 → 检查
常见陷阱
| 问题 | 原因 | 解决 |
|------|------|------|
| 图片 hash 错误 | 不同构建版本的 hash 不同 | 从 Network 面板确认当前 hash |
| CORS 字体加载失败 | url() 路径不对 | 改为本地路径或完整 URL |
| Header/导航样式缺失 | 微前端公共组件 CSS 未注入 | 手动注入 common-components CSS |
| SVG 图标显示异常 | Vue 渲染的 =\" 转义 | replace('=\\"', '="') |
| 页面跳转到登录 | Keycloak/OAuth 认证拦截 | 单独下载登录页,或跳过需要认证的路由 |
| 滚动触发路由切换 | SPA 的 scroll-to-anchor | 小心使用 browser_evaluate,避免触发滚动 |
输出物
<output-dir>/
├── index.html # 主入口
├── standalone-homepage.html # 首页完整快照(可直接浏览器打开)
├── all-styles.css # 所有 CSS 合并文件
├── screenshot-fullpage.png # 首页截图
├── <page1>.html # 各页面快照
├── <page2>.html
├── ...
├── assets/ # 静态资源
│ ├── *.js
│ ├── *.css
│ ├── *.png / *.jpg
│ ├── *.woff2 / *.ttf
│ └── *.mp4
└── <子应用>/ # 微前端子应用资源
└── ...
使用示例
用户: 把 https://example.com/#/ 这个网站扒下来
用户: spa-scrape https://example.com
用户: 静态化这个 Vue 网站
From the file to a first result
The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.
View the source and supporting filesThis download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.
1. Download the file
Download SKILL.mdFrom the root of a test project, save the file as .skill-downloads/spa-website-scraper-tool-mrzxup53/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.
Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.
mkdir -p '.skill-downloads/spa-website-scraper-tool-mrzxup53' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/spa-website-scraper-tool-mrzxup53/download' --output '.skill-downloads/spa-website-scraper-tool-mrzxup53/SKILL.md.part' && mv '.skill-downloads/spa-website-scraper-tool-mrzxup53/SKILL.md.part' '.skill-downloads/spa-website-scraper-tool-mrzxup53/SKILL.md'2. Check prerequisites
Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.
No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.
The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.
3. Load the skill
After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.
Claude Code
test -f '.skill-downloads/spa-website-scraper-tool-mrzxup53/SKILL.md' && test -s '.skill-downloads/spa-website-scraper-tool-mrzxup53/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/spa-scrape' && cp -R '.skill-downloads/spa-website-scraper-tool-mrzxup53' '.claude/skills/spa-scrape'OpenSkills
OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.
Official OpenSkills installationopenskills install './.skill-downloads/spa-website-scraper-tool-mrzxup53'openskills read 'spa-website-scraper-tool-mrzxup53'Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.
For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.
openskills syncManual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.
4. Try a first task
Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:
Read .skill-downloads/spa-website-scraper-tool-mrzxup53/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.
React Hook Form Best Practices
Development
Master React Hook Form: avoid anti-patterns, manage subscriptions, and handle reset, dirty state, and controlled inputs correctly.
Emotion to Mantine Migration
Development
Migrate Emotion styled-components to Mantine components with style props and CSS modules. Use when converting .styled.tsx files or removing @emotion imports.
Scope Creep Detector
Development
Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad PRs, and oversized changes, then suggests keep, split, or justify actions.