snapshot-to-nextjs
npx skills add https://github.com/yigitkonur/skill-snapshot-to-nextjs --skill snapshot-to-nextjs
Agent 安装分布
Skill 文档
Snapshot to Next.js
Convert saved HTML pages into pixel-perfect Next.js projects
Mission: Take saved HTML snapshots â produced by browser “Save As”, wget, HTTrack, SingleFile, or any offline capture tool â and convert them into a fully buildable Next.js App Router project with zero third-party dependencies.
The pipeline can also produce intermediate design documentation (Waves 0â2 only) when a full build isn’t needed yet.
This is not a summarizer. This is not a screenshot describer. This is a forensic CSS parser that reads every minified rule, decodes every CSS Module class name, resolves every custom property chain, catalogs every @keyframes block, and maps every @media breakpoint â then builds a production-ready Next.js project from it.
Every design value traces to real CSS/JS from the source snapshot. No approximations. No invented tokens. No “close enough.” The downstream builder implements your values literally â an unverified guess is worse than an honest gap.
Input Specification
This skill is designed for saved HTML snapshots â the kind produced by browser “Save As”, wget, HTTrack, SingleFile, or any offline snapshot tool.
Expected Directory Structure
source-pages/
âââ {site}-homepage.html # Full HTML (minified, often 1-2MB)
âââ {site}-homepage_files/ # Companion assets folder
â âââ 06cc9eb5faccd3be.css # Minified CSS (hashed filenames, 12+ files)
â âââ 8422-c4149e3ed1566f84.js # JS bundles (minified)
â âââ f79251b06e9e...352x352.png # Images / SVGs / favicons
â âââ Inter-roman.var.woff2 # Font files
âââ {site}-pricing.html
âââ {site}-pricing_files/
âââ {site}-features.html
âââ {site}-features_files/
âââ ...
Auto-Detection Logic
On first scan of the input directory, detect the input type:
# Step 1: Find all HTML files
find . -maxdepth 2 -name "*.html" -o -name "*.htm" | sort
# Step 2: Classify each
for f in *.html; do
base="${f%.html}"
if [ -d "${base}_files" ]; then
echo "SNAPSHOT: $f â ${base}_files/ ($(ls ${base}_files/*.css 2>/dev/null | wc -l) CSS files)"
else
echo "SINGLEFILE: $f ($(grep -c '<style' "$f" 2>/dev/null) <style> blocks)"
fi
done
[ -f "package.json" ] && echo "SOURCE REPO: package.json found"
Auto-Detection Table
| Signal | Input Type | Behavior |
|---|---|---|
.html files + _files/ directories |
Saved snapshot | Primary mode â grep minified CSS, decode CSS Module names, extract from companion folders |
.html with <style> blocks only, no _files/ |
SingleFile export | Inline CSS mode â extract from <style> tags within the HTML |
package.json + src/ directory |
Source repository | Fallback mode â read component files directly, parse tailwind.config.*, follow imports |
Key Characteristics of Saved Snapshots
- CSS is MINIFIED â single-line blobs, 100â400KB each, 12+ files per page
- Filenames are hashed (
06cc9eb5faccd3be.css) â no semantic meaning in filenames - Class names follow the CSS Module pattern:
ComponentName_propertyName__hashCode - CSS custom properties (
--color-*,--font-*,--ease-*) form the design system backbone - HTML preserves semantic tags:
<header>,<main>,<section>,<footer>,<nav> - Inline
style=""attributes frequently reference CSS variables viavar(--token-name) - Each HTML file represents one page type (homepage, pricing, features, about, etc.)
- Same CSS file often appears in multiple
_files/folders â deduplication is mandatory - JS bundles contain behavior logic: scroll animations, intersection observers, dynamic class toggling
Output Specification
The pipeline produces TWO output trees. Extraction-only mode (Waves 0â2) produces the first. Full reconstruction (Waves 0â4) produces both.
Tree 1: Design Documentation (.design-soul/)
.design-soul/ â Intermediate extraction docs
âââ wave0/ â Per-page deep exploration
â âââ homepage/
â â âââ exploration.md # Section inventory + CSS token map + behavior map
â â âââ deobfuscated.css # Full CSS with semantic class names
â â âââ behavior-spec.md # JS behaviors as declarative specs
â â âââ assets/ # Downloaded fonts, images, icons, videos
â â â âââ fonts/
â â â âââ images/
â â â âââ icons/
â â âââ done.signal # Empty file = this agent completed
â âââ pricing/
â â âââ exploration.md
â â âââ deobfuscated.css
â â âââ behavior-spec.md
â â âââ assets/
â â âââ done.signal
â âââ {additional-pages}/
âââ wave1/ â Design soul per page-type group
â âââ landing/
â â âââ design-soul.md # Unified visual DNA for this group
â â âââ token-values.json # Machine-readable tokens (all traced)
â â âââ component-inventory.md # Every repeating UI element
â â âââ responsive-map.md # Breakpoint behavior per component
â â âââ cross-site-patterns.md # Patterns shared across pages in group
â â âââ done.signal
â âââ {additional-groups}/
âââ wave2/ â Build briefs per page
â âââ homepage/
â â âââ agent-brief.md # Self-contained build instructions
â â âââ done.signal
â âââ pricing/
â â âââ agent-brief.md
â â âââ done.signal
â âââ {additional-pages}/
âââ wave3/ â Design system foundation docs
âââ foundation-brief.md # How Wave 4 agents use the design system
âââ traceability-matrix.md # Token â Wave 2 brief â Wave 0 source
âââ foundation-ready.signal # ONLY written after quality gate passes
Tree 2: Buildable Next.js Project (nextjs-project/)
nextjs-project/ â Buildable project (Waves 3â4 only)
âââ app/ # App Router page routes
â âââ layout.tsx # Root layout with fonts + global styles
â âââ page.tsx # Homepage
â âââ pricing/page.tsx # Pricing page
â âââ {additional-routes}/page.tsx
âââ components/
â âââ shared/ # Shared components (header, footer, CTA)
â â âââ Header.tsx
â â âââ Footer.tsx
â â âââ ...
â âââ pages/ # Page-specific components
â âââ homepage/
â â âââ Hero.tsx
â â âââ FeatureGrid.tsx
â â âââ ...
â âââ pricing/
â âââ PlanCards.tsx
â âââ ComparisonTable.tsx
â âââ ...
âââ lib/
â âââ tokens.ts # Typed design tokens from REAL CSS
â âââ animations.ts # Animation utilities from extracted @keyframes
âââ styles/
â âââ globals.css # @font-face declarations + CSS custom properties
âââ public/
â âââ assets/ # Self-hosted fonts, images, icons
â âââ fonts/
â âââ images/
â âââ icons/
âââ tailwind.config.ts # Extended with REAL extracted values
âââ postcss.config.js # Standard PostCSS with Tailwind + autoprefixer
âââ package.json # ONLY: next, react, react-dom, typescript, tailwindcss
âââ tsconfig.json # strict: true
âââ next.config.js # Minimal Next.js config
Philosophy: Seven Principles
1. Parse, Don’t Guess
CSS is minified but COMPLETE. Every value the browser renders exists somewhere in those .css files. Use grep -oE with regex patterns to extract values programmatically. Never infer from visual appearance. Never assume based on “what looks like 16px.” If a value cannot be found in CSS/HTML, mark it UNVERIFIED â do not invent it.
2. CSS Module Names Are Your Map
The CSS Module naming convention is the most reliable section identifier in saved snapshots:
Header_root__x8J2p â Component: Header, Element: root
Plans_card__SCfoV â Component: Plans, Element: card
CTA_sectionPrefooter__kW_wF â Component: CTA, Element: sectionPrefooter
CustomerMarquee_logos__abc â Component: CustomerMarquee, Element: logos
The prefix before the first underscore IS the section identifier â more reliable than HTML nesting, more precise than semantic tags. This is your primary map.
3. Every Page Is a Page Type
Each .html file represents exactly one page type. linear-homepage.html â page type “homepage”. stripe-pricing.html â page type “pricing”. Document and extract each independently. Cross-page analysis happens in Wave 1 after individual extraction.
4. CSS Variables Are the Design System
Custom properties (--color-brand-bg, --font-weight-medium, --ease-out-quad) declared in :root or [data-theme] selectors ARE the foundation tokens. They are the skeleton that every section references. Extract them FIRST â the entire downstream pipeline depends on resolved token values.
5. Shared Sections, Documented Once
Header and Footer appear on every page. Navigation may be identical or vary slightly per page (transparent vs. solid header). Document the base version once, note page-specific variations as overrides. Never duplicate full documentation across pages.
6. Build What You Extract
Every documented value becomes runnable code. If it’s in the design soul docs, it goes in the Next.js project. No “aspirational” documentation. No tokens that don’t map to real CSS. The documentation IS the specification for the build â they must be 1:1.
7. Zero External Dependencies
The final Next.js project uses ONLY these packages: next, react, react-dom, typescript, tailwindcss, @types/react, @types/node, postcss, autoprefixer. No CDN fonts â self-host them. No icon libraries â inline SVGs. No animation libraries â CSS transitions and @keyframes only. No component libraries â build from scratch using extracted specs. All assets self-hosted in public/.
The Grounding Rule (Non-Negotiable)
Every value documented in any wave must trace to exactly one of these sources:
- A CSS rule in a
_files/*.cssfile â cite the filename and selector - A CSS custom property declaration in
:rootor[data-theme]â cite the filename and selector - An inline
style=""attribute in the HTML â cite the element and attribute - A
<style>block in the HTML â cite the block context - A
@keyframesor@mediarule in CSS â cite the filename and rule name
If you cannot find a source for a value:
- Mark it as
UNVERIFIED â not found in snapshot CSS/HTML - Do NOT invent “close enough” values
- Do NOT round to convenient numbers (e.g., “roughly 16px” â NO)
- Do NOT assume a value matches a common design framework default
The downstream builder implements your values literally. An unverified guess produces a wrong pixel. An honest gap produces a searchable TODO.
Section Identification Hierarchy
When identifying sections within a page, follow this priority order:
-
Semantic HTML tags â
<header>,<main>,<section>,<footer>,<nav>are first-class section markers. These are the most reliable structural boundaries. -
CSS Module class prefixes â
Header_,Hero_,Plans_,CTA_,Footer_â each unique prefix corresponds to a distinct visual section. The prefix IS the component name. -
Structure heuristics (fallback only) â When neither semantic tags nor CSS Module prefixes are available, fall back to large container elements with distinct visual boundaries (background color changes, significant padding shifts, full-width dividers).
Extract the prefix map from any page:
grep -oE '[A-Z][a-zA-Z]+_[a-zA-Z]+__[a-zA-Z0-9]+' page.html | sed 's/_[a-zA-Z]*__[a-zA-Z0-9]*$//' | sort -u
This produces a clean list of component names present on that page. Cross-reference with the references/website-patterns.md catalog for section-type mapping.
CSS Module Decoding
Pattern
ComponentName_propertyName__hashCode
Decoding Table
| Raw Class | Component | Element | Hash (ignore) |
|---|---|---|---|
Header_root__x8J2p |
Header | root | x8J2p |
Header_nav__abc12 |
Header | nav | abc12 |
Hero_headline__Kz9mQ |
Hero | headline | Kz9mQ |
Plans_card__SCfoV |
Plans | card | SCfoV |
Plans_price__3xR7t |
Plans | price | 3xR7t |
CTA_sectionPrefooter__kW_wF |
CTA | sectionPrefooter | kW_wF |
Footer_links__m2nP4 |
Footer | links | m2nP4 |
CustomerMarquee_logos__Yp8sK |
CustomerMarquee | logos | Yp8sK |
Utility Prefixes (NOT Sections)
Some CSS Module prefixes are utility classes, not section identifiers:
| Prefix | Type | Meaning |
|---|---|---|
Flex_ |
Utility | Flexbox layout helper |
Grid_ |
Utility | CSS Grid layout helper |
Container_ |
Utility | Width constraint wrapper |
Spacer_ |
Utility | Spacing utility |
Text_ |
Utility | Typography utility |
Icon_ |
Utility | Icon sizing/alignment utility |
These appear INSIDE sections but do not define section boundaries. Filter them out when building the section inventory.
Wave 0 â Per-Page Deep Exploration & Deobfuscation
Trigger: Orchestrator scans source-pages/ and finds .html files with _files/ companion directories
Agents: 1 per page (ALL run in parallel)
Input: One {page}.html + its {page}_files/ folder
Output: .design-soul/wave0/{page}/
Pre-Flight: Input Scan
Before spawning agents, the orchestrator must:
# 1. Inventory all pages
find source-pages/ -maxdepth 1 -name "*.html" | sort
# 2. Verify companion folders exist
for f in source-pages/*.html; do
base="${f%.html}"
if [ -d "${base}_files" ]; then
css_count=$(ls "${base}_files"/*.css 2>/dev/null | wc -l)
js_count=$(ls "${base}_files"/*.js 2>/dev/null | wc -l)
echo "READY: $(basename $f) â ${css_count} CSS, ${js_count} JS"
else
echo "WARNING: $(basename $f) has no _files/ companion"
fi
done
# 3. Deduplicate CSS across all _files/ folders
find source-pages/ -name "*.css" -path "*_files*" -exec md5 -r {} \; | sort | uniq -d -w 32
Agent Spawning
For EACH .html file found, spawn one Wave 0 agent with:
- Path to the
.htmlfile - Path to its
_files/folder - Shared CSS dedup map (so agents don’t re-process identical files)
- Instruction: “Read
references/foundations-agent.mdand execute Wave 0 extraction for this page”
What Each Agent Produces
-
exploration.mdâ Complete section inventory with:- Ordered list of every section found (top â bottom)
- CSS Module prefix map with element counts per prefix
- CSS token map: every custom property used, its declaration, its resolved value
- Responsive behavior map: what changes at each
@mediabreakpoint - Animation catalog: every
@keyframes,transition, andtransformwith trigger context - Font inventory: every
font-family+@font-facesource - Color inventory: every unique color value (hex, rgb, hsl, custom property)
-
deobfuscated.cssâ ALL CSS from_files/*.cssfiles:- Concatenated into a single file
- Deduplicated (identical rules removed)
- Obfuscated class names mapped to semantic names via comment annotations
- Example:
.Plans_card__SCfoV { ... }â annotated as/* Section: Plans, Element: card */
-
behavior-spec.mdâ JS behaviors documented as declarative specifications:- Each behavior: trigger â target element â effect â timing â easing
- Scroll-triggered animations (IntersectionObserver patterns)
- Hover/focus/active state changes driven by JS class toggling
- Dynamic content loading (lazy images, deferred sections)
- Navigation behavior (mobile menu toggle, dropdown logic)
- NO raw JS code â only declarative specs a builder can implement
-
assets/â All referenced external assets:assets/fonts/â All font files (.woff2, .woff, .ttf) from@font-facedeclarationsassets/images/â All images referenced in HTML or CSS (backgrounds, heroes, logos)assets/icons/â SVG icons extracted from inline SVGs or external references- Asset manifest listing source URL â local path for each file
-
done.signalâ Empty file written ONLY after all other outputs are complete
Completion Gate
Wave 0 is complete when ALL wave0/{page}/done.signal files exist. The orchestrator must verify:
# Count expected vs actual signals
expected=$(find source-pages/ -maxdepth 1 -name "*.html" | wc -l)
actual=$(find .design-soul/wave0/ -name "done.signal" | wc -l)
[ "$expected" -eq "$actual" ] && echo "WAVE 0 COMPLETE" || echo "WAVE 0 INCOMPLETE: $actual/$expected"
Do NOT proceed to Wave 1 until this gate passes.
Wave 1 â Design Soul Extraction (Page-Type Grouping)
Trigger: ALL Wave 0 done.signal files exist
Agents: 1 per page-type group (ALL run in parallel)
Input: All wave0/ docs for pages in each type group
Output: .design-soul/wave1/{group}/
Page-Type Grouping
Before spawning Wave 1 agents, classify every page into a type group:
| Page Indicators | Group Name | Typical Pages |
|---|---|---|
| Hero + feature sections + CTA | landing |
Homepage, product pages |
| Plan cards + comparison tables | pricing |
Pricing, plans |
| Feature detail grids + demos | features |
Features, integrations |
| Blog post layout + article body | content |
Blog, docs, changelog |
| Team bios + company info | about |
About, careers, team |
| All sections in one HTML file | single |
Single-page sites |
Grouping criteria (in priority order):
- Shared navigation structure â same nav items = same group
- Section composition overlap â >60% shared CSS Module prefixes = same group
- Visual treatment similarity â same background pattern, typography scale, spacing rhythm
If only one page exists â group name is single.
Agent Spawning
For EACH page-type group, spawn one Wave 1 agent with:
- List of
wave0/{page}/directories belonging to this group - All
exploration.mdfiles from those directories - All
deobfuscated.cssfiles from those directories - Instruction: “Read
references/sections-agent.mdand extract the unified design soul for this page-type group”
What Each Agent Produces
-
design-soul.mdâ Unified visual DNA for this page-type group:- Typography system: font families, weight scale, size scale, line heights, letter spacing
- Color system: named palette, semantic color roles, dark mode mapping (if present)
- Spacing system: padding scale, margin patterns, gap values, section rhythm
- Component anatomy: how each UI element is composed (container â children â leaf)
- Layout patterns: grid systems, flex patterns, max-width constraints, alignment
- Responsive architecture: breakpoint strategy, layout shifts, typography scaling
- Motion language: easing curves, duration scale, trigger patterns, stagger timing
-
token-values.jsonâ Machine-readable token values:{ "colors": { "--color-bg-primary": "#0a0a0a", "source": "homepage_files/06cc9eb.css :root" }, "typography": { "--font-display": "'Inter', sans-serif", "source": "homepage_files/a3b2c1.css :root" }, "spacing": { "--section-padding-y": "120px", "source": "homepage_files/06cc9eb.css .Hero_root" }, "breakpoints": { "tablet": "768px", "desktop": "1024px", "wide": "1280px" } }Every value MUST include its source file and selector.
-
component-inventory.mdâ Every repeating UI element:- Component name (from CSS Module prefix)
- Anatomy breakdown (root â child elements)
- Visual variants (if any: primary/secondary, light/dark)
- Interactive states (hover, focus, active, disabled)
- Responsive behavior (layout changes per breakpoint)
- Shared vs. page-specific classification
-
responsive-map.mdâ Breakpoint behavior per component:- Every
@mediaquery found in the CSS, sorted by breakpoint - What changes at each breakpoint: layout, font sizes, spacing, visibility
- Mobile-first vs. desktop-first detection
- Components that hide/show at specific breakpoints
- Every
-
cross-site-patterns.mdâ Patterns shared across pages in this group:- Section ordering conventions (Hero always first, CTA always before Footer)
- Visual rhythm (alternating light/dark sections, padding consistency)
- Content density patterns (text-heavy vs. visual-heavy sections)
- CTA placement strategy (frequency, visual weight, spacing from content)
-
done.signalâ Empty file, written ONLY after all outputs complete
Landing Page Reality Check
Wave 1 agents processing landing pages and marketing sites must understand these anatomical patterns and document them explicitly:
- Hero composition â Headline hierarchy (display â heading â subtext), CTA placement relative to copy, visual weight distribution (text vs. media), background treatment (gradient, image, video, animated)
- Social proof strategy â Logo bar position (immediately after hero or deeper), testimonial format (cards, quotes, video), stats/metrics placement, trust signals
- Feature presentation â Grid layout vs. alternating left/right, icon usage (inline SVG, custom illustrations), description density, interactive demos
- Pricing hierarchy â Card emphasis (which plan is “recommended”), comparison table structure, toggle (monthly/annual), feature differentiation strategy
- CTA rhythm â Primary vs. secondary CTA styling, spacing between CTA sections, urgency signals, CTA copy patterns
- Conversion architecture â How sections flow toward action: awareness â interest â trust â decision â action
Completion Gate
Wave 1 is complete when ALL wave1/{group}/done.signal files exist.
Wave 2 â Page Build Brief Manufacturing
Trigger: ALL Wave 1 done.signal files exist
Agents: 1 per page (batch: up to 3 same-type pages per agent)
Input: wave1/{group}/ soul docs + wave0/{page}/ raw data
Output: .design-soul/wave2/{page}/
Agent Spawning
For EACH page (or batch of up to 3 same-type pages):
- The relevant
wave1/{group}/design-soul.mdandtoken-values.json - The page’s
wave0/{page}/exploration.mdanddeobfuscated.css - The page’s
wave0/{page}/behavior-spec.md - Instruction: “Read
references/section-template.mdand create a complete, self-contained build brief for this page”
What Each Agent Produces
-
agent-brief.mdâ Self-contained build instructions that follow the Wave 2 template. This document must be complete enough that a Wave 4 agent can build the page from this brief ALONE, without accessing Wave 0 or Wave 1 outputs. -
done.signalâ Written only after the brief passes completeness checks
Brief Completeness Rule
Every agent-brief.md MUST include ALL of the following sections:
| Section | Contents | Why Required |
|---|---|---|
| Page Identity | Route path, page title, meta description, page type | Builder needs routing and SEO |
| Section Blueprint | Every section topâbottom with full visual spec | Builder needs the complete page structure |
| Component Manifest | Every component tagged SHARED or PAGE-SPECIFIC | Builder knows what to import vs. create |
| Token Reference | All design tokens used on this page with values | Builder doesn’t need to look up tokens |
| Asset Reference Table | wave0/ path â public/ destination for every asset |
Builder knows where every image/font goes |
| Interaction Spec | Every animation/transition: trigger â effect â timing â easing | Builder implements exact motion |
| Responsive Spec | Layout at every breakpoint for every section | Builder handles all screen sizes |
| State Variants | Hover, focus, active, disabled for every interactive element | Builder implements all states |
| Acceptance Criteria | Specific visual assertions that must pass | Builder can self-verify |
Brief Self-Containment Test
Ask: “If I gave this brief to a developer who has NEVER seen the original website and has NO access to Wave 0 or Wave 1 outputs â could they build a pixel-perfect page?” If not, the brief is incomplete.
Completion Gate
Wave 2 is complete when ALL wave2/{page}/done.signal files exist.
Wave 3 â Design System Foundation & Next.js Scaffold
Trigger: ALL Wave 2 done.signal files exist
Agents: 1 orchestrator agent (may spawn specialist sub-agents for complex tasks)
Input: ALL wave2/ briefs + ALL wave1/ soul docs
Output: nextjs-project/ scaffold + .design-soul/wave3/
What the Orchestrator Produces
1. nextjs-project/ â Complete project scaffold:
| File/Directory | Contents | Source |
|---|---|---|
package.json |
Dependencies: ONLY next, react, react-dom, typescript, tailwindcss, @types/react, @types/node, postcss, autoprefixer | Wave 3 constraint |
tsconfig.json |
strict: true, path aliases for @/components, @/lib |
Standard Next.js |
tailwind.config.ts |
Extended theme with REAL breakpoints, colors, fonts, spacing from Wave 1 tokens | wave1/*/token-values.json |
postcss.config.js |
Standard PostCSS: tailwindcss + autoprefixer | Standard |
styles/globals.css |
@font-face declarations for all self-hosted fonts + CSS custom properties from :root |
wave0/*/assets/fonts/ + wave1/*/token-values.json |
lib/tokens.ts |
Typed TypeScript constants for all design tokens | wave1/*/token-values.json |
lib/animations.ts |
Animation utility functions from extracted @keyframes and transition patterns |
wave0/*/behavior-spec.md |
components/shared/ |
Shared component shells (Header, Footer, etc.) with props interfaces | wave2/*/agent-brief.md component manifests |
app/layout.tsx |
Root layout importing fonts, globals.css, shared header/footer | All wave outputs |
app/*/page.tsx |
Route stubs for every page with placeholder content | wave2/ page list |
2. .design-soul/wave3/ â Foundation documentation:
-
foundation-brief.mdâ Instructions for Wave 4 agents on how to use the design system:- How to import and use
tokens.ts - How to use
animations.tsutilities - How to extend shared components
- Tailwind class conventions (when to use Tailwind vs. tokens.ts)
- Responsive approach (mobile-first, breakpoint naming)
- Asset path conventions (
/assets/fonts/,/assets/images/)
- How to import and use
-
traceability-matrix.mdâ Complete trace from tokens to source:Token Name â Wave 2 Brief Reference â Wave 0 Source File --color-bg-primary â homepage/agent-brief.md:L42 â homepage_files/06cc9eb.css :root --font-display â homepage/agent-brief.md:L18 â homepage_files/a3b2c1.css :root section-padding-desktop â pricing/agent-brief.md:L67 â pricing_files/8f2a1b.css .Plans_root -
foundation-ready.signalâ Written ONLY after the quality gate passes
Foundation Quality Gate
Before writing foundation-ready.signal, verify ALL of these conditions:
| Check | Verification Method | Pass Criteria |
|---|---|---|
| Token coverage | Diff tokens.ts exports vs. all wave2/*/agent-brief.md token references |
100% of referenced tokens exist in tokens.ts |
| Shared components | List SHARED-tagged components across all Wave 2 briefs | Every SHARED component has a file in components/shared/ |
| Breakpoints | Compare tailwind.config.ts breakpoints vs. Wave 1 responsive-map.md |
All source breakpoints represented |
| Font loading | Verify @font-face in globals.css references files in public/assets/fonts/ |
All fonts self-hosted and loadable |
| Animations | Check animations.ts covers all Wave 2 interaction specs |
All shared animation patterns defined |
| Zero deps | Read package.json dependencies |
NO UI libraries, NO animation libraries, NO icon libraries, NO font CDN packages |
| TypeScript | tsc --noEmit passes |
Zero errors |
| Route stubs | Count app/*/page.tsx files vs. Wave 2 page count |
Every page has a route |
Read references/system-template.md for the complete quality gate specification and scaffold structure.
Completion Gate
Wave 3 is complete when .design-soul/wave3/foundation-ready.signal exists.
Wave 4 â Full Page Build (Pixel-Perfect Reconstruction)
Trigger: .design-soul/wave3/foundation-ready.signal exists
Agents: 1 per page (or per batch of up to 3 same-type pages)
Input: wave2/{page}/agent-brief.md + wave3/foundation-brief.md
Output: app/{route}/page.tsx + components/pages/{page}/
Agent Spawning
For EACH page (or batch of up to 3 same-type pages), spawn one Wave 4 agent with:
- The page’s
wave2/{page}/agent-brief.md(complete build spec) - The
wave3/foundation-brief.md(how to use the design system) - Path to
nextjs-project/(the existing scaffold) - Instruction: “Read the agent-brief and foundation-brief. Build this page using ONLY the Wave 3 design system. Zero external dependencies. Every visual value must match the brief exactly.”
What Each Agent Produces
-
app/{route}/page.tsxâ The page component:- Server component by default (add
'use client'only where interaction requires it) - Imports shared components from
@/components/shared/ - Imports page-specific components from
@/components/pages/{page}/ - Uses tokens from
@/lib/tokensfor any programmatic style values - Follows the section stacking order from the agent-brief exactly
- Server component by default (add
-
components/pages/{page}/â Page-specific components:- One component file per section (e.g.,
Hero.tsx,FeatureGrid.tsx,PlanCards.tsx) - TypeScript interfaces for all props
- Tailwind classes using the extended theme from
tailwind.config.ts - CSS custom properties via inline styles where Tailwind doesn’t cover the value
- Responsive classes matching the agent-brief breakpoint spec
- One component file per section (e.g.,
-
public/assets/{page}/â Page-specific assets:- Images copied from
wave0/{page}/assets/images/ - Icons copied from
wave0/{page}/assets/icons/ - Asset paths matching the agent-brief’s asset reference table
- Images copied from
Acceptance Criteria (Per Page)
Every Wave 4 agent must verify these criteria before signaling completion:
| Criterion | Verification |
|---|---|
| Visual match â desktop (â¥1280px) | Layout, typography, colors, spacing match agent-brief at wide viewport |
| Visual match â tablet (768â1279px) | Responsive layout shifts match agent-brief tablet spec |
| Visual match â mobile (â¤767px) | Mobile layout, stacking, font scaling match agent-brief mobile spec |
| Interactive states | All hover/focus/active/disabled states match original behavior spec |
| Animations | All scroll-triggered, load, and hover animations fire with correct timing/easing |
| Typography | All fonts render with correct family, weight, size, line-height, letter-spacing |
| Images | All images self-hosted in public/assets/ and displaying correctly |
| No external requests | Zero network requests to CDNs, Google Fonts, external APIs |
| TypeScript strict | tsc --noEmit passes with zero errors |
| Build succeeds | next build completes without errors |
Global Fleet Rules
These rules apply across ALL waves and ALL agents:
Wave Sequencing (STRICT)
Wave 0 (all agents) â Gate â Wave 1 (all agents) â Gate â Wave 2 (all agents) â Gate â Wave 3 â Gate â Wave 4 (all agents)
No Wave N+1 agent may start until ALL Wave N done.signal files exist. This is non-negotiable â each wave depends on the complete output of the previous wave.
Parallelism Within Waves
Within a single wave, ALL agents run in parallel:
- Wave 0: All page agents simultaneously
- Wave 1: All page-type group agents simultaneously
- Wave 2: All page brief agents simultaneously
- Wave 3: Single orchestrator (may spawn parallel sub-agents internally)
- Wave 4: All page build agents simultaneously
Signal File Convention
.design-soul/wave{N}/{identifier}/done.signal # Per-agent completion (Waves 0, 1, 2)
.design-soul/wave3/foundation-ready.signal # Wave 3 completion (single signal)
Signal files are EMPTY files. Their existence is the ONLY indicator of completion. An agent must write its signal file LAST, after all other outputs are verified.
The Grounding Rule (Repeated â It’s That Important)
Every value in every document in every wave must trace to real CSS, real HTML, or real JS from the source snapshot. No approximations. No “standard” values. No framework defaults assumed. If you can’t find it, mark it UNVERIFIED.
Zero Dependencies Rule
The nextjs-project/package.json may contain ONLY:
nextreactreact-domtypescripttailwindcss@types/react@types/nodepostcssautoprefixer
NO exceptions. No framer-motion. No shadcn/ui. No @mui/*. No @chakra-ui/*. No lucide-react. No @fontsource/*. No gsap. No lottie. Everything is built from scratch using the extracted design specs.
Consistency Rule
The same token name must mean the same value everywhere:
tokens.tsvalue =tailwind.config.tsextension =globals.csscustom property =wave2/*/agent-brief.mdreference- If a discrepancy is found, trace back to Wave 0 source and use the authoritative value
Request Interpretation Table
How the orchestrator decides which waves to execute based on user intent:
| User Says | Waves Executed | Primary Output |
|---|---|---|
| “Extract the design” | 0 â 1 â 2 | .design-soul/ documentation only |
| “Document this site” | 0 â 1 â 2 | .design-soul/ documentation only |
| “Capture the design DNA” | 0 â 1 â 2 | .design-soul/ documentation only |
| “Rebuild this site” | 0 â 1 â 2 â 3 â 4 | .design-soul/ + nextjs-project/ |
| “Recreate this page” | 0 â 1 â 2 â 3 â 4 | .design-soul/ + nextjs-project/ |
| “Clone this design” | 0 â 1 â 2 â 3 â 4 | .design-soul/ + nextjs-project/ |
| “Reconstruct from snapshot” | 0 â 1 â 2 â 3 â 4 | .design-soul/ + nextjs-project/ |
| “Pixel-perfect copy” | 0 â 1 â 2 â 3 â 4 | .design-soul/ + nextjs-project/ |
| “Just the tokens” | 0 â 1 | wave0/ + wave1/ only |
| “Just the design system” | 0 â 1 | wave0/ + wave1/ only |
| “Extract for rebuild later” | 0 â 1 â 2 | .design-soul/ docs (Wave 3â4 can resume later) |
| “Compare these pages” | 0 â 1 | wave0/ + wave1/ with cross-page analysis |
| “Extract and scaffold” | 0 â 1 â 2 â 3 | .design-soul/ + nextjs-project/ scaffold (no page builds) |
Ambiguity Resolution
If the user’s intent is unclear:
- Default to Waves 0â2 (extraction only) â it’s safe and non-destructive
- Ask: “I’ve extracted the design documentation. Would you also like me to rebuild it as a Next.js project? (That would run Waves 3â4)”
- Never assume reconstruction unless the user explicitly says “build”, “rebuild”, “recreate”, “reconstruct”, or “clone”
Anti-Patterns
Extraction Anti-Patterns (Waves 0â2)
1. Trying to “Read” Minified CSS Visually
Thousands of CSS rules on one line, 100KB+ per file. Use grep -oE with targeted regex patterns. Never scroll through minified CSS hoping to spot values.
2. Ignoring CSS Custom Properties
--color-*, --font-*, --radius-*, --ease-* ARE the design system. They reveal intent â the named tokens composing every section. Skipping them means documenting symptoms, not the system.
3. Treating Each CSS File Independently
12+ CSS files are one system split by the build tool. A selector in one file may reference a variable declared in another. Always grep across ALL _files/*.css files simultaneously.
4. Missing the CSS Module Naming Pattern
Not decoding Plans_card__SCfoV as “Plans component, card element” means guessing section boundaries from <div> nesting. The prefix IS the section identifier â use it.
5. Documenting Only Inline Styles
Inline style="" attributes are the tip of the iceberg. The vast majority of styles live in external CSS files matched by class names. Always grep CSS files for the section’s prefix before documenting.
6. Assuming Section Boundaries from <div> Tags
Nested <div> elements don’t reliably mark sections. Use semantic HTML tags + CSS Module prefix transitions as your boundary detection mechanism.
7. Skipping Shared Sections
Header and Footer appear on every page but must be documented ONCE, not duplicated. Page-specific variations (transparent vs. solid header on different pages) are critical builder details that must be noted.
8. Not Deduplicating CSS Files
The same hashed CSS file appears in multiple _files/ folders. Without deduplication, token counts inflate 2Ã, color palettes appear doubled, and analysis misleads.
Build Anti-Patterns (Waves 3â4)
9. Using Tailwind Defaults Instead of Extracted Values
Tailwind ships with a default color palette, spacing scale, and breakpoint set. The final project must use ONLY the values extracted from the source snapshot, configured via tailwind.config.ts theme extensions. Never use bg-blue-500 when the source uses --color-brand: #2563eb.
10. Adding Component Libraries “For Convenience”
No shadcn/ui. No Material UI. No Chakra UI. No Radix primitives. Every component is built from scratch using the extracted design specs. The spec IS the component library.
11. Using Google Fonts CDN Instead of Self-Hosting
All font files must be downloaded during Wave 0, stored in public/assets/fonts/, and loaded via @font-face in globals.css. Zero CDN requests. Zero external font loading.
12. Guessing Mobile Layout Instead of Extracting from @media
The source CSS contains explicit @media queries defining exactly what happens at each breakpoint. Extract and implement those exact rules. Never guess “it probably stacks on mobile.”
13. Skipping Animation Extraction
“Users won’t notice” is not acceptable. Scroll animations, hover transitions, page-load stagger effects, and micro-interactions are part of the visual DNA. Every @keyframes, every transition, every IntersectionObserver pattern gets documented in Wave 0 and implemented in Wave 4.
Reference Files
These files contain detailed agent prompts, templates, and quality gates. Each wave references specific files.
| File | Wave(s) | Purpose |
|---|---|---|
references/foundations-agent.md |
Wave 0 | Per-page exploration agent prompt â methodology for CSS parsing, token extraction, deobfuscation |
references/sections-agent.md |
Wave 1 | Design soul extraction agent prompt â methodology for unifying visual DNA across pages |
references/section-template.md |
Wave 2 | Build brief template â the exact format for self-contained page build instructions |
references/system-template.md |
Wave 3 | Design system scaffold template â project structure, quality gate spec, foundation format |
references/website-patterns.md |
All Waves | Pattern identification catalog â CSS Module prefix â section type mapping, common website anatomy |
references/quality-checklist.md |
All Waves | Quality gates â extraction completeness checks, build verification criteria, signal file prerequisites |
How to Use Reference Files
- Wave 0 agents MUST read
references/foundations-agent.mdbefore starting extraction - Wave 1 agents MUST read
references/sections-agent.mdbefore starting soul extraction - Wave 2 agents MUST read
references/section-template.mdbefore writing build briefs - Wave 3 orchestrator MUST read
references/system-template.mdbefore scaffolding - All agents SHOULD consult
references/website-patterns.mdfor section-type identification - All agents SHOULD consult
references/quality-checklist.mdbefore writing theirdone.signal
Agents that skip their reference file will produce incomplete or incorrectly formatted output, breaking downstream waves.