SuperAPI AI Directory

website-rebuild

Coding & development

View repository

Updated 11-12 17:19

About this skill

Website Rebuild (1:1 replica of an award-winning creative site)

Rebuild an award-winning creative website (WebGL / scroll-driven narrative / portfolio site) using aforensic approachinto an independently runnable engineering project with verifiable fidelity. Not a "looks similar" imitation—it is a line-by-line port that treats the source site's bundle as the sole specification and closes with quantitative acceptance gates.

This methodology was distilled from six consecutive hands-on projects (with duration converging from 6.5 weeks to 1 day), and its applicable scope was calibrated through actual boundary-probing tests on 43 sites.

Prerequisites and Authorization ⛔ Must Read

This skill is intended forlearning and research purposesfaithful replication, used to study the implementation techniques of award-winning creative sites. It applies to sites that youown, have been authorized to use, or that are publicly accessible and permit learning by imitation. It is not a tool for unauthorized collection of protected content, circumvention of access controls, or commercial misappropriation of others' work.

Observe the following boundaries during execution:

  • Respect the target site's rules: comply with its robots.txt, terms of service, and copyright; keep crawling low-frequency and single-session, and do not impose abnormal load on the target site. ⛔ robots.txt is a per-path permission statement, not a site-wide switch—evaluate per URL (select group → longest match → allow if no match),do not judge "the entire site is forbidden" merely because any Disallow line exists(almost every commercial site has a /cart、/checkout、/admin of Disallow); classify prohibitions by behavior category,only prohibitions targeting "crawling" affect the mirror scope, while prohibitions targeting transactions only mean "don't click checkout". ⭐ "Can't understand / can't be sure" does not equal "forbidden": escalate for review, do not halt work, and do not unilaterally narrow the crawl scope. For how to read it, see references/legal-and-deploy.md §0.3。
  • Do not touch protected boundaries: do not collect content that requires a login state, paywall, or authorization to access; this skill only handles anonymously and publicly accessible resources. If the target site explicitly prohibits such copying, stop and inform the user—for what counts as "explicitly prohibited", see legal-and-deploy.md the four hard-coded thresholds in §0.3.6; for all other uncertainty, escalate for review rather than halt work。
  • Output is private by default: noindex by default, no public deployment. Before any publication, per-asset copyright evidence must be completed, and "unofficial replica" and original author attribution must be prominently marked (see references/legal-and-deploy.md)。

⛔ Legal judgment belongs to the user; the skill only gathers evidence and presents it(three rules, in effect throughout):

  1. The decision rests with the user: the skill collects facts (per-asset attribution, license status, third-party rights holders, whether the source site is still operating, third-party identifiers in the output), lists options and their respective risk boundaries, and gives recommendations with reasons; for anything involving "can it be made public / deployed / redistributed / shown externally",it must be explicitly handed back to the user using the "User Input Tools" below, and the agent must not draw its own legal conclusion and then continue onward.
  2. Execute according to safe defaults until the user makes an explicit decision: private repository + noindex + no public deployment + no redistribution. When writing to the user, explain that this is thedefault action("I won't send it out until you decide"),not Legal conclusion already reached by the agent — the attribution of responsibility for the two is completely different. The agent may only execute defaults toward the conservative side; moving toward the public side requires an explicit user decision.
  3. ⛔ Legal considerations must not reduce mirror completeness or the coverage of the gates: the mirror is the evidentiary base,completeness is a technical invariant(the four-pass method, the closure gate, and GAP=0 are all built on it). Failure to capture may only havetechnical reasons(not a file / not provided by the server / requires authorization or login state / explicitly prohibited by the origin site), all of which must be logged;must notleave holes for legal reasons such as "it won't be made public anyway" or "we shouldn't store an extra copy." Empirical evidence: a certain project, on the grounds that "outputs will never be made public," adopted "log, do not re-capture" for a class of assets,missing about 60% of the assets while all five gates stayed green, hiding four milestones [objectarchive]. Legal decisions act onhow outputs are used, not on whether the evidentiary base is complete.

Scope of application (v0.1) ⛔ Required reading

Primary domain (Class A): Sites where content is statically hosted and signing behaviors (animation/interaction) are all stored in client-side static assets — imperative WebGL/Canvas scenes, GSAP timelines, baked data files (GLB/.buf/.riv), minified or unobfuscated bundles. The vast majority of Awwwards-style creative sites fall into this category.

Conditionally supported (Class B): The pipeline holds but requires additional scenario handling (Shopify platform-layer stripping, third-party bucket assets, runtime API snapshots, SSG payload expansion). The guidance provided in v0.1 covers some Class B scenarios; when encountering uncovered ones, risks must be explicitly stated to the user.

