[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6XDXJZVHBNMNGS0R4Y5M0RX":3,"skill-same:01M6XDXJZVHBNMNGS0R4Y5M0RX":56},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":31,"linkOnly":32,"markdownContent":33,"markdownBody":34,"frontMatter":35,"refName":36,"commitSha":37,"skillDirectory":38,"forksCount":14,"repositoryHtmlUrl":39,"repositoryHomepageUrl":6,"ownerHtmlUrl":40,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":41,"install":42,"resources":55},"01M6XDXJZVHBNMNGS0R4Y5M0RX","web-clone",null,"URL-driven website cloning with visual + functional verification","sapsapshen\u002Fai-memory-router","sapsapshen","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F20347959?v=4","01M6XDQEF1DP50DKF37H81J3J5","shenmian","01M6XDQEJPE41Y3DT2763X8ZJN",0,"MIT","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcodex\u002Fweb-clone\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30],"web","clone","web clone","verification","website","cloning","visual","driven","functional","with","URL","website cloning","2026-11-10 10:12:30",false,"---\nname: web-clone\ndescription: URL-driven website cloning with visual + functional verification\n---\n\n\u003CPurpose>\nClone a target website from its URL, replicating both visual appearance and core interactive functionality. Uses Playwright MCP for live page extraction, LLM-driven code generation, and iterative verification with `$visual-verdict` for visual scoring.\n\u003C\u002FPurpose>\n\n\u003CUse_When>\n- User provides a target URL and wants the site replicated as working code\n- User says \"clone site\", \"clone website\", \"copy webpage\", or \"web-clone\"\n- Task requires both visual fidelity AND functional parity with the original\n- Reference is a live URL (not a static screenshot — use `$visual-verdict` for screenshot-only tasks)\n\u003C\u002FUse_When>\n\n\u003CDo_Not_Use_When>\n- User only has screenshot references without a live URL — use `$visual-verdict` directly\n- User wants to modify, redesign, or \"improve\" the site — use standard implementation flow\n- Target requires authentication, payment flows, or backend API parity — out of scope for v1\n- Multi-page \u002F multi-route deep cloning — v1 handles single-page scope only\n\u003C\u002FDo_Not_Use_When>\n\n\u003CScope_Limits>\n**v1 scope**: Single page clone of the provided URL.\n\nIncluded:\n- Layout structure (header, nav, content areas, sidebar, footer)\n- Typography (font families, sizes, weights, line heights)\n- Colors, spacing, borders, border-radius\n- Core interactions: navigation links, buttons, form elements, dropdowns, modals, toggles\n- Responsive hints from the extracted layout (flexbox\u002Fgrid patterns)\n\nExcluded:\n- Backend API integration or data fetching\n- Authentication flows or protected content\n- Dynamic\u002Fpersonalized content (user-specific data)\n- Multi-page crawling or route graph cloning\n- Third-party widget functionality (maps, embeds, chat widgets)\n- Image\u002Fasset replication (use placeholders for external images)\n\n**Legal notice**: Only clone sites you own or have explicit permission to replicate. Respect copyright and trademarks.\n\u003C\u002FScope_Limits>\n\n\u003CPrerequisites>\nPlaywright MCP server must be available for browser automation.\n\n1. Before first tool use, call `ToolSearch(\"browser\")` or `ToolSearch(\"playwright\")` to discover available browser tools.\n2. If no browser tools are found, instruct the user:\n   ```\n   Playwright MCP is required. Configure it:\n   codex mcp add playwright npx \"@playwright\u002Fmcp@latest\"\n   ```\n3. Required tools: `browser_navigate`, `browser_snapshot`, `browser_take_screenshot`, `browser_evaluate`, `browser_wait_for`. Optional: `browser_click`, `browser_network_requests`.\n\u003C\u002FPrerequisites>\n\n\u003CInputs>\n- `target_url` (required): The URL to clone\n- `output_dir` (optional, default: current working directory): Where to generate the clone project\n- `tech_stack` (optional, inferred from project context): HTML\u002FCSS\u002FJS, React, Vue, Svelte, etc.\n\u003C\u002FInputs>\n\n\u003CTool_Usage>\n- Before first MCP tool use, call `ToolSearch(\"browser\")` or `ToolSearch(\"playwright\")` to discover deferred Playwright MCP tools.\n- If no browser tools are found, stop immediately and instruct the user to configure Playwright MCP.\n- Use `browser_snapshot` (accessibility tree) for structural understanding — it is far more token-efficient than screenshots.\n- Use `browser_take_screenshot` only when visual verification is needed (Pass 1 baseline, Pass 4 comparison).\n- Use `browser_evaluate` for DOM\u002Fstyle extraction — pass the scripts from this skill EXACTLY as written (do not modify them).\n- If running within ralph, use `state_write` \u002F `state_read` for web-clone state persistence between iterations.\n- Skip Codex consultation for straightforward extraction; use it only if verification repeatedly fails on the same issue.\n\u003C\u002FTool_Usage>\n\n\u003CState_Management>\nPersist extraction and progress data so the pipeline can resume if interrupted.\n\n- **After Pass 1 completes**: Write extraction summary to `.omx\u002Fstate\u002F{scope}\u002Fweb-clone-extraction.json` containing:\n  - `target_url`, `extracted_at` timestamp\n  - `screenshot_path` (path to `target-full.png`)\n  - `landmark_count` (number of nav, main, footer, form elements)\n  - `interactive_count` (number of detected interactive elements)\n  - `extraction_size_kb` (approximate size of DOM extraction data)\n- **After each Pass 4 verification**: Append the composite verdict to `.omx\u002Fstate\u002F{scope}\u002Fweb-clone-verdicts.json`.\n- **When running within ralph**: Also persist the `visual` portion of the composite verdict to `.omx\u002Fstate\u002F{scope}\u002Fralph-progress.json` for ralph compatibility, mapping `visual.score` → top-level `score` and `visual.verdict` → top-level `verdict`.\n- **On completion or failure**: Write final status with `completed_at` or `failed_at` timestamp.\n\u003C\u002FState_Management>\n\n\u003CContext_Budget>\nPass 1 extraction can produce very large data. Apply these limits proactively:\n\n- **DOM tree**: If the serialized JSON exceeds ~30KB, reduce `depth` parameter from 8 to 4 and re-extract. Focus on top-level structure.\n- **Accessibility snapshot**: If it exceeds ~20KB, this is normal for complex pages. Summarize key landmarks rather than keeping the full tree.\n- **Interactive elements**: Cap at 50 elements. If more exist, keep only visible ones (`isVisible: true`).\n- **Total extraction context**: Aim for under 60KB combined. If exceeded, prioritize: screenshot > accessibility snapshot > interactive elements > DOM styles.\n- **Image tokens**: Full-page screenshots are expensive. Take one baseline in Pass 1 and one comparison in Pass 4. Do not take screenshots between iterations unless debugging a specific region.\n\u003C\u002FContext_Budget>\n\n\u003CSteps>\n\n## Pass 1 — Extract\n\nCapture the target page's structure, styles, interactions, and visual baseline.\n\n1. **Navigate**: `browser_navigate` to `target_url`.\n2. **Wait for render**: `browser_wait_for` with appropriate condition (network idle or timeout of 5s) to ensure full render including lazy-loaded content.\n3. **Accessibility snapshot**: `browser_snapshot` — captures the semantic tree (roles, names, values, interactive states). This is your primary structural reference.\n4. **Full-page screenshot**: `browser_take_screenshot` with `fullPage: true` — save as reference baseline `target-full.png`.\n5. **DOM + computed styles**: `browser_evaluate` with the following script. **COPY THIS SCRIPT EXACTLY — do not modify it**:\n   ```javascript\n   (() => {\n     const walk = (el, depth = 0) => {\n       if (depth > 8 || !el.tagName) return null;\n       const cs = window.getComputedStyle(el);\n       return {\n         tag: el.tagName.toLowerCase(),\n         id: el.id || undefined,\n         classes: [...el.classList].slice(0, 5),\n         styles: {\n           display: cs.display, position: cs.position,\n           width: cs.width, height: cs.height,\n           padding: cs.padding, margin: cs.margin,\n           fontSize: cs.fontSize, fontFamily: cs.fontFamily,\n           fontWeight: cs.fontWeight, lineHeight: cs.lineHeight,\n           color: cs.color, backgroundColor: cs.backgroundColor,\n           border: cs.border, borderRadius: cs.borderRadius,\n           flexDirection: cs.flexDirection, justifyContent: cs.justifyContent,\n           alignItems: cs.alignItems, gap: cs.gap,\n           gridTemplateColumns: cs.gridTemplateColumns,\n         },\n         text: el.childNodes.length === 1 && el.childNodes[0].nodeType === 3\n           ? el.textContent?.trim().slice(0, 100) : undefined,\n         children: [...el.children].map(c => walk(c, depth + 1)).filter(Boolean),\n       };\n     };\n     return walk(document.body);\n   })()\n   ```\n6. **Interactive elements**: `browser_evaluate` to catalog all interactable elements. **COPY THIS SCRIPT EXACTLY — do not modify it**:\n   ```javascript\n   (() => {\n     const results = [];\n     document.querySelectorAll(\n       'button, a[href], input, select, textarea, [role=\"button\"], ' +\n       '[onclick], [aria-haspopup], [aria-expanded], details, dialog'\n     ).forEach(el => {\n       results.push({\n         tag: el.tagName.toLowerCase(),\n         type: el.type || el.getAttribute('role') || 'interactive',\n         text: (el.textContent || '').trim().slice(0, 80),\n         href: el.href || undefined,\n         ariaLabel: el.getAttribute('aria-label') || undefined,\n         isVisible: el.offsetParent !== null,\n       });\n     });\n     return results;\n   })()\n   ```\n7. **Network patterns** (optional): `browser_network_requests` — note XHR\u002Ffetch calls for reference. Do not attempt to replicate backends.\n\nKeep all extraction results in working memory for Pass 2.\n\n## Pass 2 — Build Plan\n\nAnalyze extraction results and decompose into a component plan.\n\n1. **Identify page regions**: From DOM tree + accessibility snapshot, identify major sections:\n   - Navigation bar \u002F header\n   - Hero \u002F banner section\n   - Main content area(s)\n   - Sidebar (if present)\n   - Footer\n   - Overlay elements (modals, drawers)\n\n2. **Map components**: For each region, define:\n   - Component name and responsibility\n   - Key style properties (from computed styles)\n   - Content summary (headings, text, images)\n   - Child components if nested\n\n3. **Create interaction map**: From interactive elements list:\n   - Navigation links → anchor tags with `href`\n   - Form elements → proper `\u003Cform>` with inputs, labels, validation\n   - Buttons → click handlers (toggle, submit, navigate)\n   - Dropdowns\u002Fmodals → show\u002Fhide toggle with transitions\n   - Accordions\u002Ftabs → state-based visibility\n\n4. **Extract design tokens**: Identify recurring values:\n   - Color palette (primary, secondary, background, text colors)\n   - Font stack (families, size scale, weight scale)\n   - Spacing scale (padding\u002Fmargin patterns)\n   - Border radius values\n\n5. **Define file structure**:\n   ```\n   {output_dir}\u002F\n   ├── index.html          (or App.tsx \u002F App.vue)\n   ├── styles\u002F\n   │   ├── globals.css      (reset + tokens)\n   │   └── components.css   (or scoped styles)\n   ├── scripts\u002F\n   │   └── interactions.js  (toggle, modal, dropdown logic)\n   └── assets\u002F              (placeholder images)\n   ```\n   Adapt to `tech_stack` if specified (React components, Vue SFCs, etc.).\n\n## Pass 3 — Generate Clone\n\nImplement the clone from the plan. Work component-by-component.\n\n1. **Scaffold**: Create the directory structure and base files.\n2. **Design tokens first**: Implement CSS custom properties or Tailwind config from extracted tokens.\n3. **Layout shell**: Build the page-level layout matching the original's flexbox\u002Fgrid structure.\n4. **Components**: Implement each region top-down:\n   - Match DOM structure from extraction (semantic tags, landmark roles)\n   - Apply computed styles — prioritize layout properties, then typography, then decorative\n   - Use actual extracted text content; use placeholder `\u003Cimg>` for external images\n5. **Interactions**: Wire up detected behaviors:\n   - Navigation: working `\u003Ca>` tags (to `#` anchors or stubs for v1)\n   - Forms: proper structure with `\u003Clabel>`, input types, placeholder text\n   - Toggles: JavaScript for dropdowns, modals, accordions\n   - Hover\u002Ffocus states: CSS transitions matching original behavior\n6. **Responsive**: If the original uses responsive breakpoints (detectable from media queries in computed styles or from viewport behavior), add basic responsive rules.\n\n## Pass 4 — Verify\n\nCompare the clone against the original across three dimensions.\n\n1. **Serve the clone**: Start a local server for the generated project:\n   ```bash\n   npx serve {output_dir} -l 3456 --no-clipboard\n   ```\n   If `npx serve` is unavailable, fall back to: `python3 -m http.server 3456 -d {output_dir}`.\n   The clone will be accessible at `http:\u002F\u002Flocalhost:3456`.\n2. **Visual verification**:\n   - Navigate to the clone with Playwright: `browser_navigate` to clone URL.\n   - Take full-page screenshot of clone.\n   - Run `$visual-verdict` with: `reference_images=[\"target-full.png\"]`, `generated_screenshot=\"clone-full.png\"`, `category_hint=\"web-clone\"`.\n   - The visual portion of the verdict feeds directly into the composite verdict below.\n   - Visual pass threshold: **score >= 85**.\n\n3. **Structural verification**: Compare landmark counts:\n   - Count `\u003Cnav>`, `\u003Cmain>`, `\u003Cfooter>`, `\u003Cform>`, `\u003Cbutton>`, `\u003Ca>` in both original and clone.\n   - Structure passes when all major landmarks exist (missing landmarks = fail).\n\n4. **Functional spot-check**: Test 2–3 detected interactions via Playwright:\n   - Click a navigation link → verify URL change or scroll behavior\n   - Toggle a dropdown\u002Fmodal → verify visibility change\n   - Interact with a form field → verify it accepts input\n   - Use `browser_click` and `browser_snapshot` to verify state changes.\n\n5. **Emit composite verdict**:\n\n```json\n{\n  \"visual\": {\n    \"score\": 82,\n    \"verdict\": \"revise\",\n    \"category_match\": true,\n    \"differences\": [\"Header spacing tighter than original\"],\n    \"suggestions\": [\"Increase nav gap to 24px\"]\n  },\n  \"functional\": {\n    \"tested\": 3,\n    \"passed\": 2,\n    \"failures\": [\"Dropdown does not open on click\"]\n  },\n  \"structure\": {\n    \"landmark_match\": true,\n    \"missing\": [],\n    \"extra\": []\n  },\n  \"overall_verdict\": \"revise\",\n  \"priority_fixes\": [\n    \"Fix dropdown toggle interaction\",\n    \"Increase header nav spacing\"\n  ]\n}\n```\n\n## Pass 5 — Iterate\n\nFix highest-impact issues and re-verify.\n\n1. **Prioritize fixes** by impact: layout > interactions > spacing > typography > colors.\n2. **Apply targeted edits**: Fix only the issues listed in `priority_fixes`. Do not refactor working code.\n3. **Re-verify**: Repeat Pass 4.\n4. **Loop**: Continue until `overall_verdict` is `pass` OR max **5 iterations** reached.\n5. **Final report**: Summarize what was successfully cloned, any remaining differences, and elements that could not be replicated.\n\n\u003C\u002FSteps>\n\n\u003COutput_Contract>\nAfter each verification pass, emit a **composite web-clone verdict** JSON:\n\n```json\n{\n  \"visual\": {\n    \"score\": 0,\n    \"verdict\": \"revise\",\n    \"category_match\": false,\n    \"differences\": [\"...\"],\n    \"suggestions\": [\"...\"],\n    \"reasoning\": \"short explanation\"\n  },\n  \"functional\": {\n    \"tested\": 0,\n    \"passed\": 0,\n    \"failures\": [\"...\"]\n  },\n  \"structure\": {\n    \"landmark_match\": false,\n    \"missing\": [\"...\"],\n    \"extra\": [\"...\"]\n  },\n  \"overall_verdict\": \"revise\",\n  \"priority_fixes\": [\"...\"]\n}\n```\n\nRules:\n- `visual` follows the `VisualVerdict` shape from `$visual-verdict`\n- `functional.tested\u002Fpassed` are counts; `failures` list specific interaction failures\n- `structure.landmark_match` is `true` when all major HTML landmarks (nav, main, footer, forms) are present\n- `overall_verdict`: `pass` when visual.score >= 85 AND functional.failures is empty AND structure.landmark_match is true\n- `priority_fixes`: ordered by impact, drives the next iteration\n\u003C\u002FOutput_Contract>\n\n\u003CIteration_Thresholds>\n- **Visual pass**: score >= 85\n- **Functional pass**: zero failures on tested interactions\n- **Structure pass**: all major landmarks present\n- **Overall pass**: all three dimensions pass\n- **Max iterations**: 5 (report best achieved result if threshold not met)\n\u003C\u002FIteration_Thresholds>\n\n\u003CError_Handling>\n- **Playwright MCP unavailable**: Stop. Instruct user to configure it. Do not attempt to clone without browser tools.\n- **Page fails to load**: Report the URL and HTTP status. Suggest the user verify the URL is accessible.\n- **browser_evaluate returns empty**: The page may use heavy client-side rendering. Wait longer (`browser_wait_for` with extended timeout) and retry once.\n- **Visual score stuck below threshold after 3 iterations**: Report the current state as best-effort. List the unresolved differences for the user.\n- **Extraction data too large for context**: Truncate deep DOM branches (depth > 6). Focus on top-level structure and defer nested details to iteration fixes.\n\u003C\u002FError_Handling>\n\n\u003CExample>\n**User**: \"Clone https:\u002F\u002Fnews.ycombinator.com\"\n\n**Pass 1**: Navigate to HN. Extract: table-based layout, orange (#ff6600) nav bar, story list with links + points + comments, footer. Screenshot saved.\n\n**Pass 2**: Regions: nav bar (logo + links), story table (30 rows × title + meta), footer. Tokens: orange #ff6600, gray #828282, Verdana font, 10pt base. Interaction map: story links (external), comment links, \"more\" pagination.\n\n**Pass 3**: Generate index.html with HN-style table layout, CSS matching extracted colors\u002Ffonts, working `\u003Ca>` tags for stories.\n\n**Pass 4**: Visual score=78 (font size off, spacing between stories too tight). Functional 2\u002F2 (links work). Structure match=true.\n\n**Pass 5 iteration 1**: Fix font to Verdana 10pt, increase row padding → score=88. Functional 2\u002F2. Structure match. → `overall_verdict: pass`. Done.\n\u003C\u002FExample>\n\n\u003CFinal_Checklist>\n- [ ] Pass 1 extraction completed and summarized (screenshot + accessibility tree + DOM styles + interactions)\n- [ ] Pass 2 component plan created with file structure\n- [ ] Pass 3 clone generated and files written to `output_dir`\n- [ ] Clone serves locally without errors\n- [ ] Pass 4 composite verdict emitted with all three dimensions\n- [ ] `overall_verdict` is `pass`, or max 5 iterations reached with best-effort report\n- [ ] When in ralph: visual verdict persisted to `ralph-progress.json`\n- [ ] Extraction summary persisted to `web-clone-extraction.json`\n\u003C\u002FFinal_Checklist>\n","\u003CPurpose>\nClone a target website from its URL, replicating both visual appearance and core interactive functionality. Uses Playwright MCP for live page extraction, LLM-driven code generation, and iterative verification with `$visual-verdict` for visual scoring.\n\u003C\u002FPurpose>\n\n\u003CUse_When>\n- User provides a target URL and wants the site replicated as working code\n- User says \"clone site\", \"clone website\", \"copy webpage\", or \"web-clone\"\n- Task requires both visual fidelity AND functional parity with the original\n- Reference is a live URL (not a static screenshot — use `$visual-verdict` for screenshot-only tasks)\n\u003C\u002FUse_When>\n\n\u003CDo_Not_Use_When>\n- User only has screenshot references without a live URL — use `$visual-verdict` directly\n- User wants to modify, redesign, or \"improve\" the site — use standard implementation flow\n- Target requires authentication, payment flows, or backend API parity — out of scope for v1\n- Multi-page \u002F multi-route deep cloning — v1 handles single-page scope only\n\u003C\u002FDo_Not_Use_When>\n\n\u003CScope_Limits>\n**v1 scope**: Single page clone of the provided URL.\n\nIncluded:\n- Layout structure (header, nav, content areas, sidebar, footer)\n- Typography (font families, sizes, weights, line heights)\n- Colors, spacing, borders, border-radius\n- Core interactions: navigation links, buttons, form elements, dropdowns, modals, toggles\n- Responsive hints from the extracted layout (flexbox\u002Fgrid patterns)\n\nExcluded:\n- Backend API integration or data fetching\n- Authentication flows or protected content\n- Dynamic\u002Fpersonalized content (user-specific data)\n- Multi-page crawling or route graph cloning\n- Third-party widget functionality (maps, embeds, chat widgets)\n- Image\u002Fasset replication (use placeholders for external images)\n\n**Legal notice**: Only clone sites you own or have explicit permission to replicate. Respect copyright and trademarks.\n\u003C\u002FScope_Limits>\n\n\u003CPrerequisites>\nPlaywright MCP server must be available for browser automation.\n\n1. Before first tool use, call `ToolSearch(\"browser\")` or `ToolSearch(\"playwright\")` to discover available browser tools.\n2. If no browser tools are found, instruct the user:\n   ```\n   Playwright MCP is required. Configure it:\n   codex mcp add playwright npx \"@playwright\u002Fmcp@latest\"\n   ```\n3. Required tools: `browser_navigate`, `browser_snapshot`, `browser_take_screenshot`, `browser_evaluate`, `browser_wait_for`. Optional: `browser_click`, `browser_network_requests`.\n\u003C\u002FPrerequisites>\n\n\u003CInputs>\n- `target_url` (required): The URL to clone\n- `output_dir` (optional, default: current working directory): Where to generate the clone project\n- `tech_stack` (optional, inferred from project context): HTML\u002FCSS\u002FJS, React, Vue, Svelte, etc.\n\u003C\u002FInputs>\n\n\u003CTool_Usage>\n- Before first MCP tool use, call `ToolSearch(\"browser\")` or `ToolSearch(\"playwright\")` to discover deferred Playwright MCP tools.\n- If no browser tools are found, stop immediately and instruct the user to configure Playwright MCP.\n- Use `browser_snapshot` (accessibility tree) for structural understanding — it is far more token-efficient than screenshots.\n- Use `browser_take_screenshot` only when visual verification is needed (Pass 1 baseline, Pass 4 comparison).\n- Use `browser_evaluate` for DOM\u002Fstyle extraction — pass the scripts from this skill EXACTLY as written (do not modify them).\n- If running within ralph, use `state_write` \u002F `state_read` for web-clone state persistence between iterations.\n- Skip Codex consultation for straightforward extraction; use it only if verification repeatedly fails on the same issue.\n\u003C\u002FTool_Usage>\n\n\u003CState_Management>\nPersist extraction and progress data so the pipeline can resume if interrupted.\n\n- **After Pass 1 completes**: Write extraction summary to `.omx\u002Fstate\u002F{scope}\u002Fweb-clone-extraction.json` containing:\n  - `target_url`, `extracted_at` timestamp\n  - `screenshot_path` (path to `target-full.png`)\n  - `landmark_count` (number of nav, main, footer, form elements)\n  - `interactive_count` (number of detected interactive elements)\n  - `extraction_size_kb` (approximate size of DOM extraction data)\n- **After each Pass 4 verification**: Append the composite verdict to `.omx\u002Fstate\u002F{scope}\u002Fweb-clone-verdicts.json`.\n- **When running within ralph**: Also persist the `visual` portion of the composite verdict to `.omx\u002Fstate\u002F{scope}\u002Fralph-progress.json` for ralph compatibility, mapping `visual.score` → top-level `score` and `visual.verdict` → top-level `verdict`.\n- **On completion or failure**: Write final status with `completed_at` or `failed_at` timestamp.\n\u003C\u002FState_Management>\n\n\u003CContext_Budget>\nPass 1 extraction can produce very large data. Apply these limits proactively:\n\n- **DOM tree**: If the serialized JSON exceeds ~30KB, reduce `depth` parameter from 8 to 4 and re-extract. Focus on top-level structure.\n- **Accessibility snapshot**: If it exceeds ~20KB, this is normal for complex pages. Summarize key landmarks rather than keeping the full tree.\n- **Interactive elements**: Cap at 50 elements. If more exist, keep only visible ones (`isVisible: true`).\n- **Total extraction context**: Aim for under 60KB combined. If exceeded, prioritize: screenshot > accessibility snapshot > interactive elements > DOM styles.\n- **Image tokens**: Full-page screenshots are expensive. Take one baseline in Pass 1 and one comparison in Pass 4. Do not take screenshots between iterations unless debugging a specific region.\n\u003C\u002FContext_Budget>\n\n\u003CSteps>\n\n## Pass 1 — Extract\n\nCapture the target page's structure, styles, interactions, and visual baseline.\n\n1. **Navigate**: `browser_navigate` to `target_url`.\n2. **Wait for render**: `browser_wait_for` with appropriate condition (network idle or timeout of 5s) to ensure full render including lazy-loaded content.\n3. **Accessibility snapshot**: `browser_snapshot` — captures the semantic tree (roles, names, values, interactive states). This is your primary structural reference.\n4. **Full-page screenshot**: `browser_take_screenshot` with `fullPage: true` — save as reference baseline `target-full.png`.\n5. **DOM + computed styles**: `browser_evaluate` with the following script. **COPY THIS SCRIPT EXACTLY — do not modify it**:\n   ```javascript\n   (() => {\n     const walk = (el, depth = 0) => {\n       if (depth > 8 || !el.tagName) return null;\n       const cs = window.getComputedStyle(el);\n       return {\n         tag: el.tagName.toLowerCase(),\n         id: el.id || undefined,\n         classes: [...el.classList].slice(0, 5),\n         styles: {\n           display: cs.display, position: cs.position,\n           width: cs.width, height: cs.height,\n           padding: cs.padding, margin: cs.margin,\n           fontSize: cs.fontSize, fontFamily: cs.fontFamily,\n           fontWeight: cs.fontWeight, lineHeight: cs.lineHeight,\n           color: cs.color, backgroundColor: cs.backgroundColor,\n           border: cs.border, borderRadius: cs.borderRadius,\n           flexDirection: cs.flexDirection, justifyContent: cs.justifyContent,\n           alignItems: cs.alignItems, gap: cs.gap,\n           gridTemplateColumns: cs.gridTemplateColumns,\n         },\n         text: el.childNodes.length === 1 && el.childNodes[0].nodeType === 3\n           ? el.textContent?.trim().slice(0, 100) : undefined,\n         children: [...el.children].map(c => walk(c, depth + 1)).filter(Boolean),\n       };\n     };\n     return walk(document.body);\n   })()\n   ```\n6. **Interactive elements**: `browser_evaluate` to catalog all interactable elements. **COPY THIS SCRIPT EXACTLY — do not modify it**:\n   ```javascript\n   (() => {\n     const results = [];\n     document.querySelectorAll(\n       'button, a[href], input, select, textarea, [role=\"button\"], ' +\n       '[onclick], [aria-haspopup], [aria-expanded], details, dialog'\n     ).forEach(el => {\n       results.push({\n         tag: el.tagName.toLowerCase(),\n         type: el.type || el.getAttribute('role') || 'interactive',\n         text: (el.textContent || '').trim().slice(0, 80),\n         href: el.href || undefined,\n         ariaLabel: el.getAttribute('aria-label') || undefined,\n         isVisible: el.offsetParent !== null,\n       });\n     });\n     return results;\n   })()\n   ```\n7. **Network patterns** (optional): `browser_network_requests` — note XHR\u002Ffetch calls for reference. Do not attempt to replicate backends.\n\nKeep all extraction results in working memory for Pass 2.\n\n## Pass 2 — Build Plan\n\nAnalyze extraction results and decompose into a component plan.\n\n1. **Identify page regions**: From DOM tree + accessibility snapshot, identify major sections:\n   - Navigation bar \u002F header\n   - Hero \u002F banner section\n   - Main content area(s)\n   - Sidebar (if present)\n   - Footer\n   - Overlay elements (modals, drawers)\n\n2. **Map components**: For each region, define:\n   - Component name and responsibility\n   - Key style properties (from computed styles)\n   - Content summary (headings, text, images)\n   - Child components if nested\n\n3. **Create interaction map**: From interactive elements list:\n   - Navigation links → anchor tags with `href`\n   - Form elements → proper `\u003Cform>` with inputs, labels, validation\n   - Buttons → click handlers (toggle, submit, navigate)\n   - Dropdowns\u002Fmodals → show\u002Fhide toggle with transitions\n   - Accordions\u002Ftabs → state-based visibility\n\n4. **Extract design tokens**: Identify recurring values:\n   - Color palette (primary, secondary, background, text colors)\n   - Font stack (families, size scale, weight scale)\n   - Spacing scale (padding\u002Fmargin patterns)\n   - Border radius values\n\n5. **Define file structure**:\n   ```\n   {output_dir}\u002F\n   ├── index.html          (or App.tsx \u002F App.vue)\n   ├── styles\u002F\n   │   ├── globals.css      (reset + tokens)\n   │   └── components.css   (or scoped styles)\n   ├── scripts\u002F\n   │   └── interactions.js  (toggle, modal, dropdown logic)\n   └── assets\u002F              (placeholder images)\n   ```\n   Adapt to `tech_stack` if specified (React components, Vue SFCs, etc.).\n\n## Pass 3 — Generate Clone\n\nImplement the clone from the plan. Work component-by-component.\n\n1. **Scaffold**: Create the directory structure and base files.\n2. **Design tokens first**: Implement CSS custom properties or Tailwind config from extracted tokens.\n3. **Layout shell**: Build the page-level layout matching the original's flexbox\u002Fgrid structure.\n4. **Components**: Implement each region top-down:\n   - Match DOM structure from extraction (semantic tags, landmark roles)\n   - Apply computed styles — prioritize layout properties, then typography, then decorative\n   - Use actual extracted text content; use placeholder `\u003Cimg>` for external images\n5. **Interactions**: Wire up detected behaviors:\n   - Navigation: working `\u003Ca>` tags (to `#` anchors or stubs for v1)\n   - Forms: proper structure with `\u003Clabel>`, input types, placeholder text\n   - Toggles: JavaScript for dropdowns, modals, accordions\n   - Hover\u002Ffocus states: CSS transitions matching original behavior\n6. **Responsive**: If the original uses responsive breakpoints (detectable from media queries in computed styles or from viewport behavior), add basic responsive rules.\n\n## Pass 4 — Verify\n\nCompare the clone against the original across three dimensions.\n\n1. **Serve the clone**: Start a local server for the generated project:\n   ```bash\n   npx serve {output_dir} -l 3456 --no-clipboard\n   ```\n   If `npx serve` is unavailable, fall back to: `python3 -m http.server 3456 -d {output_dir}`.\n   The clone will be accessible at `http:\u002F\u002Flocalhost:3456`.\n2. **Visual verification**:\n   - Navigate to the clone with Playwright: `browser_navigate` to clone URL.\n   - Take full-page screenshot of clone.\n   - Run `$visual-verdict` with: `reference_images=[\"target-full.png\"]`, `generated_screenshot=\"clone-full.png\"`, `category_hint=\"web-clone\"`.\n   - The visual portion of the verdict feeds directly into the composite verdict below.\n   - Visual pass threshold: **score >= 85**.\n\n3. **Structural verification**: Compare landmark counts:\n   - Count `\u003Cnav>`, `\u003Cmain>`, `\u003Cfooter>`, `\u003Cform>`, `\u003Cbutton>`, `\u003Ca>` in both original and clone.\n   - Structure passes when all major landmarks exist (missing landmarks = fail).\n\n4. **Functional spot-check**: Test 2–3 detected interactions via Playwright:\n   - Click a navigation link → verify URL change or scroll behavior\n   - Toggle a dropdown\u002Fmodal → verify visibility change\n   - Interact with a form field → verify it accepts input\n   - Use `browser_click` and `browser_snapshot` to verify state changes.\n\n5. **Emit composite verdict**:\n\n```json\n{\n  \"visual\": {\n    \"score\": 82,\n    \"verdict\": \"revise\",\n    \"category_match\": true,\n    \"differences\": [\"Header spacing tighter than original\"],\n    \"suggestions\": [\"Increase nav gap to 24px\"]\n  },\n  \"functional\": {\n    \"tested\": 3,\n    \"passed\": 2,\n    \"failures\": [\"Dropdown does not open on click\"]\n  },\n  \"structure\": {\n    \"landmark_match\": true,\n    \"missing\": [],\n    \"extra\": []\n  },\n  \"overall_verdict\": \"revise\",\n  \"priority_fixes\": [\n    \"Fix dropdown toggle interaction\",\n    \"Increase header nav spacing\"\n  ]\n}\n```\n\n## Pass 5 — Iterate\n\nFix highest-impact issues and re-verify.\n\n1. **Prioritize fixes** by impact: layout > interactions > spacing > typography > colors.\n2. **Apply targeted edits**: Fix only the issues listed in `priority_fixes`. Do not refactor working code.\n3. **Re-verify**: Repeat Pass 4.\n4. **Loop**: Continue until `overall_verdict` is `pass` OR max **5 iterations** reached.\n5. **Final report**: Summarize what was successfully cloned, any remaining differences, and elements that could not be replicated.\n\n\u003C\u002FSteps>\n\n\u003COutput_Contract>\nAfter each verification pass, emit a **composite web-clone verdict** JSON:\n\n```json\n{\n  \"visual\": {\n    \"score\": 0,\n    \"verdict\": \"revise\",\n    \"category_match\": false,\n    \"differences\": [\"...\"],\n    \"suggestions\": [\"...\"],\n    \"reasoning\": \"short explanation\"\n  },\n  \"functional\": {\n    \"tested\": 0,\n    \"passed\": 0,\n    \"failures\": [\"...\"]\n  },\n  \"structure\": {\n    \"landmark_match\": false,\n    \"missing\": [\"...\"],\n    \"extra\": [\"...\"]\n  },\n  \"overall_verdict\": \"revise\",\n  \"priority_fixes\": [\"...\"]\n}\n```\n\nRules:\n- `visual` follows the `VisualVerdict` shape from `$visual-verdict`\n- `functional.tested\u002Fpassed` are counts; `failures` list specific interaction failures\n- `structure.landmark_match` is `true` when all major HTML landmarks (nav, main, footer, forms) are present\n- `overall_verdict`: `pass` when visual.score >= 85 AND functional.failures is empty AND structure.landmark_match is true\n- `priority_fixes`: ordered by impact, drives the next iteration\n\u003C\u002FOutput_Contract>\n\n\u003CIteration_Thresholds>\n- **Visual pass**: score >= 85\n- **Functional pass**: zero failures on tested interactions\n- **Structure pass**: all major landmarks present\n- **Overall pass**: all three dimensions pass\n- **Max iterations**: 5 (report best achieved result if threshold not met)\n\u003C\u002FIteration_Thresholds>\n\n\u003CError_Handling>\n- **Playwright MCP unavailable**: Stop. Instruct user to configure it. Do not attempt to clone without browser tools.\n- **Page fails to load**: Report the URL and HTTP status. Suggest the user verify the URL is accessible.\n- **browser_evaluate returns empty**: The page may use heavy client-side rendering. Wait longer (`browser_wait_for` with extended timeout) and retry once.\n- **Visual score stuck below threshold after 3 iterations**: Report the current state as best-effort. List the unresolved differences for the user.\n- **Extraction data too large for context**: Truncate deep DOM branches (depth > 6). Focus on top-level structure and defer nested details to iteration fixes.\n\u003C\u002FError_Handling>\n\n\u003CExample>\n**User**: \"Clone https:\u002F\u002Fnews.ycombinator.com\"\n\n**Pass 1**: Navigate to HN. Extract: table-based layout, orange (#ff6600) nav bar, story list with links + points + comments, footer. Screenshot saved.\n\n**Pass 2**: Regions: nav bar (logo + links), story table (30 rows × title + meta), footer. Tokens: orange #ff6600, gray #828282, Verdana font, 10pt base. Interaction map: story links (external), comment links, \"more\" pagination.\n\n**Pass 3**: Generate index.html with HN-style table layout, CSS matching extracted colors\u002Ffonts, working `\u003Ca>` tags for stories.\n\n**Pass 4**: Visual score=78 (font size off, spacing between stories too tight). Functional 2\u002F2 (links work). Structure match=true.\n\n**Pass 5 iteration 1**: Fix font to Verdana 10pt, increase row padding → score=88. Functional 2\u002F2. Structure match. → `overall_verdict: pass`. Done.\n\u003C\u002FExample>\n\n\u003CFinal_Checklist>\n- [ ] Pass 1 extraction completed and summarized (screenshot + accessibility tree + DOM styles + interactions)\n- [ ] Pass 2 component plan created with file structure\n- [ ] Pass 3 clone generated and files written to `output_dir`\n- [ ] Clone serves locally without errors\n- [ ] Pass 4 composite verdict emitted with all three dimensions\n- [ ] `overall_verdict` is `pass`, or max 5 iterations reached with best-effort report\n- [ ] When in ralph: visual verdict persisted to `ralph-progress.json`\n- [ ] Extraction summary persisted to `web-clone-extraction.json`\n\u003C\u002FFinal_Checklist>\n",{"name":5,"description":7},"main","7a38d8e7073e61c16eda85681cb32fb68a8657a5","skills-store\u002Fcodex\u002Fweb-clone","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router","https:\u002F\u002Fgithub.com\u002Fsapsapshen","2026-04-14 21:12:12",{"source":8,"skillName":5,"commands":43,"prompt":53,"zipAvailable":54},[44,47,50],{"tool":45,"command":46},"npx","npx skills add sapsapshen\u002Fai-memory-router --skill web-clone",{"tool":48,"command":49},"bunx","bunx skills add sapsapshen\u002Fai-memory-router --skill web-clone",{"tool":51,"command":52},"pnpm","pnpm dlx skills add sapsapshen\u002Fai-memory-router --skill web-clone","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcodex\u002Fweb-clone\u002FSKILL.md",true,[],[57,67,74,82,88,96],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":61,"licenseFileUrl":62,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":66},"01M72R8PZX1ABFHJGTYPA4CAF1","webapp-testing","To test local web applications, write native Python Playwright scripts.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fwebapp-testing\u002FSKILL.md",[],[],"2026-11-10 22:39:42",{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":66},"01M72QG37MMZNDY7X7GXPAK5W6","python-packaging","Comprehensive guide to creating, structuring, and distributing Python packages using modern packaging tools, pyproject.toml, and publishing to PyPI.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fpython-packaging\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":61,"licenseFileUrl":78,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":66},"01M72NXR0QMP9G46TW6A2DH59C","canvas-design","These are instructions for creating design philosophies - aesthetic movements that are then EXPRESSED VISUALLY. Output only .md files, .pdf files, and .png files.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fcanvas-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fglobal\u002Fcanvas-design\u002FSKILL.md",[],[],{"skillNo":83,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":61,"licenseFileUrl":84,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":66},"01M72N55TK3EEQ4QK4AWDC2KZS","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":61,"licenseFileUrl":92,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":66},"01M72MTWC150CFAP4Y5GSNKF80","slack-gif-creator","A toolkit providing utilities and knowledge for creating animated GIFs optimized for Slack.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fslack-gif-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Fslack-gif-creator\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":61,"licenseFileUrl":100,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":66},"01M72KPT3VVNSP88MNAY466TZT","frontend-design","You are a frontend designer-engineer, not a layout generator.","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Ffrontend-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fsapsapshen\u002Fai-memory-router\u002Fblob\u002Fmain\u002Fskills-store\u002Fcursor\u002Ffrontend-design\u002FSKILL.md",[],[]]