clone-website
Skill1 starsChanged 3 months agoMITView on GitHub
Reverse-engineer and clone one or more websites in one shot. Extracts assets, CSS, content and behaviors section by section using Playwriter (the user's own Chrome browser) and dispatches parallel builder agents as it goes. Use whenever the user wants to clone, replicate, rebuild, reverse-engineer or copy any website. Also triggers on "make a copy of this site", "rebuild this page", "pixel-perfect clone". Provide one or more target URLs as arguments. Windows / PowerShell environment.
- Installs packages
22 other projects use a version of this, 14 of them edited.
Adopted by
Most recently taken up by
- Nightdreams-bat/claude-code-kitedited, first seen Nov 29, 2026
- mepiii/mepiedited, first seen Nov 29, 2026
- jiuyang5354/skillsedited, first seen Nov 29, 2026
- thanhdat2508/agent-skillstheir own version, first seen Nov 22, 2026
- dembrandt/dembrandt-skillstheir own version, first seen Nov 19, 2026
- realbrianhanson/lovable-website-cloneredited, first seen Nov 15, 2026
Used with
Projects with it also use vercel-react-best-practices, frontend-design and 1 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
VercelSkillvercel-react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
Also in 3 projects that use this
BlockSkillfrontend-design
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
Also in 4 projects that use this
SentrySkillskill-creator
Create new agent skills following the Agent Skills specification. Use when asked to "create a skill", "add a new skill", "write a skill", "make a skill", "build a skill", or scaffold a new skill with SKILL.md. Guides through requirements, writing, registration, and verification.
Also in 3 projects that use this
Other versions22 projects use a version of this.
Word for word · 0
None found.
Edited · 14
- yournextstore/yournextstore★ 5.5k43% same
- julianromli/ai-skills★ 24449% same
- realbrianhanson/lovable-website-cloner★ 942% same
- david-vrba/claude-power-skills★ 434% same
- edorabma9304/Claude-Skill-by-Ozolab-Indonesia★ 249% same
- abuzar310/cloneforge★ 149% same
- Bappoz/My-Claude-Skills★ 149% same
- imMamdouhaboammar/Mimera★ 149% same
- jiuyang5354/skills★ 143% same
- jpoindexter/theft-kit★ 149% same
4 more not listed
Wrote their own version · 8
- JCodesMore/ai-website-cloner-template★ 40ksame name
- coco-research/coco★ 324same name
- dembrandt/dembrandt-skills★ 245same name
- Mahanaicoach/ai-site-cloner★ 31same name
- Shri-Phnx/claude-skills★ 2same name
- Onevium/ditto★ 1same name
- pengelbrecht/skills★ 1same name
- thanhdat2508/agent-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
41 rules. 3 are common, 24 are distinctive, and 14 are very specific to this project.
3
Common
Most of the 22 edited versions we read keep these.
24
Distinctive
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
When multiple URLs are provided, process them independently and in parallel where possible, while keeping each site's extraction artifacts …
- Distinctive: line 28
If the user provides additional instructions (specific fidelity level, customizations, extra context), honor those over the defaults.
- Distinctive: line 46
Ask the user to open Chrome and click the Playwriter extension icon on the target tab, OR
- Very specific: line 76
If no scaffold is present, scaffold one matching the above before continuing (npm create vite@latest, then add Tailwind v4 and shadcn).
- Very specific: line 78
Create the output directories: if they do not exist: docs/research/, docs/research/components/, docs/design-references/, scripts/.
- Distinctive: line 108
The completion report REQUIRES the filled runsheet: Do not report the run done while any box is unchecked.
- Common: line 122
When an agent gets "build the entire features section," it glosses over details.
- Common: line 126
Complexity budget rule: If a builder prompt exceeds ~150 lines of spec content, the section is too complex for one agent.
- Very specific: line 164
If they do, it is scroll-driven.
- Common: line 165
If nothing changes on scroll, THEN click or hover to test for click- or hover-driven interactivity.
- Distinctive: line 166
Document the interaction model explicitly in the component spec: "INTERACTION MODEL: scroll-driven with IntersectionObserver" or …
- Very specific: line 195
Every builder agent must verify npx tsc --noEmit passes before finishing.
- Very specific: line 199
Every Playwriter command needs -s <SID> (substitute the integer returned by playwriter session new).
- Very specific: line 204
Never use @"..."@ (double-quoted here-string) for JS.
- Distinctive: line 325
Do elements animate into view?
- Distinctive: line 351
Every button, tab, pill, link, card
- Distinctive: line 359
Responsive sweep: Test at 3 viewport widths via Playwriter:
- Very specific: line 385
Download global assets: write and run a Node.js script (scripts/download-assets.mjs) that downloads all images, videos, and other binary …
- Very specific: line 511
Extract real content: all text, alt attributes, aria labels, placeholder text.
- Very specific: line 616
After each merge, verify the build still passes: npm run build
- Distinctive: line 617
If a merge introduces type errors, fix them immediately
- Very specific: line 623
After all sections are built and merged, wire everything together in src/pages/Home.tsx (or src/App.tsx if no router is in use):
- Distinctive: line 625
Import all section components
- Distinctive: line 629
Add a Framer Motion enter animation on the page root if the original has one
- Very specific: line 630
Verify: npm run build passes clean
- Distinctive: line 634
After assembly, do NOT declare the clone complete.
- Distinctive: line 650
Check the component spec file: was the value extracted correctly?
- Distinctive: line 651
If the spec was wrong: re-extract from Playwriter, update the spec, fix the component
- Distinctive: line 652
If the spec was right but the builder got it wrong: fix the component to match the spec
- Distinctive: line 654
Test all interactive behaviors via Playwriter on the clone tab: scroll through the page, click every button and tab, hover over interactive …
- Distinctive: line 656
Verify smooth scroll feels right, header transitions work, tab switching works, animations play.
- Distinctive: line 658
Only after this visual QA pass is the clone complete.
- Distinctive: line 692
When to invoke: ONLY when the user explicitly asks for tracking ("add the pixel", "add CAPI", "track leads", "server-side events").
- Distinctive: line 715
Before dispatching ANY builder agent, verify you can check every box.
- Distinctive: line 730
Before copying or scaffolding ANYTHING into a target folder, or deploying to any Pages project, run ALL of these checks.
- Distinctive: line 734
git init+ commit the destination BEFORE any copy or merge: if it is not already a repo. - Distinctive: line 750
Do not extract only the default state: If there are tabs showing "Featured" on load, click Productivity, Creative, Lifestyle and extract …
- Distinctive: line 758
Do not give a builder agent too much scope: If you are writing a builder prompt and it is getting long because the section is complex, that …
- Distinctive: line 760
Do not skip responsive extraction: If you only inspect at desktop width, the clone will break at tablet and mobile.
- Very specific: line 761
Do not forget smooth scroll libraries: Check for Lenis (.lenis class), Locomotive Scroll, or similar.
- Very specific: line 767
The filled
docs/RUNSHEET.md: every box checked with evidence, or explicitly marked skipped-with-reason (see Execution Contract.
“Common” is measured: kept by at least 6 in 10 of the 22 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Clone Website (Playwriter + PowerShell Edition)
You are about to reverse-engineer and rebuild $ARGUMENTS as pixel-perfect clones.
Environment assumption: Windows 11, PowerShell, Playwriter against the user's real Chrome browser. Every shell snippet in this skill is PowerShell. Do not translate to bash. If you find yourself reaching for export, $(...), or <<'EOF', stop: those are bash. Use $env:NAME = ..., (command), and @'...'@ here-strings instead. (On macOS or Linux, translate the shell snippets to bash. The browser-side JavaScript is identical.)
When multiple URLs are provided, process them independently and in parallel where possible, while keeping each site's extraction artifacts isolated in dedicated folders (for example, docs/research/<hostname>/).
This is not a two-phase process (inspect, then build). You are a foreman walking the job site: as you inspect each section of the page, you write a detailed specification to a file, then hand that file to a specialist builder agent with everything they need. Extraction and construction happen in parallel, but extraction is meticulous and produces auditable artifacts.
Scope Defaults
The target is whatever page $ARGUMENTS resolves to. Clone exactly what is visible at that URL. Unless the user specifies otherwise, use these defaults:
- Fidelity level: Pixel-perfect. Exact match in colors, spacing, typography, animations.
- In scope: Visual layout and styling, component structure and interactions, responsive design, mock data for demo purposes.
- Out of scope: Real backend / database, authentication, real-time features, SEO optimization, accessibility audit.
- Customization: None. Pure emulation.
- Link handling: A clone is almost always a homepage-only preview, so root-relative links to pages you did not build will 404. By default, rewrite every navigational link to an absolute URL on the original domain:
href="/x"becomeshref="https://<original-host>/x", including/#anchorlinks, the logo'shref="/", andhref="#"placeholders (which become the original homepage). Catch hrefs in both JSX attributes AND data arrays (href: '/x'), and do NOT rewrite non-href strings that merely start with/(for example a'/ mo'price suffix). Only keep links page-local when explicitly building the full multi-page site. (Buttons like "Watch demo" are not links. Leave them, or ask whether to wire them to the original.)
If the user provides additional instructions (specific fidelity level, customizations, extra context), honor those over the defaults.
Pre-Flight
- Playwriter is required. This skill drives the user's real Chrome browser via the Playwriter CLI. NOT Playwright, NOT a headless browser, NOT Chrome MCP. Verify with
playwriter --version. If missing, instruct the user to install:npm install -g playwriter@latest. Create a Playwriter session and capture the ID. Each
playwritercall needs-s <ID>to share state across calls:playwriter session new # Output is a single integer (e.g., 1). Note it. You will use it as <SID> for every subsequent call.Shell state does NOT persist between tool calls. Setting
$env:CLONE_SID = ...in one PowerShell call will NOT survive into the next. Either capture the integer and substitute it literally into every subsequent command (recommended), or chain everything in a single PowerShell call when feasible.In the rest of this skill,
<SID>is a placeholder. Replace it with the integer Playwriter returned.- Chrome must be running with the target tab enabled for Playwriter. If you get "extension is not connected" or "no browser tabs have Playwriter enabled":
- Ask the user to open Chrome and click the Playwriter extension icon on the target tab, OR
Launch Chrome with auto-accept flags:
Start-Process chrome.exe -ArgumentList '--profile-directory=Default --allowlisted-extension-id=jfeammnjpkecdekppnclgkkffahnhfhe --auto-accept-this-tab-capture'
Parse
$ARGUMENTSas one or more URLs. Normalize and validate each URL; if any are invalid, ask the user to correct them before proceeding. For each valid URL, verify it loads (substitute<SID>andURL_HERE):playwriter -s <SID> -e 'state.page = await context.newPage(); await state.page.goto("URL_HERE", { waitUntil: "networkidle" }); await state.page.title()'Verify the base project builds:
npm run build. The default expected scaffold is:- Framework: Vite + React + TypeScript strict (versions drift; trust the scaffold's
package.jsonover this list) - UI: shadcn/ui + Tailwind CSS v4 (OKLCH design tokens) + Framer Motion
- Routing: React Router
- Hosting: Cloudflare Pages (
npm run buildproducesdist/; deploy vianpx wrangler pages deploy dist --project-name <name> --branch main. The--branch mainis NOT optional, see Deploy safety. Alwaysnpx wrangler; wrangler is not a local dep.) - Dev server port: 5173 (Vite default)
Expected file layout for this skill:
index.html: root HTML,<link>font tags, favicons, metasrc/main.tsx: React entry; imports./index.csssrc/App.tsx: router rootsrc/index.css: Tailwind v4 entry. Importstailwindcss,shadcn/tailwind.css, font packages, and defines OKLCH design tokens inside:root { ... }and.dark { ... }blocks.src/pages/Home.tsx: the cloned page goes here (orsrc/App.tsxif no routing)src/components/: section components andicons.tsxsrc/types/: content interfacespublic/: downloaded images, videos, favicons (inpublic/seo/)
If no scaffold is present, scaffold one matching the above before continuing (
npm create vite@latest, then add Tailwind v4 and shadcn). If the user has explicitly directed a different stack (Next.js, Astro, plain Vite, etc.), honor that and adapt the file paths in this skill accordingly.- Framework: Vite + React + TypeScript strict (versions drift; trust the scaffold's
Create the output directories if they do not exist:
docs/research/,docs/research/components/,docs/design-references/,scripts/. PowerShell:'docs/research', 'docs/research/components', 'docs/design-references', 'scripts' | ForEach-Object { New-Item -ItemType Directory -Force -Path $_ | Out-Null }For multiple clones, also prepare per-site folders like
docs/research/<hostname>/anddocs/design-references/<hostname>/.- When working with multiple sites in one command, optionally confirm whether to run them in parallel (recommended, if resources allow) or sequentially to avoid overload. Each parallel site should get its OWN Playwriter session (
playwriter session new) so theirstate.pagereferences do not collide. Track each site's<SID>separately. Access gate: ask for everything up front, in ONE message. Every credential the run will eventually need gets requested or verified NOW, before Phase 1, in a single message, not discovered mid-run when it stops the world. Missing items do NOT block the start: record each one in
docs/RUNSHEET.mdasBLOCKER-AHEAD: <credential> blocks <step>and keep going until that step is actually reached.For a plain clone the list is short:
- Playwriter: already verified in item 1; note it here only if it failed and the user deferred fixing it.
- Cloudflare (only if the user asked to deploy):
npx wrangler whoamisucceeds; if multiple accounts,CLOUDFLARE_ACCOUNT_IDis set; target Pages project name checked againstpages project list(free vs. intended-existing). - Meta Pixel ID + Conversions API token (only if the user asked for tracking, see the optional add-on at the end): ask at kickoff, not launch week.
- Git remote / backup: optional but ask once. Without a remote, the whole deliverable exists on one disk.
Rule: ask once, list everything, accept partial answers, log the gaps. When a later step hits a
BLOCKER-AHEAD, that is a planned pause with a named owner, not a surprise stall.
Execution Contract: survive compaction, finish every step (MANDATORY)
A full run outlives several context compactions. Anything that lives only in the conversation, including your plan, WILL be summarized away mid-run. Two stores survive: the task list (lives outside the context window and is re-injected after compaction) and files on disk (survive compaction AND session death once committed). Use both, from minute one:
- Before any extraction work, create the run's tasks with
TaskCreate: one task per phase or step you intend to execute, IN ORDER, including the opt-in ones the user authorized (deploy, tracking add-on). Put the verification criterion in the task description, not just the step name. For example: "Phase 5: Visual QA, side-by-side vs original at 1440 and 390, all interactions tested". A post-compaction you then knows what "done" means, not just what the step was called. Markin_progresswhen starting a step,completedonly when its verification passed. Never batch-complete at the end. - Write
docs/RUNSHEET.mdin the deliverable repo at the same moment: the durable twin of the task list. One checkbox per step with an evidence line you fill as you go (commit hash, deployed URL, screenshot path). Commit it with each phase's commit. This is the source of truth when the task list and your memory disagree. Write excusable unchecked lines so a reader can parse them:skipped: <why>,BLOCKER-AHEAD: <credential> blocks <step> (owner: <who>),pending,deferred,n/a. A naked unchecked box is an unfinished run. - After ANY compaction: re-read
docs/RUNSHEET.mdand the task list BEFORE resuming work. The summary you wake up with is lossy. It routinely drops "not yet done" items and optional-but-authorized steps (real incident: the final step of a multi-day run was silently skipped across two compactions and nobody noticed until the user asked days later). The runsheet is what you promised; the summary is what you remember. Trust the runsheet. - The completion report REQUIRES the filled runsheet. Do not report the run done while any box is unchecked. Either finish the step or list it explicitly as "skipped because <user said so / blocked on X>".
- Scope the tasks at authorization time, not discovery time. When the user's phrasing opts into everything ("go all the way", "everything", "and deploy it"), enumerate ALL downstream steps as tasks immediately. A step that was never written down is a step that compaction will erase.
Guiding Principles
These are the truths that separate a successful clone from a "close enough" mess. Internalize them. They should inform every decision you make.
1. Completeness Beats Speed
Every builder agent must receive everything it needs to do its job perfectly: screenshot, exact CSS values, downloaded assets with local paths, real text content, component structure. If a builder has to guess anything (a color, a font size, a padding value) you have failed at extraction. Take the extra minute to extract one more property rather than shipping an incomplete brief.
2. Small Tasks, Perfect Results
When an agent gets "build the entire features section," it glosses over details. It approximates spacing, guesses font sizes, and produces something "close enough" but clearly wrong. When it gets a single focused component with exact CSS values, it nails it every time.
Look at each section and judge its complexity. A simple banner with a heading and a button? One agent. A complex section with 3 different card variants, each with unique hover states and internal layouts? One agent per card variant plus one for the section wrapper. When in doubt, make it smaller.
Complexity budget rule: If a builder prompt exceeds ~150 lines of spec content, the section is too complex for one agent. Break it into smaller pieces. This is a mechanical check. Do not override it with "but it's all related."
3. Real Content, Real Assets
Extract the actual text, images, videos, and SVGs from the live site. This is a clone, not a mockup. Use element.textContent, download every <img> and <video>, extract inline <svg> elements as React components. The only time you generate content is when something is clearly server-generated and unique per session.
Layered assets matter. A section that looks like one image is often multiple layers: a background watercolor or gradient, a foreground UI mockup PNG, an overlay icon. Inspect each container's full DOM tree and enumerate ALL <img> elements and background images within it, including absolutely-positioned overlays. Missing an overlay image makes the clone look empty even if the background is correct.
4. Foundation First
Nothing can be built until the foundation exists: global CSS with the target site's design tokens (colors, fonts, spacing), TypeScript types for the content structures, and global assets (fonts, favicons). This is sequential and non-negotiable. Everything after this can be parallel.
5. Extract How It Looks AND How It Behaves
A website is not a screenshot. It is a living thing. Elements move, change, appear, and disappear in response to scrolling, hovering, clicking, resizing, and time. If you only extract the static CSS of each element, your clone will look right in a screenshot but feel dead when someone actually uses it.
For every element, extract its appearance (exact computed CSS via getComputedStyle()) AND its behavior (what changes, what triggers the change, and how the transition happens). Not "it looks like 16px": extract the actual computed value. Not "the nav changes on scroll": document the exact trigger (scroll position, IntersectionObserver threshold, viewport intersection), the before and after states (both sets of CSS values), and the transition (duration, easing, CSS transition vs. JS-driven vs. CSS animation-timeline).
Examples of behaviors to watch for. These are illustrative, not exhaustive. The page may do things not on this list, and you must catch those too:
- A navbar that shrinks, changes background, or gains a shadow after scrolling past a threshold
- Elements that animate into view when they enter the viewport (fade-up, slide-in, stagger delays)
- Sections that snap into place on scroll (
scroll-snap-type) - Parallax layers that move at different rates than the scroll
- Hover states that animate (not just change: the transition duration and easing matter)
- Dropdowns, modals, accordions with enter/exit animations
- Scroll-driven progress indicators or opacity transitions
- Auto-playing carousels or cycling content
- Dark-to-light (or any theme) transitions between page sections
- Tabbed or pill content that cycles: buttons that switch visible card sets with transitions
- Scroll-driven tab or accordion switching: sidebars where the active item auto-changes as content scrolls past (IntersectionObserver, NOT click handlers)
- Smooth scroll libraries (Lenis, Locomotive Scroll): check for
.lenisclass or scroll container wrappers
6. Identify the Interaction Model Before Building
This is the single most expensive mistake in cloning: building a click-based UI when the original is scroll-driven, or vice versa. Before writing any builder prompt for an interactive section, you must definitively answer: Is this section driven by clicks, scrolls, hovers, time, or some combination?
How to determine this:
- Do not click first. Scroll through the section slowly via Playwriter and observe if things change on their own as you scroll.
- If they do, it is scroll-driven. Extract the mechanism:
IntersectionObserver,scroll-snap,position: sticky,animation-timeline, or JS scroll listeners. - If nothing changes on scroll, THEN click or hover to test for click- or hover-driven interactivity.
- Document the interaction model explicitly in the component spec: "INTERACTION MODEL: scroll-driven with IntersectionObserver" or "INTERACTION MODEL: click-to-switch with opacity transition."
A section with a sticky sidebar and scrolling content panels is fundamentally different from a tabbed interface where clicking switches content. Getting this wrong means a complete rewrite, not a CSS tweak.
7. Extract Every State, Not Just the Default
Many components have multiple visual states: a tab bar shows different cards per tab, a header looks different at scroll position 0 vs 100, a card has hover effects. You must extract ALL states, not just whatever is visible on page load.
For tabbed or stateful content:
- Click each tab or button via Playwriter (
state.page.click(selector)) - Extract the content, images, and card data for EACH state
- Record which content belongs to which state
- Note the transition animation between states (opacity, slide, fade, etc.)
For scroll-dependent elements:
- Capture computed styles at scroll position 0 (initial state)
- Scroll past the trigger threshold (
state.page.evaluate(() => window.scrollTo(0, 200))) and capture computed styles again (scrolled state) - Diff the two to identify exactly which CSS properties change
- Record the transition CSS (duration, easing, properties)
- Record the exact trigger threshold (scroll position in px, or viewport intersection ratio)
8. Spec Files Are the Source of Truth
Every component gets a specification file in docs/research/components/ BEFORE any builder is dispatched. This file is the contract between your extraction work and the builder agent. The builder receives the spec file contents inline in its prompt. The file also persists as an auditable artifact that the user (or you) can review if something looks wrong.
The spec file is not optional. It is not a nice-to-have. If you dispatch a builder without first writing a spec file, you are shipping incomplete instructions based on whatever you can remember from a Playwriter session, and the builder will guess to fill gaps.
9. Build Must Always Compile
Every builder agent must verify npx tsc --noEmit passes before finishing. After merging worktrees, you verify npm run build passes. A broken build is never acceptable, even temporarily.
Playwriter Mechanics Cheatsheet (PowerShell)
Every Playwriter command needs -s <SID> (substitute the integer returned by playwriter session new). The state object on the JS side persists across calls within the same session. Store the page there so you do not lose it.
Critical PowerShell quoting rules:
- For single-line JS: use single quotes around the
-eargument. Do not worry about$inside; PowerShell does not expand inside'...'. - For multi-line JS: use a single-quoted here-string
@'...'@. The closing'@MUST be at column 0 (no leading whitespace) on its own line, or PowerShell throws a parse error. - Never use
@"..."@(double-quoted here-string) for JS.$characters inside would get interpolated.
Navigate and persist the page:
playwriter -s <SID> -e 'state.page = await context.newPage(); await state.page.goto("https://example.com", { waitUntil: "networkidle" })'Take a full-page screenshot:
playwriter -s <SID> -e 'await state.page.screenshot({ path: "docs/design-references/desktop-full.png", fullPage: true })'Change viewport:
playwriter -s <SID> -e 'await state.page.setViewportSize({ width: 1440, height: 900 })'
playwriter -s <SID> -e 'await state.page.setViewportSize({ width: 390, height: 844 })'Scroll programmatically:
playwriter -s <SID> -e 'await state.page.evaluate(() => window.scrollTo({ top: 0, behavior: "instant" }))'
playwriter -s <SID> -e 'await state.page.evaluate(() => window.scrollTo({ top: 1000, behavior: "instant" }))'Click, hover:
playwriter -s <SID> -e 'await state.page.click("button.tab-pricing")'
playwriter -s <SID> -e 'await state.page.hover(".card-feature")'Run a non-trivial JS extraction (single-quoted here-string):
playwriter -s <SID> -e @'
const data = await state.page.evaluate(() => {
// any browser-context JS here
return { fonts: [...new Set([...document.querySelectorAll('*')].slice(0, 200).map(el => getComputedStyle(el).fontFamily))] };
});
console.log(JSON.stringify(data, null, 2));
'@Write extraction output to a file for later use:
playwriter -s <SID> -e @'
const data = await state.page.evaluate(() => { /* ... */ });
require('node:fs').writeFileSync('docs/research/assets.json', JSON.stringify(data, null, 2));
console.log('Wrote', Object.keys(data).length, 'keys');
'@Session reset if browser connection goes stale:
playwriter session reset <SID>List active sessions (when in doubt which <SID> to use):
playwriter session listField Notes (incident-born)
Hard-won gotchas from real clones. Read before starting; they save hours.
If you drive Playwriter via the mcp__playwriter__execute MCP tool instead of the CLI (cleaner; avoids PowerShell's native-arg quote-stripping that mangles goto("https://…") into a syntax error):
- Scope:
{page, state, context}are in scope. Onlystate.*persists between calls. Localconst/letare gone next call. Store results onstate, then read them back with a bare trailing expression (JSON.stringify(state.x)). Multi-statement snippets often return nothing; a single trailing expression returns its value. - No
//line comments. The tool wraps your code on one line inside(async()=>{…})(), so//comments out the closing braces and you get "Unexpected end of input". Use/* */or none. require('node:fs')is sandboxed to the relay's working directory. Absolute paths into a deeper project subdir throwEPERM: access outside allowed directories, but relative paths resolved under that root WORK.page.screenshot({path})/locator.screenshot({path})are NOT sandboxed; they write anywhere. Exploit this: serialize each section's cleaned HTML to disk via relativefswrites and screenshots to absolute paths, so extraction never bloats your context.
Downloading assets from a Next.js / SPA target:
- Direct subdirectory static URLs (
/problems/tabs.png) frequently return the SPA HTML shell (identical ~4KB files for every "image") instead of the asset: a routing catch-all. Tell: every PNG is the same byte size and starts with<!DOCTYPE html>. Root-level assets (logos, og-image, favicon) usually DO resolve directly. - Get the real raster via the optimizer:
https://<host>/_next/image?url=%2Fpath%2Ffile.png&w=1200&q=75with a browserUser-Agent+Accept: image/webp.qmust be allowed (default 75;q=90gives HTTP 400). Returns WebP. SVGs are not served by the optimizer: fetch root-level ones directly; sub-path SVGs may just be broken on the original (checknaturalWidth===0).
When the target is itself Tailwind/shadcn (very common): the DOM class names ARE the spec. Extract the site's :root/@theme CSS custom properties (often shadcn token names: --background, --primary, --sidebar, customs) for an exact palette, then serialize each section's cleaned outerHTML (de-proxy _next/image srcs to local /public paths, strip data-*, absolutize root-relative hrefs to the original domain per Scope Defaults, keep inline SVGs in place) to disk and hand builders that markup: near 1:1 JSX conversion, no hand-measuring. (Remember data-array hrefs render via href={x.href} and will not show up in an href=" grep. Check both.) Extract the real heading-font utility (on one clone it was a custom font-display mapped to Instrument Serif, NOT font-serif); if you do not define that exact utility token in your @theme, every heading silently falls back to the body font.
Builders without worktrees: git worktrees do not carry node_modules (gitignored), so per-worktree tsc fails. For a JS project it is simpler and faster to dispatch parallel builders that each create ONE disjoint component file in the shared dir (shared node_modules), forbid them from running npm/tsc/vite (concurrent runs see each other's half-written files), and run ONE authoritative npm run build yourself after they return. Disjoint files = zero merge conflicts. Worked first try for 13 components.
Phase 5 QA with the dev server running: Vite's HMR websocket never goes network-idle, which makes mcp__playwriter__execute calls with trailing evaluate/return hang or time out, but the screenshot({path}) inside them still lands on disk first. So: keep each QA call to a single screenshot op and Read the file from disk (ignore the timeout). Avoid waitUntil:"networkidle" on the clone; use domcontentloaded + a fixed wait. Full-page screenshots of very tall mobile pages can fail with "Unable to capture screenshot" (exceeds capture limits). Capture viewport crops at scroll positions instead, or reset the connection.
Playwriter bakes its own UI into screenshots. Because it drives the user's real Chrome, its injected elements are part of the page: the ghost cursor (#__playwriter_ghost_cursor__) and a floating toolbar (an unnamed position:fixed div at z-index 2147483647, direct child of <html>) appear in every capture, plus any third-party extension nodes. Fine for your own QA reads; NOT fine for screenshots that ship in a deliverable. Before deliverable captures, inject once per navigation:
await page.addStyleTag({ content: '#__playwriter_ghost_cursor__, html > div { display:none !important } html, body { scrollbar-width:none !important } ::-webkit-scrollbar { display:none !important }' })(html > div is safe. React mounts in #root under <body>; only injected overlays live as direct <html> children.)
Do not screenshot with animations: "disabled" on pages using enter animations (framer-motion Reveal etc.). It freezes animations at their INITIAL state, opacity ~0, so sections render as washed-out ghosts. Correct pattern for deliverable captures: let animations run, wait 2 to 3 s after networkidle, then screenshot. Reserve animations: "disabled" for pages with infinite animations (counters, pulsing dots) that never settle, and eyeball the result.
Phase 1: Reconnaissance
Navigate to the target URL with Playwriter (using the snippet above to assign state.page).
Screenshots
- Take full-page screenshots at desktop (1440px) and mobile (390px) viewports
- Save to
docs/design-references/with descriptive names - These are your master reference. Builders will receive section-specific crops later.
# Desktop
playwriter -s <SID> -e 'await state.page.setViewportSize({ width: 1440, height: 900 }); await state.page.screenshot({ path: "docs/design-references/desktop-full.png", fullPage: true })'
# Mobile
playwriter -s <SID> -e 'await state.page.setViewportSize({ width: 390, height: 844 }); await state.page.screenshot({ path: "docs/design-references/mobile-full.png", fullPage: true })'Global Extraction
Extract these from the page before doing anything else:
Fonts: Inspect <link> tags for Google Fonts or self-hosted fonts. Check computed font-family on key elements (headings, body, code, labels). Document every family, weight, and style actually used. Install via @fontsource-variable/<name> packages and import them at the top of src/index.css, or add <link> tags to index.html for Google Fonts CDN delivery.
Colors: Extract the site's color palette from computed styles across the page. Update src/index.css: add the target's actual colors as OKLCH tokens inside the :root { ... } and .dark { ... } blocks. Map them to shadcn's token names (--background, --foreground, --primary, --muted, etc.) where they fit. Add custom --<name> properties for colors that do not map to shadcn tokens. Prefer OKLCH (e.g., oklch(0.48 0.24 300)) over hex; convert hex to OKLCH if needed.
Favicons & Meta: Download the TARGET site's favicons, apple-touch-icons, OG image, and webmanifest to public/seo/, and update <link rel="icon">, <meta>, and <title> in index.html. ALWAYS also ship a real /favicon.ico at the public/ root and link it FIRST (<link rel="icon" href="/favicon.ico" sizes="any"> + <link rel="shortcut icon" href="/favicon.ico">, then the PNG <link>s). This is non-negotiable and incident-born ("you are inheriting the logo of the wrong company"): browsers hard-request /favicon.ico before parsing HTML, and PNG-only <link>s do NOT satisfy that request. When it 404s, Chrome silently shows whatever favicon it cached for that origin, and every clone reuses the same localhost:xxxx and *.pages.dev origins, so the tab shows a PREVIOUS project's logo. How to get the real .ico: most WordPress/CMS sites serve their site-icon at /favicon.ico (often 200 image/png), so fetch that; otherwise wrap the 32x32 PNG in a minimal ICO (6-byte ICONDIR 00 00 01 00 01 00 + 16-byte dir entry + the PNG bytes; browsers accept PNG-in-ICO). Confirm the icon is genuinely the cloned brand (open the PNG and look), and verify post-deploy with fetch('/favicon.ico') returning 200 + real byte count.
Global UI patterns: Identify any site-wide CSS or JS: custom scrollbar hiding, scroll-snap on the page container, global keyframe animations, backdrop filters, gradients used as overlays, smooth scroll libraries (Lenis, Locomotive Scroll: check for .lenis, .locomotive-scroll, or custom scroll container classes). Add these to src/index.css and note any libraries that need to be installed.
Mandatory Interaction Sweep
This is a dedicated pass AFTER screenshots and BEFORE anything else. Its purpose is to discover every behavior on the page, many of which are invisible in a static screenshot.
Scroll sweep: Scroll the page slowly from top to bottom via Playwriter. At each section, pause and observe:
- Does the header change appearance? Record the scroll position where it triggers.
- Do elements animate into view? Record which ones and the animation type.
- Does a sidebar or tab indicator auto-switch as you scroll? Record the mechanism.
- Are there scroll-snap points? Record which containers.
- Is there a smooth scroll library active? Check for non-native scroll behavior.
A useful one-shot scroll sweep that captures header CSS at intervals:
playwriter -s <SID> -e @'
const samples = [];
for (const y of [0, 100, 300, 600, 1200, 2400]) {
await state.page.evaluate((y) => window.scrollTo({ top: y, behavior: 'instant' }), y);
await new Promise(r => setTimeout(r, 400));
const headerCss = await state.page.evaluate(() => {
const header = document.querySelector('header, nav, [role="banner"]');
if (!header) return null;
const cs = getComputedStyle(header);
return { backgroundColor: cs.backgroundColor, boxShadow: cs.boxShadow, height: cs.height, backdropFilter: cs.backdropFilter, transform: cs.transform };
});
samples.push({ scrollY: y, headerCss });
}
console.log(JSON.stringify(samples, null, 2));
'@Click sweep: Click every element that looks interactive:
- Every button, tab, pill, link, card
- Record what happens: does content change? Does a modal open? Does a dropdown appear?
- For tabs and pills: click EACH ONE and record the content that appears for each state
Hover sweep: Hover over every element that might have hover states:
- Buttons, cards, links, images, nav items
- Record what changes: color, scale, shadow, underline, opacity
Responsive sweep: Test at 3 viewport widths via Playwriter:
- Desktop: 1440px
- Tablet: 768px
- Mobile: 390px
- At each width, note which sections change layout (columns to stack, sidebar disappears, etc.) and at approximately which breakpoint the change occurs.
Save all findings to docs/research/BEHAVIORS.md. This is your behavior bible. Reference it when writing every component spec.
Page Topology
Map out every distinct section of the page from top to bottom. Give each a working name. Document:
- Their visual order
- Which are fixed or sticky overlays vs. flow content
- The overall page layout (scroll container, column structure, z-index layers)
- Dependencies between sections (e.g., a floating nav that overlays everything)
- The interaction model of each section (static, click-driven, scroll-driven, time-driven)
Save this as docs/research/PAGE_TOPOLOGY.md. It becomes your assembly blueprint.
Phase 2: Foundation Build
This is sequential. Do it yourself (not delegated to an agent) since it touches many files:
- Wire up fonts: install
@fontsource-variable/<name>packages (or add<link>tags toindex.html) and import them at the top ofsrc/index.css. Match every family, weight, and style observed on the target. - Update
src/index.csswith the target's OKLCH color tokens (in:rootand.darkblocks), spacing values, keyframe animations, utility classes, and any global scroll behaviors (Lenis, smooth scroll CSS, scroll-snap on body) - Create TypeScript interfaces in
src/types/for the content structures you have observed - Extract SVG icons: find all inline
<svg>elements on the page, deduplicate them, and save as named React components insrc/components/icons.tsx. Name them by visual function (e.g.,SearchIcon,ArrowRightIcon,LogoIcon). - Download global assets: write and run a Node.js script (
scripts/download-assets.mjs) that downloads all images, videos, and other binary assets from the page topublic/. Preserve meaningful directory structure. - Verify:
npm run buildpasses
Asset Discovery Script (run via Playwriter)
playwriter -s <SID> -e @'
const inventory = await state.page.evaluate(() => ({
images: [...document.querySelectorAll('img')].map(img => ({
src: img.src || img.currentSrc,
alt: img.alt,
width: img.naturalWidth,
height: img.naturalHeight,
parentClasses: img.parentElement?.className,
siblings: img.parentElement ? [...img.parentElement.querySelectorAll('img')].length : 0,
position: getComputedStyle(img).position,
zIndex: getComputedStyle(img).zIndex
})),
videos: [...document.querySelectorAll('video')].map(v => ({
src: v.src || v.querySelector('source')?.src,
poster: v.poster,
autoplay: v.autoplay,
loop: v.loop,
muted: v.muted
})),
backgroundImages: [...document.querySelectorAll('*')].filter(el => {
const bg = getComputedStyle(el).backgroundImage;
return bg && bg !== 'none';
}).map(el => ({
url: getComputedStyle(el).backgroundImage,
element: el.tagName + '.' + (el.className?.toString().split(' ')[0] || '')
})),
svgCount: document.querySelectorAll('svg').length,
fonts: [...new Set([...document.querySelectorAll('*')].slice(0, 200).map(el => getComputedStyle(el).fontFamily))],
favicons: [...document.querySelectorAll('link[rel*="icon"]')].map(l => ({ href: l.href, sizes: l.sizes?.toString() }))
}));
require('node:fs').writeFileSync('docs/research/asset-inventory.json', JSON.stringify(inventory, null, 2));
console.log('Inventory:', inventory.images.length, 'images,', inventory.videos.length, 'videos,', inventory.backgroundImages.length, 'bg-images,', inventory.svgCount, 'svgs');
'@Then write a download script that fetches everything to public/. Use batched parallel downloads (4 at a time) with proper error handling.
Phase 3: Component Specification & Dispatch
This is the core loop. For each section in your page topology (top to bottom), you do THREE things: extract, write the spec file, then dispatch builders.
Step 1: Extract
For each section, use Playwriter to extract everything:
Screenshot the section in isolation. Scroll the section into view, then screenshot the viewport (or a clipped region). Save to
docs/design-references/.playwriter -s <SID> -e 'await state.page.locator("section.hero").scrollIntoViewIfNeeded(); await state.page.screenshot({ path: "docs/design-references/hero.png", clip: await state.page.locator("section.hero").boundingBox() })'Extract CSS for every element in the section. Use the extraction script below. Do not hand-measure individual properties. Run it once per component container and capture the full output (substitute
SELECTOR_HERE):playwriter -s <SID> -e @' const tree = await state.page.evaluate((selector) => { const el = document.querySelector(selector); if (!el) return { error: 'Element not found: ' + selector }; const props = [ 'fontSize','fontWeight','fontFamily','lineHeight','letterSpacing','color', 'textTransform','textDecoration','backgroundColor','background', 'padding','paddingTop','paddingRight','paddingBottom','paddingLeft', 'margin','marginTop','marginRight','marginBottom','marginLeft', 'width','height','maxWidth','minWidth','maxHeight','minHeight', 'display','flexDirection','justifyContent','alignItems','gap', 'gridTemplateColumns','gridTemplateRows', 'borderRadius','border','borderTop','borderBottom','borderLeft','borderRight', 'boxShadow','overflow','overflowX','overflowY', 'position','top','right','bottom','left','zIndex', 'opacity','transform','transition','cursor', 'objectFit','objectPosition','mixBlendMode','filter','backdropFilter', 'whiteSpace','textOverflow','WebkitLineClamp' ]; const extractStyles = (element) => { const cs = getComputedStyle(element); const styles = {}; props.forEach(p => { const v = cs[p]; if (v && v !== 'none' && v !== 'normal' && v !== 'auto' && v !== '0px' && v !== 'rgba(0, 0, 0, 0)') styles[p] = v; }); return styles; }; const walk = (element, depth) => { if (depth > 4) return null; const children = [...element.children]; return { tag: element.tagName.toLowerCase(), classes: element.className?.toString().split(' ').slice(0, 5).join(' '), text: element.childNodes.length === 1 && element.childNodes[0].nodeType === 3 ? element.textContent.trim().slice(0, 200) : null, styles: extractStyles(element), images: element.tagName === 'IMG' ? { src: element.src, alt: element.alt, naturalWidth: element.naturalWidth, naturalHeight: element.naturalHeight } : null, childCount: children.length, children: children.slice(0, 20).map(c => walk(c, depth + 1)).filter(Boolean) }; }; return walk(el, 0); }, 'SELECTOR_HERE'); require('node:fs').writeFileSync('docs/research/components/SELECTOR_HERE.json', JSON.stringify(tree, null, 2)); console.log('Extracted', JSON.stringify(tree).length, 'bytes'); '@Extract multi-state styles: for any element with multiple states (scroll-triggered, hover, active tab), capture BOTH states by triggering the state change between extractions:
# State A: capture playwriter -s <SID> -e 'await state.page.evaluate(() => window.scrollTo(0, 0))' # ... run extraction script, save as state-a.json # Trigger transition (choose one) playwriter -s <SID> -e 'await state.page.evaluate(() => window.scrollTo(0, 500))' # OR: playwriter -s <SID> -e 'await state.page.click("button.tab-pricing")' # OR: playwriter -s <SID> -e 'await state.page.hover(".card-feature")' # Wait for CSS transitions to finish before re-extracting playwriter -s <SID> -e 'await new Promise(r => setTimeout(r, 600))' # State B: capture # ... run extraction script, save as state-b.jsonRecord the diff explicitly: "Property X changes from VALUE_A to VALUE_B, triggered by TRIGGER, with transition: TRANSITION_CSS."
- Extract real content: all text, alt attributes, aria labels, placeholder text. Use
element.textContentfor each text node. For tabbed or stateful content, click each tab viastate.page.click()and extract content per state. - Identify assets this section uses: which downloaded images or videos from
public/, which icon components fromicons.tsx. Check for layered images (multiple<img>or background-images stacked in the same container). - Assess complexity: how many distinct sub-components does this section contain? A distinct sub-component is an element with its own unique styling, structure, and behavior (e.g., a card, a nav item, a search panel).
Step 2: Write the Component Spec File
For each section (or sub-component, if you are breaking it up), create a spec file in docs/research/components/. This is NOT optional. Every builder must have a corresponding spec file.
File path: docs/research/components/<component-name>.spec.md
Template:
# <ComponentName> Specification
## Overview
- **Target file:** `src/components/<ComponentName>.tsx`
- **Screenshot:** `docs/design-references/<screenshot-name>.png`
- **Interaction model:** <static | click-driven | scroll-driven | time-driven>
## DOM Structure
<Describe the element hierarchy: what contains what>
## Computed Styles (exact values from getComputedStyle)
### Container
- display: ...
- padding: ...
- maxWidth: ...
- (every relevant property with exact values)
### <Child element 1>
- fontSize: ...
- color: ...
- (every relevant property)
### <Child element N>
...
## States & Behaviors
### <Behavior name, e.g., "Scroll-triggered floating mode">
- **Trigger:** <exact mechanism: scroll position 50px, IntersectionObserver rootMargin "-30% 0px", click on .tab-button, hover>
- **State A (before):** maxWidth: 100vw, boxShadow: none, borderRadius: 0
- **State B (after):** maxWidth: 1200px, boxShadow: 0 4px 20px rgba(0,0,0,0.1), borderRadius: 16px
- **Transition:** transition: all 0.3s ease
- **Implementation approach:** <CSS transition + scroll listener | IntersectionObserver | CSS animation-timeline | etc.>
### Hover states
- **<Element>:** <property>: <before> to <after>, transition: <value>
## Per-State Content (if applicable)
### State: "Featured"
- Title: "..."
- Subtitle: "..."
- Cards: [{ title, description, image, link }, ...]
### State: "Productivity"
- Title: "..."
- Cards: [...]
## Assets
- Background image: `public/images/<file>.webp`
- Overlay image: `public/images/<file>.png`
- Icons used: <ArrowIcon>, <SearchIcon> from icons.tsx
## Text Content (verbatim)
<All text content, copy-pasted from the live site>
## Responsive Behavior
- **Desktop (1440px):** <layout description>
- **Tablet (768px):** <what changes, e.g., "maintains 2-column, gap reduces to 16px">
- **Mobile (390px):** <what changes, e.g., "stacks to single column, images full-width">
- **Breakpoint:** layout switches at ~<N>pxFill every section. If a section does not apply (e.g., no states for a static footer), write "N/A", but think twice before marking States & Behaviors as N/A. Even a footer might have hover states on links.
Step 3: Dispatch Builders
Based on complexity, dispatch builder agent(s) in worktree(s) via the Agent tool:
Simple section (1 to 2 sub-components): One builder agent gets the entire section.
Complex section (3+ distinct sub-components): Break it up. One agent per sub-component, plus one agent for the section wrapper that imports them. Sub-component builders go first since the wrapper depends on them.
What every builder agent receives:
- The full contents of its component spec file (inline in the prompt; do not say "go read the spec file")
- Path to the section screenshot in
docs/design-references/ - Which shared components to import (
icons.tsx,cn(), shadcn primitives) - The target file path (e.g.,
src/components/HeroSection.tsx) - Instruction to verify with
npx tsc --noEmitbefore finishing - For responsive behavior: the specific breakpoint values and what changes
- Use
isolation: "worktree"on the Agent call so each builder gets its own git worktree and they cannot trample each other (or use the disjoint-files pattern from Field Notes)
Do not wait. As soon as you have dispatched the builder(s) for one section, move to extracting the next section. Builders work in parallel while you continue extraction via Playwriter.
Step 4: Merge
As builder agents complete their work:
- Merge their worktree branches into main
- You have full context on what each agent built, so resolve any conflicts intelligently
- After each merge, verify the build still passes:
npm run build - If a merge introduces type errors, fix them immediately
The extract, spec, dispatch, merge cycle continues until all sections are built.
Phase 4: Page Assembly
After all sections are built and merged, wire everything together in src/pages/Home.tsx (or src/App.tsx if no router is in use):
- Import all section components
- Implement the page-level layout from your topology doc (scroll containers, column structures, sticky positioning, z-index layering)
- Connect real content to component props
- Implement page-level behaviors: scroll snap, scroll-driven animations, dark-to-light transitions, intersection observers, smooth scroll (Lenis etc.)
- Add a Framer Motion enter animation on the page root if the original has one
- Verify:
npm run buildpasses clean
Phase 5: Visual QA Diff
After assembly, do NOT declare the clone complete. Take side-by-side comparison screenshots via Playwriter:
- Open the clone in a second tab (or new context page) and the original in the existing tab. Vite's dev server runs on port 5173 by default:
playwriter -s <SID> -e 'state.cloneTab = await context.newPage(); await state.cloneTab.goto("http://localhost:5173", { waitUntil: "domcontentloaded" })' - Screenshot both at the same viewport widths:
playwriter -s <SID> -e 'await state.page.setViewportSize({ width: 1440, height: 900 }); await state.page.screenshot({ path: "docs/qa/original-desktop.png", fullPage: true })' playwriter -s <SID> -e 'await state.cloneTab.setViewportSize({ width: 1440, height: 900 }); await state.cloneTab.screenshot({ path: "docs/qa/clone-desktop.png", fullPage: true })' - Compare section by section, top to bottom, at desktop (1440px). Repeat at mobile (390px).
- For each discrepancy found:
- Check the component spec file: was the value extracted correctly?
- If the spec was wrong: re-extract from Playwriter, update the spec, fix the component
- If the spec was right but the builder got it wrong: fix the component to match the spec
- Test all interactive behaviors via Playwriter on the clone tab: scroll through the page, click every button and tab, hover over interactive elements.
- Verify smooth scroll feels right, header transitions work, tab switching works, animations play.
Only after this visual QA pass is the clone complete.
Deployment & Verification (Cloudflare Pages): checklist-gated, opt-in
Shipping is NOT part of a default clone (Phase 5 is the visual endpoint), but when the user asks to deploy, treat these three checklists as hard gates: do not report "deployed" until every Post-deploy box is ticked, and report the filled checklist back to the user. (Every item below is incident-born. A clone can build green and still ship with links pointing nowhere, "images" that are actually HTML 404 shells, or an SPA that returns 200 yet never mounts.)
Pre-deploy gate
npm run buildANDnpx tsc --noEmitpass with zero errors- Links audited & intentional: every
hrefresolves where it should. For a homepage-only clone, root-relative links to routes you did not build are absolutized to the original domain (see Scope Defaults). Grep BOTHhref="…"attributes AND data-arrayhref: '…'values; never rewrite non-href strings (e.g.'/ mo'). - No phantom assets: every
<img>/ background resolves to a real file in/public. A row of identical ~4 KB files = HTML-shell 404s, not images. Favicon + OG image present. - Favicon is the TARGET brand, served at
/favicon.ico: a real.icoexists at thepublic/root (not just PNG<link>s) and is linked first; post-deployfetch('/favicon.ico')returns 200 with real bytes. Confirm it is the cloned company's icon, NOT the scaffold donor's (see scaffold pre-flight #8). Missing.ico= the browser tab shows a cached wrong-company logo. - Fonts load as the real families (the custom heading utility too), not the fallback.
- Responsive sane at 1440 / 768 / 390; interactive behaviors (scroll states, hovers) work locally.
noindexdecided. A pixel-perfect clone deployed to*.pages.devor a subdomain is near-duplicate content against the original site. If it is a demo or a paid-traffic landing page, ship<meta name="robots" content="noindex, nofollow">statically inindex.html. Ask which the site is (demo / lead-capture subdomain / production replacement) before deploying; the answer changes the index policy.
Deploy safety (never clobber)
npx wrangler whoamisucceeds. If the login has multiple accounts, setCLOUDFLARE_ACCOUNT_ID=<id>(wrangler cannot choose in non-interactive mode and will error).npx wrangler pages project listFIRST: confirm the target project name is free (new) or is the intended existing one. A populated custom-domain column = a LIVE production project; never blind-createover it (a failedcreateyou pipe past is exactly how a live site gets replaced). If recovery is needed, previous deployments are immutable at<hash>.<project>.pages.devand roll back via the Cloudflare API.- Deploy a fresh build: run
npm run buildimmediately beforenpx wrangler pages deploy dist --project-name <name> --branch main --commit-dirty=true. --branch mainis load-bearing, not decoration. Wrangler infers the deploy branch from git, and these repos are often onmasterwhile the Pages production branch ismain. A bare deploy silently ships a PREVIEW that still prints "Deployment complete!" with a working hashed URL (incident: production sat 9 hours stale across two "successful" deploys). Best practice: add"deploy": "npm run build && npx wrangler pages deploy dist --project-name <name> --branch main"topackage.jsonand only ever deploy vianpm run deploy.- Gate the deploy on the build's exit code. In PowerShell,
npm run build; wrangler pages deploy distdoes NOT short-circuit: a build that fails on a TypeScript error still deploys the previousdistand prints "Deployment complete". Usenpm run build; if ($LASTEXITCODE -eq 0) { ...deploy... }, or thenpm run deployscript which chains with&&.
Post-deploy proof (do not claim success without these)
- Production actually changed: the entry-chunk hash in local
dist/index.html(grep -o 'assets/index-[^"]*\.js' dist/index.html) matches what the production alias (https://<project>.pages.dev/) serves, andnpx wrangler pages deployment listshows the new deploy withEnvironment: Production. A mismatch = you shipped a preview. Pages serves HTML withmax-age=0, must-revalidate, so a stale chunk hash is a deploy problem, not a cache one. - Live URL returns HTTP 200 with the correct
<title>(curl / Invoke-WebRequest). But on an SPA with a/* /index.html 200fallback, every route returns 200. An HTTP 200 never proves a route exists, and an unmatched React Router route renders an empty#rootwith NO console error. Check the DOM. - The app actually RENDERS: load it in a real browser and screenshot the mounted SPA. A 200 on the HTML shell is the loader, NOT proof it works.
- Rendered links resolve to their intended targets: pull
[...document.querySelectorAll('a[href]')].map(a=>a.href)from the LIVE DOM and assert (source-correct is not deployed-correct). The hashed deploy URL is fine for content QA like this (it dodges CDN-cache lag), but NEVER as proof the deploy reached production; it always serves what you just uploaded regardless of environment. - No console errors on load (attach a
page.on('console')listener before navigating). - Mobile renders (viewport crop at 390; tall full-page captures can fail with "Unable to capture screenshot").
- Live-vs-local section-by-section screenshot compare; no regressions.
- Report BOTH the production alias (
<project>.pages.dev) and the immutable deploy URL (<hash>.<project>.pages.dev).
Optional add-on: Meta Pixel + Conversions API (no database)
When to invoke: ONLY when the user explicitly asks for tracking ("add the pixel", "add CAPI", "track leads", "server-side events"). Do NOT auto-run as part of a bare clone. Phase 5 is the natural endpoint for a plain visual clone.
What it adds, with zero backend and zero database:
- The browser Meta Pixel, loaded once at the app root.
- A shared
event_idper conversion so the browser event and the server event deduplicate in Meta. - One Cloudflare Pages Function (
functions/api/capi.ts) that forwards the conversion to Meta's Conversions API with the token held as a server-side environment secret. The token never reaches the browser. - First-touch UTM and click-id capture (
fbclid,_fbp,_fbc) so a form submit carries attribution.
Full steps, templates and the verification checklist: read addons/meta-tracking.md in this skill folder. Templates are at addons/. Do NOT inline their contents here.
Hard rules that survived real launches:
- Prove pixel work on the deployed https origin, never localhost. Meta does not register browser pixel events from
http://localhost:5173. A "successful" dedup test from the dev server shows up in Events Manager as Conversions API only. The tell: a genuine dual-source event shows Integration = Multiple. - Nothing calls the pixel loader by accident. Exporting
loadMetaPixelis not the same as calling it. Load the page and checktypeof window.fbqin the console. Code review does not catch this; the browser does. - Never send real conversion events into someone else's live pixel during QA without asking. Use a test event code in Events Manager.
What this skill deliberately does NOT do
- No database, no admin panel, no CMS. A form that saves leads, a dashboard, page toggles or per-page SEO editing all need a backend with tenant isolation, auth and row-level security. That is a separate system with its own security surface, and it does not belong inside a cloning skill. If you need it, build it as its own project on top of the clone.
- No lead storage. The optional add-on forwards a conversion to Meta and stops. If leads must be saved, POST them from the same Pages Function to a CRM webhook, a Google Sheet endpoint, or an ESP API. Keep the receiver's credentials in Cloudflare environment secrets.
- No blog, no funnel generation, no A/B engine. Separate concerns, separate skills.
Pre-Dispatch Checklist
Before dispatching ANY builder agent, verify you can check every box. If you cannot, go back and extract more.
- Spec file written to
docs/research/components/<name>.spec.mdwith ALL sections filled - Every CSS value in the spec is from
getComputedStyle(), not estimated - Interaction model is identified and documented (static / click / scroll / time)
- For stateful components: every state's content and styles are captured
- For scroll-driven components: trigger threshold, before/after styles, and transition are recorded
- For hover states: before/after values and transition timing are recorded
- All images in the section are identified (including overlays and layered compositions)
- Responsive behavior is documented for at least desktop and mobile
- Text content is verbatim from the site, not paraphrased
- The builder prompt is under ~150 lines of spec; if over, the section needs to be split
Scaffolding Into a Folder: MANDATORY Pre-Flight (incident-born)
Before copying or scaffolding ANYTHING into a target folder, or deploying to any Pages project, run ALL of these checks. A real incident overwrote a hand-built production homepage because every one of these was skipped:
- Prove the destination state with the shell, not Glob.
Test-Path <folder>+Get-ChildItem <folder> -Recurse -File | Select -First 30. Glob can false-negative on Windows path+pattern combos. It returned "No files found" for a folder that contained 240 files. If the shell is unavailable, WAIT and retry; do not substitute a weaker check and proceed. - If the destination exists and is non-empty, STOP. Show the user what is there and ask. Never assume "no website yet" because a search came back empty.
git init+ commit the destination BEFORE any copy or merge if it is not already a repo. This makes every later mistake reversible.- Read robocopy's exit code bits. Bit 2 (exit codes 2/3/6/7) = EXTRA files exist in the destination = the folder was NOT empty. Treat it as a stop-and-inspect signal, not a success.
- Never deploy over an existing Pages project blind.
npx wrangler pages project listFIRST. If the project already exists (check Project Domains for custom domains = it is live production!), list its deployments before touching it. A failedwrangler pages project create("already exists") that you pipe away is exactly how you replace a production site. - Recovery if production was overwritten: previous Pages deployments are immutable and still served at
https://<short-id>.<project>.pages.dev. Roll back via the Cloudflare dashboard (Deployments, Rollback) or the API endpointPOST accounts/{account}/pages/projects/{project}/deployments/{id}/rollback. - Brownfield = additive only. When a site already exists (any framework; check for
astro.config.mjs,next.config.*, etc., not just the expected stack), additions go in as new routes and files in the existing framework and visual identity. Never replace the homepage, never rebrand, never delete components, even ones that look like leftovers, without explicit user confirmation per file. - Purge the DONOR scaffold's branding. You inherit it silently. When you scaffold by copying another project's clone (the fast path: reuse their Vite/React/Tailwind config), you also copy their
public/favicon.ico,public/seo/*, logos, OG image,index.html<title>/meta/favicon links, and any hardcoded brand images. These do NOT show up in agrepfor the donor's name and the build stays green, so the wrong company's favicon or OG ships unnoticed. After any scaffold-copy, immediately: (a) remove the donor'spublic/favicon.ico,public/seo/*, and donor logo files; (b) rewrite theindex.htmlhead (title, meta, ALL favicon/OG links) for the target; (c)grep -rithe donor slug acrosssrc/ public/ index.htmland purge hits; (d) re-download the target's favicon/OG/logos (see Phase 1, Favicons & Meta) and regenerate/favicon.ico. Treat "did I inherit the donor's icon/OG?" as a required checklist item, not an afterthought.
What NOT to Do
These are lessons from previous failed clones. Each one cost hours of rework:
- Do not use bash syntax. This skill is PowerShell-only. No
export, no$(...), no<<'EOF'heredocs. Use$env:NAME = ...,(command), and@'...'@here-strings. - Do not use Playwright, Chrome MCP, or any headless browser. This skill assumes Playwriter against the user's real Chrome. Other tools have different quirks and the snippets in this skill will not work with them.
- Do not rely on shell variables persisting across tool calls. PowerShell state (including
$env:) does NOT carry between separate tool invocations. Capture the session ID once and substitute it literally into every subsequent command. - Do not put the closing
'@indented. PowerShell here-string termination requires'@at column 0. Indenting it is a parse error. - Do not build click-based tabs when the original is scroll-driven (or vice versa). Determine the interaction model FIRST by scrolling before clicking. This is the #1 most expensive cloning mistake. It requires a complete rewrite, not a CSS fix.
- Do not extract only the default state. If there are tabs showing "Featured" on load, click Productivity, Creative, Lifestyle and extract each one's cards and content. If the header changes on scroll, capture styles at position 0 AND position 100+.
- Do not miss overlay or layered images. A background watercolor + foreground UI mockup = 2 images. Check every container's DOM tree for multiple
<img>elements and positioned overlays. - Do not build mockup components for content that is actually videos or animations. Check if a section uses
<video>, Lottie, or canvas before building elaborate HTML mockups of what the video shows. - Do not approximate CSS classes. "It looks like
text-lg" is wrong if the computed value is18pxandtext-lgis18px/28pxbut the actual line-height is24px. Extract exact values. - Do not build everything in one monolithic commit. The whole point of this pipeline is incremental progress with verified builds at each step.
- Do not reference docs from builder prompts. Each builder gets the CSS spec inline in its prompt. Never "see DESIGN_TOKENS.md for colors." The builder should have zero need to read external docs.
- Do not skip asset extraction. Without real images, videos, and fonts, the clone will always look fake regardless of how perfect the CSS is.
- Do not ship the donor scaffold's favicon, logo or OG, and do not rely on PNG favicon
<link>s alone. If you scaffolded from another project's clone you have inherited THEIRfavicon.ico/seo/*/OG. Purge it (see scaffold pre-flight #8). And always ship a real/favicon.icoat the public root (browsers hard-request it; a 404 makes the tab show a cached wrong-company icon). Open the favicon PNG and confirm it is the cloned brand before shipping. - Do not give a builder agent too much scope. If you are writing a builder prompt and it is getting long because the section is complex, that is a signal to break it into smaller tasks.
- Do not bundle unrelated sections into one agent. A CTA section and a footer are different components with different designs. Do not hand them both to one agent and hope for the best.
- Do not skip responsive extraction. If you only inspect at desktop width, the clone will break at tablet and mobile. Test at 1440, 768, and 390 during extraction.
- Do not forget smooth scroll libraries. Check for Lenis (
.lenisclass), Locomotive Scroll, or similar. Default browser scrolling feels noticeably different and the user will spot it immediately. - Do not dispatch builders without a spec file. The spec file forces exhaustive extraction and creates an auditable artifact. Skipping it means the builder gets whatever you can fit in a prompt from memory.
Completion
When done, report:
- The filled
docs/RUNSHEET.md: every box checked with evidence, or explicitly marked skipped-with-reason (see Execution Contract; do not report done otherwise) - Total sections built
- Total components created
- Total spec files written (should match components)
- Total assets downloaded (images, videos, SVGs, fonts)
- Build status (
npm run buildresult) - Visual QA results (any remaining discrepancies)
- Any known gaps or limitations
- The Playwriter session ID used (so the user can keep using it or reset it)
- If deployed: the filled Deployment & Verification checklist, every Post-deploy box ticked (live 200 + renders, rendered links resolve to intended targets, no console errors, mobile renders), plus BOTH the production alias and the immutable
<hash>.<project>.pages.devURL - If the tracking add-on was wired: the Events Manager evidence (browser + server event with the same
event_id, Integration = Multiple) from the deployed https origin
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