Explicitly rejected (Class C/D):

  • C1 (still rejected): Component sourceis simply not delivered— React RSC server components only deliver the flight serialization result; the client has no target object that can be transpiled.
  • C2 (doable, run as Class A): ⭐ The writing style is declarative butthe source is delivered(R3F / Theatre / Vue SFC compilation output). Measured on an R3F site:useFrame the callback is just MathUtils.damp(x, y, 7, t) ordinary imperative code like this; after slicing 18 modules verbatim and swapping them into the page, CLEAN, all 8 canvases present, cross-side 99.5%。The slicer does not care about paradigm — what it slices is bytes. The renderer is served as a platform layer from the mirror. ⛔ The discriminator is not the library name, but "whether the client holds the behavior source" (scope-and-fingerprint.md §4.0.1)。
  • D: the behavior subject is on the server side (CMS content sites, e-commerce cart/inventory, A/B experiment bucketing, personalization hydration) — the client has no portable target object, and deterministic acceptance has no baseline.

Class X: The original site no longer exists (domain changed hands / reclaimed by the platform / path removed / replaced in place). Guide the user to provide a Wayback snapshot or change the target. The measured disappearance rate of award-winning sites over the years is about 29% — this is also why "mirror at first opportunity" is this skill's first discipline.

Classification is determined by the Step 0 fingerprint reconnaissance; for the complete decision tree see references/scope-and-fingerprint.md。When rejecting, explain the reason and state which class the site belongs to, do not force-run.

User Input Tools

When it is necessary to ask the user questions (confirming scope,legal decisions, external dependency decisions): prefer the built-in question-asking tool of the current runtime (e.g. AskUserQuestion); if not, output a numbered question list for the user to reply with numbers. When multiple questions can be combined, ask them all at once. Legal questions follow legal-and-deploy.md §0.1's five-part format: facts / what cannot be determined / options / risk boundary of each option / recommendation and current default action.

Constitution (six disciplines, in force throughout)

The following six are called "constitutional-level" across the six source projects; violating any one will be repaid as a bug in later stages:

  1. The mirror is sacred and must not be polluted:mirror/ Disk files are never modified; all localization adaptations (CDN rewriting, external-link stubs) are performed dynamically in the service-layer response.
  2. Source-site code is the sole arbiter; do not fix by impression: for every change, first locate the owning line number in the bundle/CSS/mirrored HTML before implementing. Do not tune visuals, motion, or interaction by eye.
  3. Everything the source site has must be present; nothing the source site lacks may be added: do not invent compensatory CSS/JS. Better to look unlike it at first than to invent rules—self-created patches will invert into bugs once the mechanics are aligned.
  4. Copy bugs / dead code / odd constructs verbatim; do not fix them: every odd construct in minified code may be the behavior itself. A "well-intentioned fix" of a no-op bug once caused a transition crash (evidence in porting-discipline.md).
  5. Intentional deviations must be registered: state clearly "how the source site does it / how we do it / why / under what conditions to reconsider".Any unregistered difference is treated as a bug。
  6. Code and documentation in the same commit: commit each milestone as a pair (Port xxx + Update rebuild plan: xxx), and the log must always contain deliverables / acceptance / lessons / next breakpoint (with line numbers).

⭐ Discipline 3 at the M(n+1) boundary:src/ is an explicitly registered derivative, not an assertion about the source site, soin src/ renaming, splitting modules, and writing comments do not count as "invention"—Discipline 3 constrains "inventing behavior to make it look alike", not "making proven-equivalent code readable". But two hard boundaries do not move:① Structural rewrites are prohibited by default(merging duplicates, extracting shared functions, changing algorithms—they make equivalence undecidable);② Speculation in comments must be marked as speculation, and guesses from reverse-engineering notes must not be written as declarative sentences.port/ and mirror/ still may not be changed by a single byte. See references/readable-source.md §3.4 and §5 for details.

Workflow

Progress Checklist

[ ] Step 0  指纹侦察与范围门 ⛔(判级 A/B/C/D/X;C/D/X 拒绝或引导,不进入下一步)
[ ] Step 1  开工评级(架构证否、分项难度打星、工期预估、与用户确认范围)
[ ] M0      镜像取证 ⛔(BFS 爬虫 + CDP 补录 + manifest 账本;GAP=0)
[ ] M0.5    镜像断网跑通 ⛔(零 404 / 零控制台错误 / 零外联;serve.mjs 伺服)
[ ] M1      逆向建坐标系 ⛔(_pretty 钉版本展开;engine-notes 先于任何代码;技术栈钉死;REBUILD_PLAN 建立)
[ ] M2+     严格溯源移植(依赖序里程碑推进;先竖切一条端到端链路;每里程碑冷启动实测 + CLEAN 门)
[ ] M(n-1)  对拍验收(按 verification-gates.md 决策树选门型;根因修复,不调参糊平)
[ ] M(n)    收口 ⛔(冷头评审 / 模块清单对账;版权取证 + 呈交用户决定——公开部署前必须完成)
[ ] M(n+1)  源码化(port/ → src/:拆模块、去混淆重命名、补注释、自包含)

⛔ = blocking gate: the next stage may not begin until the acceptance criteria are met.

Flow

