Web Scraper & SEO Analyzer
Scrapes websites, downloads their assets (HTML, CSS, JS, images, fonts), rewrites all paths for local serving (including internal page links and inline styles), extracts SEO metadata and design system patterns, detects broken links, records redirect chains, performs keyword density analysis, and produces a fully navigable local mirror. Scraped content can be served via a built-in HTTP server and verified with Playwright screenshots. Design tokens can be extracted in CSS custom properties, W3C JSON, or Tailwind config format.
When This Skill Fires
- User provides a URL (or list of URLs) and wants to capture, clone, or analyze the site
- User wants design inspiration or design tokens from a live website
- User asks to reverse-engineer a page's structure or design system
- User wants to audit SEO techniques on one or more pages
- User wants a local copy of a site for offline reference or mockup generation
- User wants to scrape a JavaScript-rendered SPA (React, Next.js, Vue, Angular)
- User wants to detect broken links or analyze redirect chains
- User wants to extract design tokens (colors, spacing, typography) from a site
- User wants an accessibility audit or WCAG compliance check on a website
Parameters
The user provides:
- url (required): A single URL string or a list of URLs to scrape
- depth (optional, default: 0): How many levels of child/navigation links to follow
0 = single page only
1 = the page + all direct child links found in navigation menus
2 = children + grandchildren
3+ = deeper crawls (warn the user this can be large)
- render-js (optional, default: off): Use Playwright to render JS before scraping — captures SPA/React/Vue content invisible to HTTP-only scraping. Also enables shadow DOM flattening and same-domain iframe extraction
- sitemap (optional, default: off): Fetch sitemap.xml to discover pages not linked from navigation
- resume (optional, default: off): Resume an interrupted crawl from the last checkpoint
- proxy (optional): Route all requests through an HTTP/HTTPS/SOCKS5 proxy (e.g.,
socks5://proxy:1080)
- cookies (optional): Inject auth cookies — inline
key=value;key=value pairs or a path to a JSON file {"name": "value"}
- headers (optional): Inject custom HTTP headers —
Key:Value;Key:Value format (e.g., Authorization:Bearer token123)
- basic-auth (optional): HTTP Basic Auth as
user:password
Which Script to Use
| Goal |
Script |
Key flags |
| Scrape a website (HTML + assets) |
scripts/scrape_site.py |
--urls, --depth, --output |
| Scrape JS-heavy / SPA site |
scripts/scrape_site.py |
--urls, --depth, --output, --render-js |
| Include sitemap pages |
scripts/scrape_site.py |
--urls, --output, --sitemap |
| Resume interrupted crawl |
scripts/scrape_site.py |
--urls, --output, --resume |
| Scrape via proxy |
scripts/scrape_site.py |
--urls, --output, --proxy |
| Scrape authenticated site |
scripts/scrape_site.py |
--urls, --output, --cookies or --headers or --basic-auth |
| Extract design tokens |
scripts/extract_tokens.py |
--input, --format |
| Run accessibility audit |
scripts/a11y_analyzer.py |
--input, --format |
| Serve scraped content locally |
scripts/serve_site.py |
--directory, --port |
| Take a screenshot |
scripts/playwright_view.py screenshot |
--url, --output, --viewport |
| Test responsive layouts |
scripts/playwright_view.py responsive |
--url, --output-dir |
| Run deeper SEO scoring |
scripts/seo_analyzer.py |
--input, --format |
| Get rendered HTML from SPA |
scripts/playwright_view.py render |
--url, --output |
Error Handling
The scraper handles common issues gracefully — know these before running:
- 403/401 responses: Logged, page skipped, crawl continues
- Timeout: 30-second timeout per request, retries once, then skips
- SSL errors: Falls back to
verify=False, warns user
- Binary files: Detected and downloaded without HTML parsing
- Relative URLs: All resolved against the page's base URL
- JavaScript-rendered content: Use
--render-js to render pages with Playwright before processing. Falls back to HTTP-only if Playwright is not installed.
- Interrupted crawls: Use
--resume to continue from where you left off. Checkpoint saved after every page.
- Broken links: Automatically detected and reported in
broken-links.json with source pages and anchor text
- Redirect chains: Automatically recorded in
redirect-chains.json with hop count and status codes
- Cookie/consent overlays: In
--render-js mode, common consent banners (OneTrust, CookieBot, Osano, Quantcast, generic GDPR) are automatically dismissed before content extraction. Also applies to Playwright screenshots.
- Proxy routing: Use
--proxy to route through HTTP/HTTPS/SOCKS5 proxies. Applied to both HTTP requests and Playwright browser.
- Authentication: Use
--cookies, --headers, or --basic-auth to access login-protected pages. Tokens/cookies must be obtained externally.
- iframe content: Same-domain
<iframe> sources are fetched and saved to pages/_iframes/. Cross-origin iframes are skipped.
- Shadow DOM: In
--render-js mode, shadow DOM content is flattened into the page HTML before extraction (best-effort).
Workflow Steps
Post-Scrape Checklist (Do This After Every Scrape)
After running scrape_site.py (Step 2), complete ALL of these before moving on — these follow-up offers are a core part of the skill's value, not optional extras:
- Present the results — Summarize pages scraped, assets downloaded, SEO highlights, broken links found, and redirect chains recorded
- Offer design token extraction — Ask: "I can also extract the design system (colors, fonts, spacing) into CSS custom properties, W3C JSON, or Tailwind config. Want me to run that?" Then run
extract_tokens.py if they say yes (or if they originally asked about design/styling)
- Offer accessibility audit — Ask: "I can run a WCAG 2.1 accessibility audit on the scraped pages. Want me to check that?"
- Offer local server — Ask: "Would you like me to start a local HTTP server so you can browse the scraped site in your browser?"
Even if the user didn't explicitly ask for tokens, audit, or server — offer them. Users often don't know these capabilities exist until prompted. If the user's original request already implies one of these (e.g., "clone the look and feel" implies design tokens), run it proactively without asking.
Step 1: Install Dependencies
cd /path/to/this/skill
pip install requests beautifulsoup4 lxml cssutils --break-system-packages -q
pip install playwright --break-system-packages -q
playwright install chromium 2>/dev/null || true
If playwright install fails (common in sandboxed environments), that's fine — scraping still works without JS rendering. The Playwright viewing step and --render-js become unavailable.
Step 2: Run the Scraper
python scripts/scrape_site.py \
--urls "https://example.com" \
--depth 1 \
--output /home/claude/scraped-sites/example.com
For JS-heavy SPAs (React, Next.js, Vue, Angular):
python scripts/scrape_site.py \
--urls "https://spa-site.com" \
--depth 1 --render-js \
--output /home/claude/scraped-sites/spa-site
With sitemap discovery for content-heavy sites (blogs, docs, e-commerce):
python scripts/scrape_site.py \
--urls "https://docs-site.com" \
--depth 0 --sitemap \
--output /home/claude/scraped-sites/docs-site
Resume an interrupted crawl:
python scripts/scrape_site.py \
--urls "https://example.com" \
--depth 2 --resume \
--output /home/claude/scraped-sites/example.com
Through a proxy:
python scripts/scrape_site.py \
--urls "https://example.com" \
--depth 1 --proxy "socks5://proxy:1080" \
--output /home/claude/scraped-sites/example.com
Authenticated site (cookies + headers):
python scripts/scrape_site.py \
--urls "https://dashboard.example.com" \
--depth 1 \
--cookies "session_id=abc123;csrf_token=xyz" \
--headers "Authorization:Bearer eyJhbGci..." \
--output /home/claude/scraped-sites/dashboard
The script handles:
- Breadth-first crawling with a visited-set to avoid cycles
- Depth limiting via the
--depth flag
- Navigation-scoped link discovery — only follows links inside
<nav>, <header>, or elements with menu/nav roles
- Sitemap discovery (
--sitemap) — fetches sitemap.xml/sitemap_index.xml to find pages not in navigation
- JS rendering (
--render-js) — uses Playwright to get the fully rendered DOM for SPAs before processing with the standard pipeline
- Asset downloading — CSS, JS, images, fonts from HTML and CSS
@import/url() references
- Internal link rewriting — after all pages are scraped, a second pass rewrites
<a href> links between pages to relative local paths, making multi-page sites fully navigable when served locally
- Inline style processing —
url() references in <style> tags and style="" attributes are rewritten to local asset paths; design patterns (colors, fonts, layout) from inline styles are included in the analysis
- Keyword density analysis — top 20 keywords with density percentages, stop word filtering, and prominence detection (keywords appearing in title/H1)
- Redirect chain recording — captures the full redirect path (each hop's URL and status code) whenever HTTP redirects are followed
- Checkpoint/resume (
--resume) — saves state after every page so interrupted crawls can continue from the last checkpoint
- Broken link detection — automatically tracks which pages link to which URLs and generates
broken-links.json with source pages, anchor text, and error details
- Proxy routing (
--proxy) — routes all HTTP requests and Playwright browser through an HTTP/HTTPS/SOCKS5 proxy
- Authentication (
--cookies, --headers, --basic-auth) — injects session cookies, custom headers, or HTTP Basic Auth into both requests and Playwright contexts
- iframe extraction — same-domain
<iframe> content is fetched, saved to pages/_iframes/, and the parent page's src rewritten to point locally
- Shadow DOM flattening (
--render-js only) — serializes shadow root content into <template shadowrootmode> elements so downstream parsers can see web component content
- robots.txt respect, rate limiting (1 req/sec default), and honest User-Agent identification
Step 3: Understand the Output Structure
scraped-sites/example.com/
├── site-report.json # Master manifest + SEO + design analysis
├── broken-links.json # Broken link report with source pages + anchor text
├── redirect-chains.json # Redirect chain data (hops, status codes)
├── pages/
│ ├── index.html # Rewritten HTML (local asset + page link paths)
│ ├── about.html
│ └── products/
│ └── index.html
├── assets/
│ ├── css/ # Downloaded stylesheets (url() paths rewritten)
│ ├── js/ # Downloaded scripts
│ ├── images/ # Downloaded images, favicons, icons
│ └── fonts/ # Downloaded web fonts
├── seo/
│ ├── seo-summary.json # Aggregated SEO findings
│ └── per-page/
│ ├── index.json # Per-page SEO data (including keyword density)
│ └── about.json
├── a11y/ # Generated by a11y_analyzer.py (Step 5b)
│ ├── a11y-summary.json # Aggregated accessibility findings
│ ├── a11y-analysis.json # Full analysis with per-page scores
│ └── per-page/
│ ├── index.json # Per-page WCAG checks
│ └── about.json
└── design-tokens/ # Generated by extract_tokens.py (Step 5a)
├── tokens-raw.json # Raw extracted values
├── tokens-w3c.json # W3C Design Tokens format
├── tokens.css # CSS custom properties
└── tailwind.config.js # Tailwind theme config
Step 4: Review the Site Report
site-report.json is the master document. It contains: scrape metadata (including JS rendering mode, sitemap discovery, broken link count, redirect chain count), a hierarchical sitemap tree, asset inventory by type, SEO highlights and issues, and design system extraction (colors, fonts, layout approach, responsive detection, framework detection).
See references/site-report-schema.md for the full schema with field descriptions and example JSON.
Step 5: Review SEO Data
seo/seo-summary.json aggregates findings across all pages. Per-page files in seo/per-page/ contain granular data covering: title tags, meta descriptions, heading hierarchy, URL structure, canonical URLs, Open Graph/Twitter Card tags, hreflang, robots directives, JSON-LD structured data, internal/external link analysis, image alt text audit, keyword density (top 20 keywords with density percentages and prominence in title/H1), and technical signals (viewport, charset, script loading, resource hints).
For the full element-by-element reference, see references/seo-checklist.md.
For deeper analysis with per-page scoring (0-100, graded A-F), run:
python scripts/seo_analyzer.py --input /path/to/scraped-site --format json
Step 5a: Extract Design Tokens (Per Post-Scrape Checklist)
Run proactively if the user asked about design, styling, or cloning — otherwise offer per the checklist above:
# All formats (CSS + JSON + Tailwind)
python scripts/extract_tokens.py --input /path/to/scraped-site --format all
# CSS custom properties only
python scripts/extract_tokens.py --input /path/to/scraped-site --format css
# W3C JSON design tokens only
python scripts/extract_tokens.py --input /path/to/scraped-site --format json
# Tailwind config only
python scripts/extract_tokens.py --input /path/to/scraped-site --format tailwind
The extractor analyzes all CSS sources (external stylesheets, inline <style> blocks, and style="" attributes on elements) and produces:
- Color classification — primary, neutral, and accent colors grouped by saturation/usage
- Typography scale — font families, font sizes sorted into a scale
- Spacing scale detection — identifies base-4, base-8, or custom spacing systems
- Border radius scale — extracted and sorted
- Shadow tokens — box-shadow values cataloged
- Breakpoint detection — media query breakpoints extracted
- CSS custom properties — ready-to-use
:root { --color-primary: ... } file
- W3C Design Tokens — structured JSON following the draft W3C spec
- Tailwind config —
theme.extend snippet for tailwind.config.js
Step 5b: Run Accessibility Audit (Per Post-Scrape Checklist)
Run proactively if the user asked about accessibility — otherwise offer per the checklist above:
python scripts/a11y_analyzer.py --input /path/to/scraped-site --format json
The analyzer checks each page against 10 WCAG criteria and produces a 0-100 score (graded A-F):
- Language (3.1.1) —
<html lang="..."> present and valid
- Document title (2.4.2) — descriptive
<title> tag
- Heading hierarchy (1.3.1) — sequential levels, single H1
- Image alt text (1.1.1) — missing alt, empty alt in links, suspicious placeholder alt
- Form labels (1.3.1, 4.1.2) — explicit
<label>, aria-label, or wrapping <label>
- Link purpose (2.4.4) — no empty links, no generic "click here" text
- ARIA validity (4.1.2) — valid roles, required attributes, no hidden focusables
- Focus indicators (2.4.7) — detects
outline: none without replacement
- Skip navigation (2.4.1) — skip-to-content link present
- Landmark regions (1.3.6) —
<main>, <nav>, <header> presence
- Table headers (1.3.1) —
<th>, scope, and <caption> on data tables
- Color contrast (1.4.3) — heuristic detection of low-contrast inline styles
Output is saved to a11y/a11y-analysis.json and a11y/a11y-summary.json, with per-page detail in a11y/per-page/.
Step 6: Offer Local Server (Per Post-Scrape Checklist)
Per the checklist above, offer the local server. If the user accepts:
python scripts/serve_site.py \
--directory /home/claude/scraped-sites/example.com \
--port 8080
The server maps / to pages/index.html, resolves page paths with .html extension fallback, serves /assets/* directly, and adds CORS headers.
Step 7: View with Playwright (Optional)
Use when: You need visual verification that the scrape is faithful, responsive screenshots for mockup reference, or the user wants to see the site before working with it. Skip when: The user only needs raw HTML/CSS/JSON data, or Playwright isn't installed.
# Single screenshot
python scripts/playwright_view.py screenshot \
--url "http://localhost:8080" \
--output screenshot.png --viewport 1280x800
# Responsive screenshots (desktop + tablet + mobile)
python scripts/playwright_view.py responsive \
--url "http://localhost:8080" --output-dir /path/to/screenshots
Step 8: Deep Analysis with web-analyzer (Optional)
For multi-site comparison, detailed design briefs, or when the scraped CSS data is too verbose for the main conversation, delegate to the web-analyzer companion subagent. It reads the scraped output directory and returns a structured summary — keeping the main conversation context lean.
The web-analyzer handles:
- Design system deep-dive — component patterns, motion/animation, layout grid analysis
- Site comparison — side-by-side analysis of 2+ scraped sites
- Design brief generation — actionable specifications for recreating or remixing the design
- SEO recommendations — prioritized improvements with concrete examples
Post-Scrape: Using Results
With the scraped data in hand, Claude can:
- Recreate the page — Read
site-report.json for structure, reference downloaded HTML/CSS for implementation details
- Remix the design — Use
design-tokens/tokens.css or tailwind.config.js as a foundation for new projects
- Apply SEO best practices — Use
seo-summary.json as a checklist for new pages, fix issues found in broken-links.json
3a. Fix accessibility issues — Use a11y/a11y-analysis.json to identify and prioritize WCAG violations
- Brainstorm variations — Compare multiple scraped sites side-by-side to identify patterns and differentiation opportunities
- Fix redirect chains — Review
redirect-chains.json to identify SEO-impacting redirect hops
- Target keywords — Use keyword density data to understand content strategy and replicate it
Prioritize the design system (colors, fonts, spacing) over pixel-perfect reproduction.
Important Notes
- This skill is for learning, brainstorming, and development reference. Always respect website terms of service and copyright.
- The scraper identifies itself honestly via User-Agent and respects robots.txt.
- Large sites with deep crawls can produce substantial downloads. The skill warns when depth > 2.
- Rate limiting (1 req/sec default) prevents overwhelming target servers.
- Downloaded content is for local development reference only.
Reference Files
scripts/scrape_site.py — Main scraping engine (crawl, download, rewrite links, JS rendering, sitemap, broken links, redirects, keyword density, cookie dismissal)
scripts/extract_tokens.py — Design token extractor (CSS custom properties, W3C JSON, Tailwind config)
scripts/a11y_analyzer.py — Accessibility audit (WCAG 2.1 AA, 12 checks, 0-100 scoring)
scripts/serve_site.py — Local HTTP server for viewing scraped content
scripts/playwright_view.py — Playwright integration for screenshots, responsive testing, JS rendering, cookie dismissal
scripts/seo_analyzer.py — Standalone deep SEO analysis with scoring
agents/web-analyzer.md — Companion subagent for deep design analysis and site comparison
references/seo-checklist.md — Comprehensive SEO elements reference
references/site-report-schema.md — Full site-report.json schema with field descriptions
1---
2name: web-scraper-seo
3description: Scrape, download, and analyze websites for mockup generation, design system extraction, accessibility auditing, and web development brainstorming. Use this skill whenever the user wants to clone a website's look and feel, reverse-engineer a page's design, capture a site's CSS/JS/HTML structure, extract design tokens (colors, typography, spacing scales), analyze SEO techniques, run a WCAG accessibility audit, crawl multi-level navigation menus, scrape JavaScript-rendered SPAs (React, Next.js, Vue, Angular), download site assets for offline viewing, generate a navigable local mirror of a website for reference, detect broken links, record redirect chains, or brainstorm web development ideas based on existing sites. Produces a local copy with rewritten internal links for full page-to-page navigation, faithful inline CSS reproduction, comprehensive design system extraction, keyword density analysis, WCAG 2.1 accessibility scoring, automatic cookie/consent banner dismissal, and structured design tokens in CSS/JSON/Tailwind formats. Also triggers when the user mentions scraping URLs, downloading websites, site cloning, design inspiration from live sites, SEO auditing, accessibility checking, WCAG compliance, design token extraction, or wants to serve scraped content locally. Accepts a single URL or a list of URLs with optional depth control for multi-level crawling. Make sure to use this skill whenever the user mentions website cloning, site scraping, design system extraction, SEO analysis, accessibility audit, broken link detection, or design token generation — even if they don't explicitly say "scrape".
4metadata:
5 source: https://skillmd.com/skills/aibot88/web-scraper-seo
6---
7
8# Web Scraper & SEO Analyzer
9
10Scrapes websites, downloads their assets (HTML, CSS, JS, images, fonts), rewrites all paths for local serving (including internal page links and inline styles), extracts SEO metadata and design system patterns, detects broken links, records redirect chains, performs keyword density analysis, and produces a fully navigable local mirror. Scraped content can be served via a built-in HTTP server and verified with Playwright screenshots. Design tokens can be extracted in CSS custom properties, W3C JSON, or Tailwind config format.
11
12## When This Skill Fires
13
14- User provides a URL (or list of URLs) and wants to capture, clone, or analyze the site
15- User wants design inspiration or design tokens from a live website
16- User asks to reverse-engineer a page's structure or design system
17- User wants to audit SEO techniques on one or more pages
18- User wants a local copy of a site for offline reference or mockup generation
19- User wants to scrape a JavaScript-rendered SPA (React, Next.js, Vue, Angular)
20- User wants to detect broken links or analyze redirect chains
21- User wants to extract design tokens (colors, spacing, typography) from a site
22- User wants an accessibility audit or WCAG compliance check on a website
23
24## Parameters
25
26The user provides:
27
281. **url** (required): A single URL string or a list of URLs to scrape
292. **depth** (optional, default: 0): How many levels of child/navigation links to follow
30 - `0` = single page only
31 - `1` = the page + all direct child links found in navigation menus
32 - `2` = children + grandchildren
33 - `3+` = deeper crawls (warn the user this can be large)
343. **render-js** (optional, default: off): Use Playwright to render JS before scraping — captures SPA/React/Vue content invisible to HTTP-only scraping. Also enables shadow DOM flattening and same-domain iframe extraction
354. **sitemap** (optional, default: off): Fetch sitemap.xml to discover pages not linked from navigation
365. **resume** (optional, default: off): Resume an interrupted crawl from the last checkpoint
376. **proxy** (optional): Route all requests through an HTTP/HTTPS/SOCKS5 proxy (e.g., `socks5://proxy:1080`)
387. **cookies** (optional): Inject auth cookies — inline `key=value;key=value` pairs or a path to a JSON file `{"name": "value"}`
398. **headers** (optional): Inject custom HTTP headers — `Key:Value;Key:Value` format (e.g., `Authorization:Bearer token123`)
409. **basic-auth** (optional): HTTP Basic Auth as `user:password`
41
42## Which Script to Use
43
44| Goal | Script | Key flags |
45|------|--------|-----------|
46| Scrape a website (HTML + assets) | `scripts/scrape_site.py` | `--urls`, `--depth`, `--output` |
47| Scrape JS-heavy / SPA site | `scripts/scrape_site.py` | `--urls`, `--depth`, `--output`, `--render-js` |
48| Include sitemap pages | `scripts/scrape_site.py` | `--urls`, `--output`, `--sitemap` |
49| Resume interrupted crawl | `scripts/scrape_site.py` | `--urls`, `--output`, `--resume` |
50| Scrape via proxy | `scripts/scrape_site.py` | `--urls`, `--output`, `--proxy` |
51| Scrape authenticated site | `scripts/scrape_site.py` | `--urls`, `--output`, `--cookies` or `--headers` or `--basic-auth` |
52| Extract design tokens | `scripts/extract_tokens.py` | `--input`, `--format` |
53| Run accessibility audit | `scripts/a11y_analyzer.py` | `--input`, `--format` |
54| Serve scraped content locally | `scripts/serve_site.py` | `--directory`, `--port` |
55| Take a screenshot | `scripts/playwright_view.py screenshot` | `--url`, `--output`, `--viewport` |
56| Test responsive layouts | `scripts/playwright_view.py responsive` | `--url`, `--output-dir` |
57| Run deeper SEO scoring | `scripts/seo_analyzer.py` | `--input`, `--format` |
58| Get rendered HTML from SPA | `scripts/playwright_view.py render` | `--url`, `--output` |
59
60## Error Handling
61
62The scraper handles common issues gracefully — know these before running:
63- **403/401 responses**: Logged, page skipped, crawl continues
64- **Timeout**: 30-second timeout per request, retries once, then skips
65- **SSL errors**: Falls back to `verify=False`, warns user
66- **Binary files**: Detected and downloaded without HTML parsing
67- **Relative URLs**: All resolved against the page's base URL
68- **JavaScript-rendered content**: Use `--render-js` to render pages with Playwright before processing. Falls back to HTTP-only if Playwright is not installed.
69- **Interrupted crawls**: Use `--resume` to continue from where you left off. Checkpoint saved after every page.
70- **Broken links**: Automatically detected and reported in `broken-links.json` with source pages and anchor text
71- **Redirect chains**: Automatically recorded in `redirect-chains.json` with hop count and status codes
72- **Cookie/consent overlays**: In `--render-js` mode, common consent banners (OneTrust, CookieBot, Osano, Quantcast, generic GDPR) are automatically dismissed before content extraction. Also applies to Playwright screenshots.
73- **Proxy routing**: Use `--proxy` to route through HTTP/HTTPS/SOCKS5 proxies. Applied to both HTTP requests and Playwright browser.
74- **Authentication**: Use `--cookies`, `--headers`, or `--basic-auth` to access login-protected pages. Tokens/cookies must be obtained externally.
75- **iframe content**: Same-domain `<iframe>` sources are fetched and saved to `pages/_iframes/`. Cross-origin iframes are skipped.
76- **Shadow DOM**: In `--render-js` mode, shadow DOM content is flattened into the page HTML before extraction (best-effort).
77
78## Workflow Steps
79
80### Post-Scrape Checklist (Do This After Every Scrape)
81
82After running `scrape_site.py` (Step 2), complete ALL of these before moving on — these follow-up offers are a core part of the skill's value, not optional extras:
83
841. **Present the results** — Summarize pages scraped, assets downloaded, SEO highlights, broken links found, and redirect chains recorded
852. **Offer design token extraction** — Ask: "I can also extract the design system (colors, fonts, spacing) into CSS custom properties, W3C JSON, or Tailwind config. Want me to run that?" Then run `extract_tokens.py` if they say yes (or if they originally asked about design/styling)
863. **Offer accessibility audit** — Ask: "I can run a WCAG 2.1 accessibility audit on the scraped pages. Want me to check that?"
874. **Offer local server** — Ask: "Would you like me to start a local HTTP server so you can browse the scraped site in your browser?"
88
89Even if the user didn't explicitly ask for tokens, audit, or server — offer them. Users often don't know these capabilities exist until prompted. If the user's original request already implies one of these (e.g., "clone the look and feel" implies design tokens), run it proactively without asking.
90
91### Step 1: Install Dependencies
92
93```bash
94cd /path/to/this/skill
95pip install requests beautifulsoup4 lxml cssutils --break-system-packages -q
96pip install playwright --break-system-packages -q
97playwright install chromium 2>/dev/null || true
98```
99
100If `playwright install` fails (common in sandboxed environments), that's fine — scraping still works without JS rendering. The Playwright viewing step and `--render-js` become unavailable.
101
102### Step 2: Run the Scraper
103
104```bash
105python scripts/scrape_site.py \
106 --urls "https://example.com" \
107 --depth 1 \
108 --output /home/claude/scraped-sites/example.com
109```
110
111For JS-heavy SPAs (React, Next.js, Vue, Angular):
112```bash
113python scripts/scrape_site.py \
114 --urls "https://spa-site.com" \
115 --depth 1 --render-js \
116 --output /home/claude/scraped-sites/spa-site
117```
118
119With sitemap discovery for content-heavy sites (blogs, docs, e-commerce):
120```bash
121python scripts/scrape_site.py \
122 --urls "https://docs-site.com" \
123 --depth 0 --sitemap \
124 --output /home/claude/scraped-sites/docs-site
125```
126
127Resume an interrupted crawl:
128```bash
129python scripts/scrape_site.py \
130 --urls "https://example.com" \
131 --depth 2 --resume \
132 --output /home/claude/scraped-sites/example.com
133```
134
135Through a proxy:
136```bash
137python scripts/scrape_site.py \
138 --urls "https://example.com" \
139 --depth 1 --proxy "socks5://proxy:1080" \
140 --output /home/claude/scraped-sites/example.com
141```
142
143Authenticated site (cookies + headers):
144```bash
145python scripts/scrape_site.py \
146 --urls "https://dashboard.example.com" \
147 --depth 1 \
148 --cookies "session_id=abc123;csrf_token=xyz" \
149 --headers "Authorization:Bearer eyJhbGci..." \
150 --output /home/claude/scraped-sites/dashboard
151```
152
153The script handles:
154- **Breadth-first crawling** with a visited-set to avoid cycles
155- **Depth limiting** via the `--depth` flag
156- **Navigation-scoped link discovery** — only follows links inside `<nav>`, `<header>`, or elements with menu/nav roles
157- **Sitemap discovery** (`--sitemap`) — fetches sitemap.xml/sitemap_index.xml to find pages not in navigation
158- **JS rendering** (`--render-js`) — uses Playwright to get the fully rendered DOM for SPAs before processing with the standard pipeline
159- **Asset downloading** — CSS, JS, images, fonts from HTML and CSS `@import`/`url()` references
160- **Internal link rewriting** — after all pages are scraped, a second pass rewrites `<a href>` links between pages to relative local paths, making multi-page sites fully navigable when served locally
161- **Inline style processing** — `url()` references in `<style>` tags and `style=""` attributes are rewritten to local asset paths; design patterns (colors, fonts, layout) from inline styles are included in the analysis
162- **Keyword density analysis** — top 20 keywords with density percentages, stop word filtering, and prominence detection (keywords appearing in title/H1)
163- **Redirect chain recording** — captures the full redirect path (each hop's URL and status code) whenever HTTP redirects are followed
164- **Checkpoint/resume** (`--resume`) — saves state after every page so interrupted crawls can continue from the last checkpoint
165- **Broken link detection** — automatically tracks which pages link to which URLs and generates `broken-links.json` with source pages, anchor text, and error details
166- **Proxy routing** (`--proxy`) — routes all HTTP requests and Playwright browser through an HTTP/HTTPS/SOCKS5 proxy
167- **Authentication** (`--cookies`, `--headers`, `--basic-auth`) — injects session cookies, custom headers, or HTTP Basic Auth into both requests and Playwright contexts
168- **iframe extraction** — same-domain `<iframe>` content is fetched, saved to `pages/_iframes/`, and the parent page's src rewritten to point locally
169- **Shadow DOM flattening** (`--render-js` only) — serializes shadow root content into `<template shadowrootmode>` elements so downstream parsers can see web component content
170- **robots.txt** respect, **rate limiting** (1 req/sec default), and honest **User-Agent** identification
171
172### Step 3: Understand the Output Structure
173
174```
175scraped-sites/example.com/
176├── site-report.json # Master manifest + SEO + design analysis
177├── broken-links.json # Broken link report with source pages + anchor text
178├── redirect-chains.json # Redirect chain data (hops, status codes)
179├── pages/
180│ ├── index.html # Rewritten HTML (local asset + page link paths)
181│ ├── about.html
182│ └── products/
183│ └── index.html
184├── assets/
185│ ├── css/ # Downloaded stylesheets (url() paths rewritten)
186│ ├── js/ # Downloaded scripts
187│ ├── images/ # Downloaded images, favicons, icons
188│ └── fonts/ # Downloaded web fonts
189├── seo/
190│ ├── seo-summary.json # Aggregated SEO findings
191│ └── per-page/
192│ ├── index.json # Per-page SEO data (including keyword density)
193│ └── about.json
194├── a11y/ # Generated by a11y_analyzer.py (Step 5b)
195│ ├── a11y-summary.json # Aggregated accessibility findings
196│ ├── a11y-analysis.json # Full analysis with per-page scores
197│ └── per-page/
198│ ├── index.json # Per-page WCAG checks
199│ └── about.json
200└── design-tokens/ # Generated by extract_tokens.py (Step 5a)
201 ├── tokens-raw.json # Raw extracted values
202 ├── tokens-w3c.json # W3C Design Tokens format
203 ├── tokens.css # CSS custom properties
204 └── tailwind.config.js # Tailwind theme config
205```
206
207### Step 4: Review the Site Report
208
209`site-report.json` is the master document. It contains: scrape metadata (including JS rendering mode, sitemap discovery, broken link count, redirect chain count), a hierarchical sitemap tree, asset inventory by type, SEO highlights and issues, and design system extraction (colors, fonts, layout approach, responsive detection, framework detection).
210
211See `references/site-report-schema.md` for the full schema with field descriptions and example JSON.
212
213### Step 5: Review SEO Data
214
215`seo/seo-summary.json` aggregates findings across all pages. Per-page files in `seo/per-page/` contain granular data covering: title tags, meta descriptions, heading hierarchy, URL structure, canonical URLs, Open Graph/Twitter Card tags, hreflang, robots directives, JSON-LD structured data, internal/external link analysis, image alt text audit, keyword density (top 20 keywords with density percentages and prominence in title/H1), and technical signals (viewport, charset, script loading, resource hints).
216
217For the full element-by-element reference, see `references/seo-checklist.md`.
218
219For deeper analysis with per-page scoring (0-100, graded A-F), run:
220```bash
221python scripts/seo_analyzer.py --input /path/to/scraped-site --format json
222```
223
224### Step 5a: Extract Design Tokens (Per Post-Scrape Checklist)
225
226Run proactively if the user asked about design, styling, or cloning — otherwise offer per the checklist above:
227
228```bash
229# All formats (CSS + JSON + Tailwind)
230python scripts/extract_tokens.py --input /path/to/scraped-site --format all
231
232# CSS custom properties only
233python scripts/extract_tokens.py --input /path/to/scraped-site --format css
234
235# W3C JSON design tokens only
236python scripts/extract_tokens.py --input /path/to/scraped-site --format json
237
238# Tailwind config only
239python scripts/extract_tokens.py --input /path/to/scraped-site --format tailwind
240```
241
242The extractor analyzes all CSS sources (external stylesheets, inline `<style>` blocks, and `style=""` attributes on elements) and produces:
243- **Color classification** — primary, neutral, and accent colors grouped by saturation/usage
244- **Typography scale** — font families, font sizes sorted into a scale
245- **Spacing scale detection** — identifies base-4, base-8, or custom spacing systems
246- **Border radius scale** — extracted and sorted
247- **Shadow tokens** — box-shadow values cataloged
248- **Breakpoint detection** — media query breakpoints extracted
249- **CSS custom properties** — ready-to-use `:root { --color-primary: ... }` file
250- **W3C Design Tokens** — structured JSON following the draft W3C spec
251- **Tailwind config** — `theme.extend` snippet for `tailwind.config.js`
252
253### Step 5b: Run Accessibility Audit (Per Post-Scrape Checklist)
254
255Run proactively if the user asked about accessibility — otherwise offer per the checklist above:
256
257```bash
258python scripts/a11y_analyzer.py --input /path/to/scraped-site --format json
259```
260
261The analyzer checks each page against 10 WCAG criteria and produces a 0-100 score (graded A-F):
262- **Language** (3.1.1) — `<html lang="...">` present and valid
263- **Document title** (2.4.2) — descriptive `<title>` tag
264- **Heading hierarchy** (1.3.1) — sequential levels, single H1
265- **Image alt text** (1.1.1) — missing alt, empty alt in links, suspicious placeholder alt
266- **Form labels** (1.3.1, 4.1.2) — explicit `<label>`, `aria-label`, or wrapping `<label>`
267- **Link purpose** (2.4.4) — no empty links, no generic "click here" text
268- **ARIA validity** (4.1.2) — valid roles, required attributes, no hidden focusables
269- **Focus indicators** (2.4.7) — detects `outline: none` without replacement
270- **Skip navigation** (2.4.1) — skip-to-content link present
271- **Landmark regions** (1.3.6) — `<main>`, `<nav>`, `<header>` presence
272- **Table headers** (1.3.1) — `<th>`, `scope`, and `<caption>` on data tables
273- **Color contrast** (1.4.3) — heuristic detection of low-contrast inline styles
274
275Output is saved to `a11y/a11y-analysis.json` and `a11y/a11y-summary.json`, with per-page detail in `a11y/per-page/`.
276
277### Step 6: Offer Local Server (Per Post-Scrape Checklist)
278
279Per the checklist above, offer the local server. If the user accepts:
280```bash
281python scripts/serve_site.py \
282 --directory /home/claude/scraped-sites/example.com \
283 --port 8080
284```
285
286The server maps `/` to `pages/index.html`, resolves page paths with `.html` extension fallback, serves `/assets/*` directly, and adds CORS headers.
287
288### Step 7: View with Playwright (Optional)
289
290**Use when:** You need visual verification that the scrape is faithful, responsive screenshots for mockup reference, or the user wants to see the site before working with it. **Skip when:** The user only needs raw HTML/CSS/JSON data, or Playwright isn't installed.
291
292```bash
293# Single screenshot
294python scripts/playwright_view.py screenshot \
295 --url "http://localhost:8080" \
296 --output screenshot.png --viewport 1280x800
297
298# Responsive screenshots (desktop + tablet + mobile)
299python scripts/playwright_view.py responsive \
300 --url "http://localhost:8080" --output-dir /path/to/screenshots
301```
302
303### Step 8: Deep Analysis with web-analyzer (Optional)
304
305For multi-site comparison, detailed design briefs, or when the scraped CSS data is too verbose for the main conversation, delegate to the **web-analyzer** companion subagent. It reads the scraped output directory and returns a structured summary — keeping the main conversation context lean.
306
307The web-analyzer handles:
308- **Design system deep-dive** — component patterns, motion/animation, layout grid analysis
309- **Site comparison** — side-by-side analysis of 2+ scraped sites
310- **Design brief generation** — actionable specifications for recreating or remixing the design
311- **SEO recommendations** — prioritized improvements with concrete examples
312
313## Post-Scrape: Using Results
314
315With the scraped data in hand, Claude can:
316
3171. **Recreate the page** — Read `site-report.json` for structure, reference downloaded HTML/CSS for implementation details
3182. **Remix the design** — Use `design-tokens/tokens.css` or `tailwind.config.js` as a foundation for new projects
3193. **Apply SEO best practices** — Use `seo-summary.json` as a checklist for new pages, fix issues found in `broken-links.json`
3203a. **Fix accessibility issues** — Use `a11y/a11y-analysis.json` to identify and prioritize WCAG violations
3214. **Brainstorm variations** — Compare multiple scraped sites side-by-side to identify patterns and differentiation opportunities
3225. **Fix redirect chains** — Review `redirect-chains.json` to identify SEO-impacting redirect hops
3236. **Target keywords** — Use keyword density data to understand content strategy and replicate it
324
325Prioritize the design system (colors, fonts, spacing) over pixel-perfect reproduction.
326
327## Important Notes
328
329- This skill is for learning, brainstorming, and development reference. Always respect website terms of service and copyright.
330- The scraper identifies itself honestly via User-Agent and respects robots.txt.
331- Large sites with deep crawls can produce substantial downloads. The skill warns when depth > 2.
332- Rate limiting (1 req/sec default) prevents overwhelming target servers.
333- Downloaded content is for local development reference only.
334
335## Reference Files
336
337- `scripts/scrape_site.py` — Main scraping engine (crawl, download, rewrite links, JS rendering, sitemap, broken links, redirects, keyword density, cookie dismissal)
338- `scripts/extract_tokens.py` — Design token extractor (CSS custom properties, W3C JSON, Tailwind config)
339- `scripts/a11y_analyzer.py` — Accessibility audit (WCAG 2.1 AA, 12 checks, 0-100 scoring)
340- `scripts/serve_site.py` — Local HTTP server for viewing scraped content
341- `scripts/playwright_view.py` — Playwright integration for screenshots, responsive testing, JS rendering, cookie dismissal
342- `scripts/seo_analyzer.py` — Standalone deep SEO analysis with scoring
343- `agents/web-analyzer.md` — Companion subagent for deep design analysis and site comparison
344- `references/seo-checklist.md` — Comprehensive SEO elements reference
345- `references/site-report-schema.md` — Full site-report.json schema with field descriptions