convert-url-to-nextjs
Use if rebuilding a live URL or .html snapshot as a pixel-faithful AS-IS Next.js project.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use if rebuilding a live URL or .html snapshot as a pixel-faithful AS-IS Next.js project.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Use skill if you are exhaustively testing or release-gating martool CLI commands in a source checkout or deployed Coolify container over SSH, without local Docker or provider spend.
Use if driving agent-browser for Chrome/CDP automation, @ref snapshots, tabs, or verification.
Use if testing or debugging an iOS app via agent-device CLI — simulator flows, evidence, bug triage.
Use if supervising Jean agents through MCP and Computer Use for monitoring, recovery, or closure.
Use if auditing or designing a CLI for agent/LLM use — JSON output, exit codes, non-interactive.
Use if auditing or designing an MCP server for agent-readiness — framework, security, context.
| name | convert-url-to-nextjs |
| description | Use if rebuilding a live URL or .html snapshot as a pixel-faithful AS-IS Next.js project. |
A company lost the GitHub repo behind its frontend. The only thing left is the production build at example.com. The team wants the same-looking site back in their own stack — as a real, editable Next.js codebase — pixel-faithful to the deployed build, AS IS. The skill's job is to recover what is already in the world, not to redesign it. Throughout this workflow, when a judgment call surfaces between visual fidelity to the live deployed build and a more idiomatic Next.js choice, fidelity wins until the user explicitly opts out.
The output is one Next.js template per unique page type the source actually uses, plus a route map saying which live URLs are instances of which type. The user's expected next step after this skill finishes is usually to wire dynamic content (TinaCMS, MDX, or any CMS of their choice) onto those templates.
.html snapshot / SingleFile export into Next.js" (offline .html + _files/, adjacent local CSS, or inline <style> only).build-tinacms-nextjs.| Need | Route to |
|---|---|
| Browser capture and the back-to-back verification loop in this pipeline | run-agent-browser is the helper this skill drives. |
| Design-doc-only output for SaaS/dashboard/admin | a generic design-documentation path. Use this skill only when the deliverable is a buildable Next.js page. |
| New CMS-backed Next.js site | build-tinacms-nextjs. This skill is for URL/snapshot reconstruction, not CMS scaffolding. The user typically uses build-tinacms-nextjs after this skill, to wire content onto the recovered templates. |
| Key | Value |
|---|---|
| Output location | nextjs-project/ plus .design-soul/ beside the capture or snapshot working root. |
| Naming | Routes, capture IDs, manifests, asset folders, CSS classes, and tokens use kebab-case. React component files and exported component symbols use PascalCase. |
| Minified-CSS warning | Captured/saved CSS is often minified (no trailing ; before }). Reference grep patterns use [^;}]+ — do not simplify to [^;]+, or extraction will silently miss values. |
| Allowed deps | Limited to the scaffold rules in references/system-template.md. No icon, animation, or font packages added for convenience. |
| Phase | Helper | Use |
|---|---|---|
| Capture | scripts/capture-url.sh (read scripts/capture-url.md) | Build the route capture skeleton, record expected artifacts, run the supplied browser-capture command. Never write a success signal on failure. |
| Wave 0 | scripts/extract-styles.sh (read scripts/extract-styles.md) | Detect the page CSS corpus and emit manifests plus custom-property, font, media-query, and keyframe summaries before manual extraction. |
| Verification | scripts/diff-screenshots.sh (read scripts/diff-screenshots.md) | Compare source vs build screenshots / paired directories and emit .design-soul/visual/{route}/summary.json. Do not fabricate diff metrics when tooling is missing. |
| Situation | First action |
|---|---|
| Live URL only — the lost-frontend default | Run the Capture Wave on L0, then crawl L1 from the homepage, then run type extraction. See references/type-extraction.md. |
| Live URL + narrow scope request | Capture only in-scope L0+L1 routes, but still produce the route manifest and per-type cluster before implementing. |
.html + _files/ folders present | Skip live capture. Treat the snapshot as Wave 0 input directly; if multiple snapshots are present, still run type extraction on them. |
.html + adjacent local .css files, no _files/ | Use adjacent-asset snapshot mode. The local CSS and assets are the Wave 0 corpus. |
.html with inline <style> only | Use SingleFile fallback mode. Extract from inline styles and document reduced confidence. |
package.json + source repo, no live site, no snapshot | Source-fallback mode: read source directly. Same grounding/verification rules apply. |
| Request says extract, document, design system, or tokens | Stop after the Capture Wave or Waves 0–2 unless the user explicitly asks to build. |
| Request says rebuild, recreate, convert, clone, recover, or pixel-perfect | Run the full pipeline: Capture → Type Extraction → Waves 0–4 → Back-to-back verification → Report back to user. |
| Source spans many routes / templates | The type-extraction phase handles this — cluster L1 URLs into unique types first, finish one type completely, then fan out. |
| Request is ambiguous | Default to grounded extraction first. Do not assume a full rebuild. |
Read references/input-output-spec.md for input detection, working-root rules, route normalization, output trees, and ambiguity handling. Read references/capture-workflow.md when starting from a live URL.
references/capture-workflow.md and references/type-extraction.md.references/type-extraction.md._files/ folders, adjacent local CSS, and inline styles are all valid snapshot evidence. Do not discard a snapshot because it does not match one filename convention.references/principles-and-rules.md.tokens.ts, tailwind.config.ts, globals.css, components, and route data must trace to Capture/Wave 0/Wave 1 artifacts. Mark unverifiable values UNVERIFIED rather than substituting defaults.UNVERIFIED or user-supplied. Workflow guardrail, not legal advice.references/back-to-back-verification.md.UNVERIFIED. Honest gaps are allowed. Invented values are not.| Do this | Not that |
|---|---|
| Treat the live deployed page as ground truth; recover AS IS | "Improve," modernize, or redesign while rebuilding |
| Capture L0 + every L1 link; cluster L1 by layout fingerprint into unique page types | Generate one Next.js route per URL |
| Produce one Next.js template per unique page type | Duplicate similar layouts as bespoke per-route JSX |
| Use CSS Module prefixes, semantic tags, heading outlines, and screenshot coverage together to identify sections | Infer structure from generic <div> nesting or above-the-fold screenshots alone |
| Search across the full discovered CSS corpus per page, then deduplicate shared files | Read minified CSS by eye or treat each hashed CSS file as an isolated system |
| Carry exact source values through Capture / Wave 0 → Wave 4 | Round, normalize, or replace values because they look "close enough" |
| Run the back-to-back verification loop at 1440/768/375 per type before declaring done | Declare success from build success or spot-checking only the top viewport |
Keep deps to the scaffold rules in references/system-template.md | Add UI, icon, animation, or font packages for convenience |
| Phase | Goal | Required reference | Primary outputs | Gate |
|---|---|---|---|---|
| 1. Capture (L0 + L1) | Crawl homepage and every same-origin link from it; capture hydrated DOM, screenshots, runtime metadata, and mirrored assets per URL | references/capture-workflow.md + references/input-output-spec.md | .design-soul/capture/{route}/dom.html, mirror/, screenshots, runtime-metadata.json | per-route capture artifacts present |
| 2. Type extraction (NEW NAMED PHASE) | Cluster L1 URLs into unique page types by layout fingerprint; choose a canonical exemplar per type; emit route-map.json | references/type-extraction.md | .design-soul/types/route-map.json, page-types.md, per-URL fingerprints | route-map.json complete, one exemplar per type |
| 3. Per-type rebuild | For each type, extract tokens (Wave 0), unify family (Wave 1), brief the build (Wave 2), scaffold (Wave 3), render (Wave 4) into one Next.js template per type | references/foundations-agent.md, references/sections-agent.md, references/section-template.md, references/system-template.md, references/wave-pipeline.md, references/website-patterns.md | nextjs-project/app/... (one template per type) | wave3/foundation-ready.signal + per-type Wave 4 build passes |
| 4. Back-to-back verification (NEW NAMED PHASE) | Per type, drive run-agent-browser to load the original exemplar URL and the candidate Next.js URL at the same viewport; compare; pass/iterate/escalate | references/back-to-back-verification.md + scripts/diff-screenshots.md | .design-soul/verify/{type}/iterations.json, screenshots, summary.md, verification-report.md | all types pass at desktop/tablet/mobile, or user-approved residual drift |
| 5. Report back to the user (NEW NAMED PHASE) | Surface every type found, the L1 URLs it covers, the template path, the verification evidence, the residual drift, and the recommended next step | This SKILL.md — "Report back to the user" section below | RECOVERY-REPORT.md at the working root | user has the complete map of what was rebuilt and what is optional from here |
If the user only asked for extraction or documentation, stop after Phase 2 or Wave 1 instead of pushing to build.
The crawl is the homepage (L0) plus every same-origin link reachable from it (L1). The capture contract per URL is unchanged from the existing capture workflow.
run-agent-browser. Wait for the page to settle. Capture hydrated dom.html, headings, runtime metadata, screenshots at 1440/768/375, and mirror the route's CSS/JS/fonts/images.mailto:, tel:, javascript:, # anchors, external hosts, and obvious tracking/locale duplicates).See references/capture-workflow.md for the full per-route capture contract, working-root selection, route normalization, and failure recovery. Use scripts/capture-url.sh to scaffold the per-route artifact skeleton; the script delegates to the browser command and verifies artifacts before returning success.
This is the discrete named phase that converts the L1 URL set into the small number of unique page types the site actually uses. It runs before any rebuild work. Read references/type-extraction.md for the full procedure.
.design-soul/types/fingerprints/{slug}.json — one layout fingerprint per L1 URL.design-soul/types/route-map.json — { typeId → { exemplarUrl, instances, nextjsTemplate, captureRoots } }.design-soul/types/page-types.md — human-readable rationale per cluster (signal evidence, exemplar choice, notable instance differences)Compute these for each L1 URL from the hydrated DOM:
:slug<body> and <main> class set (sorted, deduplicated)<main>Two L1 URLs join the same type cluster when all three hold:
Homepage is always its own type. A cluster of size 1 is valid. A cluster of 20+ visually diverse instances is a signal to ask the user before continuing.
One Next.js template per type:
app/{type-route}/page.tsxapp/{type-route}/[slug]/page.tsxThe rebuild phase reads route-map.json as its plan. Do not write any Next.js code until this phase has finished and route-map.json is on disk.
For each type in route-map.json, run the existing waves against the type's canonical exemplar (and any instance-specific overrides that surfaced in Phase 2):
references/foundations-agent.md. Use scripts/extract-styles.sh first to inventory the CSS corpus before manual extraction.references/sections-agent.md. Anatomy heuristics live in references/website-patterns.md.references/section-template.md.references/system-template.md. Allowed deps and foundation-ready.signal gate are defined there.app/. Full orchestration and quality gates live in references/wave-pipeline.md.Think first:
run-agent-browser.)_files/, adjacent CSS, inline CSS, or source fallback?This is the discrete named phase that proves each type's Next.js template is faithful to the deployed source. It runs per type, not per URL. Read references/back-to-back-verification.md for the full procedure.
run-agent-browserThis phase explicitly drives run-agent-browser. The loop uses, at minimum:
open to load the original URL on the live site, then the candidate URL on localhost:3000snapshot -i to confirm the DOM has settled before each screenshotscreenshot to write .design-soul/verify/{type}/original-{viewport}.png and candidate-{viewport}.pngget text and eval --stdin heredoc for heading-outline and section-text comparison when pixel noise is high--session-name verify-{type} so each type runs in a clean named session; --headed when the original site fights headless browsersfor each type in route-map.json:
for each viewport in [1440, 768, 375]:
capture ORIGINAL → original-{viewport}.png
capture CANDIDATE → candidate-{viewport}.png
write iteration entry → iterations.json
decide pass / iterate / escalate
on full pass → write summary.md, advance
A type passes when, at all three viewports:
<main> matches the original| Outcome | Trigger | Next action |
|---|---|---|
| pass | All three viewports satisfy every parity dimension | Write summary.md, move to next type |
| iterate | Any viewport fails on a recoverable dimension | Fix the candidate template, increment iteration, re-run for that type |
| escalate | 5 rounds without a pass, or the same dimension fails 3 rounds in a row, or capture artifacts are missing/corrupted | Pause, summarize the residual diff for the user, ask whether to accept, change strategy, or skip the type |
Use scripts/diff-screenshots.sh for an RMSE pre-filter on the desktop pair when ImageMagick is available; never fabricate a metric when it is not.
When every type has either passed the verification loop or has user-accepted residual drift, write RECOVERY-REPORT.md at the working root and surface the contents to the user in the assistant's final reply.
typeId from route-map.json, including the homepage.instances array per type, plus the canonical exemplar.nextjs-project/app/... per type..design-soul/verify/{type}/.summary.md.UNVERIFIED — any tokens, fonts, or assets the agent could not ground from captured evidence; the user must decide whether to substitute or hunt down.build-tinacms-nextjs as the natural follow-on when the user wants a TinaCMS-backed editorial site.The user must walk away knowing exactly what was rebuilt, exactly what is optional from here, and exactly what was deliberately left alone.
@font-face, @media, @keyframes, and transition values before touching the build.token-values.json as the source of truth for tokens; Wave 3 only re-expresses those exact values in tokens.ts, Tailwind config, and globals.css.public/assets/fonts/, images to public/assets/images/..., icons to public/assets/icons/, or inline icons only when the source uses inline SVG.style="" attributes or JS-driven states, extract the base CSS and the trigger separately; do not freeze computed runtime values into guessed static styles.package.json from a current official Next.js App Router scaffold, or verify package compatibility against official Next.js docs at execution time. Do not pin latest package versions by guesswork.[slug] parameterized route. The route map in .design-soul/types/route-map.json is the source of truth.sizes, and priority for LCP/hero imagery. Do not add next.config.js remote image domains unless a temporary verification-only exception is documented.__NEXT_DATA__, self.__next_f, build IDs, chunk URLs, and route-level script/style manifests when present._files/ folder: if HTML references local CSS files, use adjacent-asset snapshot mode; if it only contains inline CSS, use SingleFile mode; otherwise full reconstruction may be blocked unless a live site can be captured.@font-face, CSS url(...), runtime font URLs, and local .woff2 / .woff / .ttf / .otf files. Verify weight/style coverage and font-display; if the original cannot be recovered, document the missing source and mark the substitution UNVERIFIED.UNVERIFIED; avoid inventing the implementation.components/shared/ and import them per template; note route-specific overrides instead of duplicating the shell.Every conversion must pass these checks before declaring success:
# Install deps in nextjs-project/ first
npm install
# Type-check passes
npx tsc --noEmit
# Production build succeeds
npm run build
# No UNVERIFIED comments remain in shipped app code
grep -r 'UNVERIFIED' app/ components/ lib/ styles/ && echo "FAIL: unverified values" || echo "PASS"
# No external URLs leak into components or styles
grep -rE 'https?://' components/ styles/ | grep -v '// original:' && echo "FAIL: external URLs" || echo "PASS"
# Every type in route-map.json has a verification summary
jq -r '.types[].id' .design-soul/types/route-map.json | while read t; do
test -f ".design-soul/verify/$t/summary.md" || echo "FAIL: missing verify summary for $t"
done
route-map.json is on disk and internally consistent.references/quality-checklist.md.foundation-ready.signal: extracted CSS custom properties and shared tokens are accounted for, dependency set is allowed, fonts/assets are self-hosted, traceability matrix exists, and TypeScript/build are clean.summary.md.Verification rung reached: state the actual rung and evidence — for example build/type-check only or back-to-back original-vs-candidate at 1440/768/375 per type with summary.md.pixel-perfect: claim only when the user provided a threshold or exact measured diff gate and every type meets it at desktop/tablet/mobile.visual-equivalent: use when the verification loop supports fidelity but documented drift remains because source evidence is incomplete.| Need | Read |
|---|---|
| Live-capture prerequisites, working root, route normalization, canonical exemplar selection | references/capture-workflow.md |
| Input detection, capture outputs, output trees, ambiguous requests | references/input-output-spec.md |
| L0 + L1 crawl, layout fingerprints, type clustering, one-template-per-type output | references/type-extraction.md |
Back-to-back original-vs-candidate verification loop with run-agent-browser | references/back-to-back-verification.md |
| Hard rules: grounding, section identification, zero invention | references/principles-and-rules.md |
| Wave 0 extraction method | references/foundations-agent.md |
| Wave 1 design-soul extraction | references/sections-agent.md |
| Wave 2 build-brief format | references/section-template.md |
| Wave 3 scaffold, token wiring, allowed deps | references/system-template.md |
| Full orchestration, Capture Wave, and gates | references/wave-pipeline.md |
| Acceptance criteria, visual QA, and failure modes | references/quality-checklist.md |
| Section-type and anatomy heuristics | references/website-patterns.md |
Read only the references needed for the current phase. Keep the top-level skill focused on decisions, sequencing, and guardrails; keep implementation detail in the reference files.