Step 0 — Fingerprint reconnaissance and scope gate. Load references/scope-and-fingerprint.md, run the probe protocol against the URL given by the user (GET to path granularity, final-URL identity, double-fetch diff, species/era validation, preliminary bundle inspection), and output the grading and its basis. Continue for A/B classes; for C/D/X classes, explain to the user and then stop or guide.

Step 1 — Kickoff grading. Load references/recon-and-rating.md. Falsify architectural assumptions first (dependency tables lie), star-rate the difficulty of each item (assets/3D/scroll choreography/private formats/platform layer), and confirm with the user the replication scope (entire site or specified pages) and expectations.

M0 / M0.5 — Mirror forensics. Load references/mirroring.md. Use scripts/mirror-site.mjs BFS crawling + scripts/netcapture.mjs real-browser supplementary capture, register sha256 per file in the manifest,redirect: manual discipline, decide on each external dependency item by item.scripts/verify-mirror.mjs isThe mirror's own gate(five assertions, run before the offline gate—all downstream gates ask "does it render?", and a wrong mirror can make them all green;an HTTP 200 is also not evidence that "you got that resource")。scripts/serve.mjs serve the mirror, accept offline.This step is always done first—the original site may disappear or change at any time; the mirror is the project's only evidence baseline and the reference server for all subsequent comparisons.

M1 — Reverse-engineer the coordinate system. Load references/reverse-engineering.md。⛔ The first action is to determine the bundle form(flat concatenation / modular packaging / multi-chunk), then choose tools—the layering table scans top-level declarations, and the number of top-level declarations in webpack build output is 0, with boundaries and dependency edges given by the bundler (measured: 24,378 lines → 569 ready-made modules, using scripts/module-map.mjs). If the container cannot be identified, FATAL,falling back to the layering table is forbidden(§0.5)。scripts/beautify-bundle.mjs(js-beautify pinned to 1.15.1) expand the bundle into _pretty/; from then on, line numbers are the project's only traceability coordinate system. First write docs/engine-notes.md(template:assets/templates/engine-notes.md) before writing any code. Pin exact versions for the tech stack based on evidence from the bundle. For data-driven animation, first dump the numeric ledger. Establish REBUILD_PLAN.md(template:assets/templates/rebuild-plan.md)。

M2+ — Strictly traceable porting. Load references/porting-discipline.md, and load the corresponding scenario guide according to the branch routing table. Annotate the source line-number range at the top of each ported file; extract GLSL/magic numbers/data verbatim; extract data assets into the repository via scripts rather than copying by hand.

M(n-1) — Comparative acceptance. Load references/verification-gates.md and references/determinism.md。⚠ Before attributing residuals, first establish the self-comparison bandwidth(pixelcompare --self, ≥4 runs per side, interleaved)—any residual without bandwidth is UNCLASSIFIED, and UNCLASSIFIED is failure, not pass. Gate type selection: if there is SSR/static HTML output, first build a byte gate → for static DOM scenarios, freeze entropy sources and use byte-equal → for live scenarios (WebGL/video/random phase), downgrade to quantitative metrics + noise classification → for data-driven animation, add numeric probe gates → the CLEAN gate as the fallback throughout. Before judging timing bugs, first calibrate the probe (references/environment-traps.md)。

M(n) — Wrap-up. Cold-head review: check the landing points of the bundle's top-level class/module list one by one (functional tests cannot catch whole-block omissions; only list-style checking can). Load references/legal-and-deploy.md to complete copyrightevidenceand present the decisionto the user—before the user decides, follow the safe default (private + noindex + not deployed); before making it public, evidence must be obtained for each asset and it must be prominently marked as an unofficial reproduction.

M(n+1) — Sourcification. Load references/readable-source.md. Up to M(n), the outputhas been proven correct but is unreadable to humans(measured: 14,271 lines crammed into one file,e appears 2962 times, comments account for 0.2%). This stage rewrites port/ into src/: split modules → scope-safely deobfuscate and rename → add tiered comments → copy assets to make it self-contained. ⛔ The split granularity is not a free choice—the declaration order of a flat script is the evaluation order, and the granularity is determined by three hard constraints (mutual references / evaluation order / import bindings are not assignable),produce a partition plan for human review first, then split; when encountering giant modulesFirst measure the benefit curve of "lazily binding a few trailing singletons" before deciding(In practice, 6 bindings alone cut 11,246 lines down to 1,013, whereas switching the module system costs the entire toolchain just to reach the same granularity.) ⭐ The judgment "this can't be done" is extremely unreliable— In practice, twice it was judged structurally impossible, and both times the real culprit was a single bug in our own tooling; suspect the tool that measures it before suspecting the object (readable-source.md §3.1–3.1.3)。⛔ Preconditions are non-negotiable: there must first be an all-green gate. Refactoring without a referee is blind editing; with the meanAbsDiff 0.00 referee, every step can be disproven—this is the best condition refactoring could have, and also the reason it must come last. All existing gates are reused as-is (target switched to the src/ build artifact,tolerances must not be loosened), plus a symbol-mapping gate and a self-containment gate. ⛔ Structural rewrites (merging duplicates, extracting shared functions, changing algorithms) areforbidden by default—they would degrade the gate from "proving equivalence" to "not having detected non-equivalence". ⭐ Discipline 4 remains in effect at this stage: now that you can read it, the urge of "this is obviously a bug" will be stronger than at any stage, and it may still be the behavior itself.

Branch routing table

The Step 1 reconnaissance result determines which scenario guides to load (on demand, do not load everything):

Reconnaissance finding Load
WebGL / Canvas scenarios (three.js, in-house engine, GLSL) references/webgl-scenes.md
GSAP / baked animation data / CSS variable animation / in-house input state machine references/animation-recovery.md
Proprietary binary formats (.buf / .sog / VAT / GLB timeline / .riv) references/binary-formats.md
Shopify stores (fingerprint see cdn/shop、Shopify.theme、cdn.shopify.com) references/shopify-platform.md
DOM-layer strategy selection (unavoidable for all sites; Webflow export / static single page / framework SSR branches differ, plus the orthogonal constraint of "the DOM being read by a 3D engine as a coordinate source") references/dom-shell-strategies.md
Large-volume assets (hundreds-of-MB media / licensed fonts) references/asset-management.md
Abnormal headless probing behavior / suspected environment issues references/environment-traps.md

Step Summary

Stage Key actions Blocking gate acceptance Deliverables
Step 0 Fingerprint probing and grading Grading is clear and has been communicated to the user Grading conclusion and basis
Step 1 Disproof + rating + scope confirmation User confirmation Difficulty rating table, scope consensus
M0/M0.5 Mirror + ledger + offline run-through verify-mirror all five items green; GAP=0; zero 404s / zero errors / zero external connections mirror/(read-only), manifest,serve.mjs reference server
M1 Expand bundle, reverse-engineering notes, pin the stack engine-notes complete; version pinning table complete _pretty/、docs/engine-notes.md、REBUILD_PLAN.md
M2+ Traceable porting, paired commits per milestone Cold-start measured test per milestone + CLEAN gate green Source code with line-number comments, three registry tables updated on a rolling basis
M(n-1) Side-by-side comparison acceptance All selected gate types green or all differences registered Verification script + comparison artifacts committed (docs/compare/)
M(n) Cold-head review + copyright forensics + submit to user Checklist reconciliation with zero gaps; user has made the deployment decision (if undecided, maintain the safe default) Audit records, DEPLOY.md
M(n+1) Split modules + deobfuscate + comment + self-contained All existing gates green andtolerance not loosened; symbol gate bidirectional injective with zero orphans; self-contained gate (copy out, disconnect network, build) passes src/(readable engineering),docs/rename-map.json、src/README.md

Script Directory

Node 22+, paths relative to this skill directory. For usage and maturity see scripts/README.md。

⭐⭐ Dependency discipline is drawn by phase, not by directory: before source-ification, the entire pipeline has zero dependencies.

Step 0 → M(n) installs nothing throughout;the replica project only gains devDependencies at M(n+1)(scope-safe renaming requires a real parser).scripts/(zero dependencies) and tools/(devDeps allowed) are merely the projection of this phase line onto directories—the criteria live in scripts/, the refactorers of the source-ification phase live in tools/。

⛔ No gate may import any tool(verification-gates.md §2.1.2)—the checker cannot be the producer.

⭐ What if an earlier phase needs a real parser? Use it externally, do not import it. beautify-bundle.mjs(js-beautify) and module-map.mjs(acorn) are both spawn apinned-version npx, the script itself still has zero dependencies and remains independently auditable. ⛔ Do not switch to a hand-written lexer—tried in this skill, a single regex literal containing quotes threw it off by 16,177 lines (F27).Bracket matching on the token stream is exact; bracket matching on text is a guess about strings/regex/comments.

⚠ This line wasonly discovered after being violated:module-map.mjs depends on @babel/*, yet lived in scripts/ for a full eight versions, while the exact wording of the same discipline was written three lines above it.A rule that is only written in documentation and checked by nothing will quietly fail.

Script Purpose Phase used
scripts/fingerprint.mjs Cross-platform equivalent implementation of the Step 0 six-step probing protocol (GET liveness + redirect chain and final-domain identity, dual-fetch diff, species/era, HTML tech fingerprint, bundle initial check; occurrence counting and <1KB Referer retry built in).Evidence collection only, no grading—grading still follows the scope-and-fingerprint.md §3 decision tree Step 0 (when no POSIX toolchain is available)
scripts/mirror-site.mjs BFS crawler mirror (asset allowlist + iterate to fixed point;redirect:manual + three ledgers, including per-file sha256).--scope <前缀> constrains thepagequeue to under the target path (required when a microsite is hosted under a corporate CMS domain; ⛔ restricts pages only, not assets).Ledger accumulation(--seeds gap-filling no longer truncates rows from the previous round) + off-host census(count and warn for each host not followed—silent discarding once made 827 media references vanish while the report said "57 files saved") M0 first pass
scripts/netcapture.mjs Reconcile real-browser CDP packet capture and backfill runtime resources (CDN sites must pass --hosts, otherwise only same-origin traffic is observed and a false GAP=0 is reported) M0 second pass
scripts/verify-mirror.mjs The mirror's own gate, running before the offline gate. Five assertions: mapping injectivity / ledger and disk sha256 / authenticity (challenge page body + declared type against magic number—a 200 is not evidence that "you got that resource") / closure / optional sampling back to origin. Every downstream gate asks "does it render?",a wrong mirror can make them all green Before M0 closes its books, after every mirror refetch
scripts/gapfill-video.mjs HLS/DASH streaming ladder backfill (master → rendition → segment), the structural blind spot of static crawlers M0 (when streaming is present)
scripts/serve.mjs Zero-dependency static server (MIME/Range/service-layer rewriting/redirect replay), also serving as the origin reference server.--rewrite FROM::TO isregistry-based literal replacement, for the sake of a class of things localization cannot reach—the source program branches on its own domain name(location.hostname=="x.com" && (CDN=...), and the mirror is not on that domain, so the entire subsystem takes the empty path);print on first hit, because silence and taking effect were previously indistinguishable.--fallback-root lets the replica side hold only outputs, with all assets read from the read-only mirror (asset-management.md 's no-copy policy);unknown flags fail loudly—a silently ignored flag is a downgrade that no one knows about Throughout from M0.5
scripts/build-site.mjs Strategy A build layer: per shell-config.mjs 's registry transform table, generate from the mirror site/, per-entry hit lower bound + --check reproducibility + purpose assertion (the lower bound shows the transform is still alive, the purpose assertion shows it achieved its purpose) M2+ (Strategy A)
scripts/verify-shell.mjs Shell byte gate: per-document patience diff, every diff block must be explainable by the transform table'sreplay. ⛔ Does not import build-site.mjs—a gate must not produce what it audits (verification-gates.md §2.1.2) M2+ (Strategy A)
scripts/verify-payload.mjs SSG payload gate: take the inline serialized data blocks (Nuxt2 window.__NUXT__ / Nuxt3 __NUXT_DATA__ / React flight self.__next_f)evaluate and expand, then structurally compare. The byte gate is insufficient here—a payload is a "program that outputs data" (parameter deduplication,\u002F escaping), so two copies can differ in bytes yet be semantically identical, or be byte-similar yet semantically different; and the service layer needs torewrite the URLs inside it. Measured: it caught an inconsistency between the two sides' localization implementations (one side kept href="http://host", the other wrote out href=""), while the shell byte gate was all green From M0.5 (when SSG payload is present)
scripts/verify-lenprefix.mjs Self-length payload gate: walk the React flight stream (the self.__next_f.pushinlined per page by Next.js App Router), advancing line by line by the declared T<十六进制> byte count, confirming the landing point is still a line start. ⭐ length-prefixed lines have no terminator—the next line's start sits right at the declared end, the length itself is the separator. Therefore anytext rewrite that changes the byte count(Localized external links) will make the reader swallow the start of the next line into the body text. Measured on eightdesign: of 115 routes, 2 rendered only 70 characters (versus 2,440 on the other side),zero 404s, zero failed requests, identical HTML byte counts, all other gates green; what located it was taking python3 -m http.server serving the same directory—both routes rendered perfectly, so the fault lay in the server and not in the bytes. ⛔ This gate mustfirst be calibrated against the origin site: the first version asserted "the line ending must be a newline" and judged every document, including the origin site's own bytes, as corrupt from M0.5 onward (when a flight payload is present)
scripts/verify-refs-served.mjs Reference reachability gate: ask the server about every resource referenceone by one(a single GET, no browser opened). ⭐ The key point isto ask the server rather than reimplement its resolution—an offline check that walks the mirror itself is a second url→path implementation, and a second implementation is a divergence waiting to be reported as a hole (measured: it reported 28 images that were present as missing, only because it did not know the server's query-variant fallback). ⚠ It cannot see URLs assembled at runtime; that is the job of the resource-level probe (§1.6 class 4) every commit from M2+
scripts/verify-offline.mjs The static half of the zero-external-connection gate: enumerate every external absolute URL in the output bytes and adjudicate each one (of the four assertion classes in §1.6, the three the resource-level probe cannot see) every commit from M0.5
scripts/beautify-bundle.mjs js-beautify@1.15.1 pinned to expand the bundle to _pretty/ and generate the regeneration instructions. ⛔ Loud warning on name collision + injectivity assertion—the main.built.js under two different directories once silently overwrote each other, and _pretty/ is the project's only traceability coordinate system; after an overwrite every line number points to the wrong file M1
scripts/module-map.mjs The layering table for modularized bundles: spawn the pinned acorn --tokenize(zero dependencies), and give per-module line ranges,requires, export names.Recognize two container kinds: the webpack object container and the Turbopack flat list(the latter writes export names directly into the container, so M(n+1) naming is almost entirely tier-1 evidence). ⛔ An unrecognized container is FATAL; ⛔⛔ whatever is recognized must also be able to explain this file—line coverage <50%, or dependency edges fewer than 25% of the require call count, is uniformly FATAL: when the container is misread the tool "succeeds" (measured: it reported 2 modules for a chunk that actually had 20 factories). ⛔ A container may define the same id repeatedly—measured: 597 properties but only 569 distinct modules, and among them 4 shadowed definitions withdifferent implementations; the semantics arefor object literals the later one wins, so the tool must deduplicate and report, otherwise the module count recorded for every document is wrong, and which copy downstream receives depends on iteration order M1 (modularized bundle output)
scripts/closure.mjs Computing from the seed modulethe transitive dependency closure, is the sole basis for the vertical-cut boundary. ⛔ Unknown seed IDs are always FATAL and give a did-you-mean—silently dropping them yields a "smaller but plausible-looking" slice, and the failure is deferred to runtime M2+ (modular bundle output)
scripts/verify-tween.mjs Vertical numeric gate: feed the same keyframe spec to both sides, compare tweened values and easing curves point by point. Fails much earlier than the pixel gatemuch earlierturn red, and the failure carries the input that produced it. ⛔ The test cases' field names and value ranges must be copied from the source code—the first version was written on intuition, and all six cases landed on the same curve, all green, zero discriminating power M2+ (when a tween/timeline engine is present)
scripts/harvest-cases.mjs Capture cases from the source-site live engine: drive the source site to N states and record, state by state, the numeric values in its own objects (the site side writes them in harvest.config.mjs, see the example in harvest.config.example.mjs). Hand-written cases encodewhat you believe the engine's parameters are—six hand-written cases once all landed on the same curve and were all green. ⛔ It only produces the A side, and must be paired with verify-harvest.mjs. ⚠ Capture theparsed numeric valuesrather than the source text M2+ (when the source-site engine is reachable)
scripts/verify-harvest.mjs The B side of the capture baseline: feed the captured identities one by one to the port and requirean exact match of exactly one(zero = missing, two = duplicate behavior in the port, mapping does not hold). ⭐ Matching bybehaviorcan alsorecover the names—the source site's easing functions are all anonymous, while the port side exports them under readable keys, so once the fingerprints match you know which curve the source page is running M2+ (when a capture baseline exists)
scripts/verify-crossside.mjs Cross-side gate: feed the same input to both the mirror and the port and compare the results one by one (the site side writes them in crossside.config.mjs, see the example in crossside.config.example.mjs). Use it when the source siteexposes a seam: even without a module registry, the bundle may have top-level module side effects such as window.<Name> = —grab that one seam in the orchestration layer, and the coverage far exceeds its size. ⛔ Evaluate the two sidesserially, and fingerprint both sides on every run;identical URLs are directly FATAL—concurrent probes make the second one attach to the browser launched by the first, measuring one side twice and reportingperfect consistency. ⛔ Split cases into judged(condition-independent, must be byte-for-byte identical) and info(condition-dependent, only printed but both sides must be able to parse them) M2+ (when the source site has a directly callable seam)
scripts/slice-modules.mjs Slice verbatim by module id: the boundaries are given by the bundler, so the slice table is just a list of ids, and the tool can self-check (--check re-slicing must be byte-identical). The transcribed webpack runtime is registered as a deviation at the file header M2+ (modular bundle output)
scripts/extract-source.mjs Byte slicer: slice by pinned line-number ranges _pretty/ concatenated into generated files (sha256 guard + slice table + alias/stub table,--check enter the door), port the preferred form verbatim (§2.2; configuration example scripts/slices.config.example.mjs) M2+ (verbatim porting period)
scripts/probe.mjs CDP headless probe (CLEAN determination for console/exceptions/network, exit code into CI;--no-external assert zero outbound connections,--walk full-scroll walkthrough) from M0.5, every commit
scripts/verify-routes.mjs Route/redirect/status-code contract gate M2+
scripts/verify-ssr.mjs SSR/DOM byte-for-byte gate M2+ (build first when SSR artifacts exist)
scripts/pixelcompare.mjs Quantitative pixel comparison (coarse-grid similarity + metric output).When viewport ≳ 1500×900, PNG exceeds the CDP payload hard cap, switch to --format jpeg --quality 92。before producing output, first pass the non-empty-frame precondition—comparing two empty frames reports meanAbsDiff 0 / 相似度 100, same shape as a perfect result (measured: freezing stops the engine before the first frame, all three routes report 0, and that was 201 colors, 99.5% pure black);--pump dt,frames is probe-shim's first-class drive entry point, andpump interleaved with real time—a frozen page's startup still waits for assets on wall-clock time; pumping everything at once after settle leaves the engine forever unable to get the "assets have arrived" frame (determinism.md §2.9.1)。--self isa legitimate channel for self-comparison bandwidth(the measurement required by §1.3.2 is by definition one side compared with itself, and would be blocked by the cross-side false-green guard)—artifacts marked kind:"self-band", and --max-mean is void for it: bandwidth is classifiedinput, not a verdict M(n-1)
scripts/side-by-side.mjs Side-by-side composite of both sides' screenshots (comparison artifacts kept as evidence) M(n-1)
scripts/frame-census.mjs Is there anything on this frame: count the screenshot's color count and dominant-color share. ⛔ The pixel gate already has the same criterion built in as a precondition; this script is for post-hoc re-checking of arbitrary screenshots—§4.8the state in which "all the gates shot into the same state" may beempty, and before this no gate asked that question M(n-1)
scripts/probe-shim.js Deterministic drive shim (takes over the entire entropy surface: rAF/timer/performance.now/Date.now/seeded Math.random/IntersectionObserver, manual pumping to any t, same-position injection on both sides). ⭐ IO is also a clock—the browser delivers cross-records at its own pace, so a scroll-reveal site cannot be frozen; after takeover, measured bandwidth 0.31 → 0.04, the gate's usable threshold tightened from 0.5 to 0.1 M(n-1)
scripts/dump-timelines.mjs Dump GLB animation curves into a JSON numeric ledger M1 (when animating from data)
tools/name-modules.mjs Module nomination: a modular bundle's id is a content hash, so the filename must come from evidence. Nominate by evidence level 0–4 and record thesentence it is based onalong with it (human adjudication / self-registration and global / multi-consumer field name / constant value and naming prefix / error subject), ⛔ keep the id when there is no evidence—a wrong name is worse than a hash. ⭐ The strongest evidence is outside the module: property names are not minified, andthis._chapterPlayer = new M(…) can name an anonymous class {} Naming M(n+1) (modular build output)
scripts/cold-audit-modules.mjs M(n) cold-open inventory (modular output): reconcile module by module, and check whether there is anycomputed require(recognizes both webpack and Turbopack factory signatures).⛔⛔ must report n/N examined and use coverage as the criterion—it once reported green without checking a single module; after changing to "only error when 0", it reported green when 1/20 had been checked.⛔ Testing caught a conditional require (require(t ? "a" : "b")) causing the closure to undercount by two modules,while 9 checkpoints were all-zero pixel by pixel with no detection.⚠ The zero-dependency stage cannot resolve scope shadowing, so it onlydetermines"whether any unported module is required by a ported module"; suspected dynamic require are listed for human reading M(n) (modularized bundle output)
scripts/verify-module-map.mjs M(n+1) equivalence gate (modularized output): one module per file, and each file is byte-identical to the bundler's at the token level(only the one-to-one mapping of the wrapper renaming group is allowed).⛔ Undoing the renaming with text and comparing back will fail—module.exports in exports is a property name;a gate that uses a shortcut will end up testing its own shortcut.⛔ The gate is also not allowed to rerun the renaming to compare M(n+1) (modularized bundle output)
scripts/pixelcompare.mjs of --freeze-css ⛔ freezing the JS clock cannot freeze CSS animations——animation runs on the browser animation timeline, bypassing JS. The symptom isthe same-side control being larger than the cross-sideand the worst cells being identical. This flag puts all animations paused + a fixed negative delay pinned to the same phase (⚠ it changes the rendered content, which is exactly the point: both sides freeze at the same position). Measured bandwidth 0.31 → 0.20,still not zero: what remains is the IntersectionObserver-gated canvas, which the shim does not yet take over M(n-1) (CSS-driven site)
scripts/pixel-walk.mjs checkpoint cruise: run the pixel gate once at each of N scroll positions.⛔ scroll twice(load plus once more at virtual time +1.5s)—if the page resets scroll in its own init, it willeat the one at load time, so all checkpoints capture the top of the page and both sides are consistently all-green.⛔ repeated frames must be reported cell by cell: a global distinct count still passes when "3 of 9 cells are repeated".⛔ a single 0.00 is the most misleading number this toolset can produce—it is one frame, usually the first two seconds at the top of the page.⚠ First use --self to measure bandwidth at the same checkpoints: measured, unfrozen, self vs self 4.6–5.0, cross-side 2.6–3.4,the difference falls entirely within noise; after freezing both go to zero M(n-1)
scripts/verify-decls.mjs(paradigm, not provided by this skill) esbuild-style classification gate: module bodies are wrapped in var X = VA(() => {…}) lazy wrappers, bindings appear as comma chains, and a bijective symbol gate goes massively false-red here. The correct shape is to classify every port declaration into declarations / collapsed / plumbing / omitted exactly one bucket, and conversely require every src declaration to have a source or a registered reason.⭐ The shape of the gate must follow the shape of the artifact(readable-source.md §3.0.5) M(n)/M(n+1) (esbuild artifacts)
scripts/verify-symbols.mjs Symbol mapping gate:port/ Every top-level declaration in src/ has exactly one corresponding symbol (a bidirectional injection, read docs/rename-map.json), and src/ contains no orphan declarations without a source. ⛔ Must not be optional—the gate only runs a finite number of routes, so code that was never run but got broken still leaves the gate green; this is the isomorphic counterpart of cold-start inventory in the refactoring phase. ⛔ Read only rename-map.json and the text on both sides;do not import the refactorer's parser to "confirm" the rename M(n+1)
scripts/verify-fresh.mjs Freshness gate:src/ → dist/ → site/ is in sync. ⛔ On the chain,as long as one step is missing --check, the green light of the whole chain may be stale—a stale artifact is still served, and downstream gates are still all green (they compare the artifact against the mirror, not the artifact against the source). ⛔ Timestamps are not the criterion: in one measurement mtime showed stale while the rebuild was byte-identical. ⚠ You must check both "whether the artifact is what the source builds now" and "whether that is the copy being served"—check only the former and the gap just moves one step downstream M(n+1) (every time when there is a build step)
scripts/verify-standalone.mjs Self-contained gate: copy src/ to a temp directory → go offline → install → build → run CLEAN and zero external connections. ⛔ Must be copied out and run there—running in place will hit the project root's node_modules/mirror//root package.json, and these three are exactly what self-containment is meant to falsify M(n+1)
scripts/verify-zerodep.mjs Dependency boundary gate:scripts/ no import other than node: may appear under it, and no gate may import tools/. ⚠ The reason it exists is that this disciplinewas violated for eight versionswithout anyone noticing—its original text was written three lines above the file being violated.A rule written only in docs, with nothing checking it, will silently fail Each time a script is added
scripts/lib/png.mjs Zero-dependency PNG encoding/decoding Cross-check script dependency
scripts/lib/chrome.mjs Headless browser lifecycle (process groupreaping + all exit paths + orphan self-check before startup; leaking child processes raises the reference-side self-comparison bandwidth and loosens the pixel gate) and the CDP payload hard-cap constant.node scripts/lib/chrome.mjs --all/--reap can check/reclaim leftovers All CDP scripts depend on it

Replicate the project directory structure

Three staged artifacts,one-way dependency, read as "evidence → port → source":

<site>-rebuild/
├── mirror/               # ① 只读证据:源站 URL 空间的字节级还原。永不修改
│   └── _pretty/          #    beautify 展开产物 + 再生成说明 README
├── port/                 # ② 逐字移植:机器读,extract-source --check 守着字节一致。永不手改
│   └── _gen/             #    切片器产物(行号头指回 mirror/_pretty/)
├── src/                  # ③ 人写的工程:可读、可改、自包含(复制到任何地方都能跑)
│   ├── package.json      #    ⛔ 自己的 package.json——自包含门要把它复制出去单独跑
│   ├── assets/           #    资产在这里(③ 阶段必须复制,见 readable-source.md §2)
│   └── README.md         #    怎么跑 / 坐标系怎么读 / 哪些注释是我们写的
├── docs/
│   ├── engine-notes.md   # 逆向笔记(事实/怪癖/复刻结论三段式)
│   ├── rename-map.json   # ③ 阶段符号映射(port 位置 → 旧名 → 新名 → 依据档位)
│   └── compare/          # 对拍产物留证
├── REBUILD_PLAN.md       # §0 纪律 / 阶段计划 / §6 偏差表 / §Q 怪癖表 / §7 里程碑日志
├── mirror-manifest.json  # 镜像账本(sha256 逐文件)
├── scripts/              # 判据与前置工序:零依赖,从本 skill 拷入
└── tools/                # 重构器:③ 阶段专用,允许 devDependencies(见下)

⛔ src/ if you find behavior is wrong, the answer is in port/ or mirror/, not in src/。 "fixing it in place until it's right" turns a porting bug into an untraceable local patch,and the gate will go green—this is discipline 2 in the form of the three-stage coordinate system.port/ in src/ is not deleted after it is built; it is the other end of the equivalence.

⭐ Dependency boundaries by stage:Zero dependencies before becoming source—the project only gets devDependencies at M(n+1).scripts/(Criteria and prerequisite steps) Zero dependencies; when necessary, spawn npx with pinned versions;tools/(Source-ification refactorer) devDependencies are allowed. No gate may import any refactorer. Guarded by scripts/verify-zerodep.mjs .

References

Load on demand (determined by Step 0/1 and the branch routing table); do not read everything at the start:

Notes

  • Copyright red line: This skill is for recreation for learning purposes. Output is private + noindex by default (a safe default, not a legal conclusion); before public deployment, per-asset copyright forensics must be completed, the decision handed back to the user, and the work prominently labeled as an unofficial recreation with attribution to the original author. The biggest risk is legal, not technical—butlegal judgment is made by the user, and is never used to reduce mirror completeness or gate coverage。
  • Schedule expectations: In the methodology's mature form, a single-page creative site takes 1-3 days (dozens of commits); a multi-scene WebGL portfolio site takes weeks. Refer to the Step 1 difficulty rating when giving estimates to the user.
  • When comparison fails, suspect the environment first: Background throttling, HMR ghost modules, probe clocks, and missing headless fonts all masquerade as code bugs. Before concluding there is a source problem, go through the calibration checklist in environment-traps.md.
  • When encountering scenarios not covered by this skill (Type B gaps), explicitly tell the user "there is no established guide for this part; proceed according to general discipline," and record the new experience in the project documentation—they are the input for the next version of the skill.