Technical document

Architecture for Perfect Reproduction of Design Comps: Detailed Implementation Protocol via Pre-emptive Difference Identification and Left-Right Equal-Scale Slicing Audit

Deconstructing the structural flaws that lead to frequent "subtle misalignments and original creations" in web implementations from Figma and design comps. We detail the entire pixel-perfect reproduction protocol, including pre-emptive difference auditing to confirm discrepancies before writing code, 1200px chunk left-right equal-scale slicing, and an 8-major-perspective matrix.
AI Development36 minPublication Date November 10, 2026Update date November 10, 2026
Thumbnail for Architecture for Perfect Reproduction of Design Comps: Detailed Implementation Protocol via Pre-emptive Difference Identification and Left-Right Equal-Scale Slicing Audit

Summary

Key points of this document

  • 1. Background and Challenges: Why Does "Immediate Implementation" Lead to Design Breakdown?
  • 2. Core Philosophy of Solution: Mandating Read-Only Diff Audit (Pre-emptive Difference Identification)
  • 3. Mechanical Slicing Technology: Automation of Side-by-Side Slices

Overview

Architecture for Perfect Reproduction of Design Comps: Detailed Implementation Protocol via Pre-emptive Difference Identification and Left-Right Equal-Scale Slicing Audit

1. Background and Challenges: Why Does "Immediate Implementation" Lead to Design Breakdown?

In the process of implementing and modifying UI components for web screens based on Figma or design comps, many development teams face a deep-rooted problem. This is the phenomenon where, no matter how carefully one codes while visually checking, during the review phase, frequent feedback like "slightly different from the design," "rounded corners don't match," or "some text has changed" occur, leading to a loop of rework.

Especially in recent years, as UI implementation utilizing AI coding assistants rapidly spreads, this problem has become even more prominent. Models, upon receiving instructions, might add unnecessary parentheses to text that don't exist in the design comp, or easily turn a right-angled (rounded-none) button into a rounded (rounded-md) one, or arbitrarily create a pill-shaped search button."AI's Original Creations (Hallucination / Invention)"or"Oversight of Subtle Styles"frequently occur.

Why do such inconsistencies occur? The root cause lies in the following two structural defects in human cognitive characteristics and AI model inference characteristics.

Two Major Root Causes Leading to Failure

Root CausePhenomenon and Impact
1. Suppression of Details by Overall Vertical OverviewWhen attempting to compare LPs or full-screen captures spanning thousands of pixels all at once, subtle differences such as 1px borders, 3D shadows, minute icon variations, and font weight (font-weight) are visually compressed due to reduced display, making oversights inevitable.
2. Cognitive Confusion Due to Simultaneous Implementation and VerificationWhen adopting the approach of "comparing with the comp while modifying code," the worker's attention is drawn to modifying implementation logic, blurring the boundaries of what has been fixed and what remains unresolved, leading to scattered fixes and degradation.
【Traditional Failure Pattern: Immediate Implementation】
[Design Mockup] ──→ [Immediate Code Editing/Trial and Error] ──→ [Visual Confirmation from a Holistic View] ──→ Numerous Oversights, Frequent Rework

To overcome this challenge, it is necessary to eliminate visual checks based on sheer willpower and aimless retries, and instead,"mechanically and objectively identify and log every single design difference before entering the implementation phase."such an engineering process separation becomes indispensable.


2. Core Philosophy of Solution: Mandating Read-Only Diff Audit (Pre-emptive Difference Identification)

The core of this protocol is to"establish a pre-emptive design difference identification phase (Read-Only Diff Audit Phase) where not a single line of code is written"as an absolute prerequisite.

Before commencing implementation, we first mechanically generate equal-scale comparison images with the design comp master (SSOT) on the left and the current implementation screen on the right, then thoroughly extract differences based on 8 perspectives. The identified differences are finalized as a checklist-format "Design Difference Inventory (Diff Inventory)," and this inventory is handed over to the front-end implementer (or AI model) as the sole implementation specification.

Comparison of Approaches

ItemTraditional "Immediate Implementation"Pre-emptive Difference Identification Protocol
Action at Start of WorkDirectly start writing CSS and HTML by hand while looking at the compCode editing prohibited and focus solely on difference extraction and logging.
Comparison MethodVisually overview by arranging browser and Figma windows side-by-sideAutomatically generate left-right equal-scale sliced images in 1200px chunks
Unit of Difference ComprehensionSubjective, qualitative "sense of incongruity"Strict checklist in pixel and text units based on 8 major perspectives
Input for Implementation TeamVague instruction: "Make it look nice, just like Figma""Design Difference Ledger" with all differences clearly documented one-to-one
Completion CriteriaHuman subjective "Mostly OK"Resolution of all ledger items + Zero-difference verification through post-hoc micro-comparison
【Pre-emptive Difference Extraction Protocol】
[Comp Master] & [Current Implementation]
       │
       ▼
[Mechanical Left-Right Equal Slice Generation] ──→ [8 Key Perspectives Difference Audit] ──→ [Diff Inventory Finalization]
                                                              │
                                                              ▼
                                               [Pinpoint Implementation Based on Inventory]
                                                              │
                                                              ▼
                                               [Post-hoc Micro Comparison & Zero-Difference Verification]

3. Mechanical Slicing Technology: Automation of Side-by-Side Slices

To faithfully verify the design of long vertical pages, a technology is needed that automatically constructs a "layout where differences are most easily identified" by the human eye or image recognition models.

Chunk Division Design for Long Vertical Pages

It is not uncommon for LPs on PC screens (1600px or 1440px wide) or smartphone screens (430px or 390px wide) to exceed 5,000px to 10,000px in vertical length. If these images are scaled down and compared as a single overall view, the aspect ratio becomes extremely elongated, making button borders and text shapes unreadable.

Therefore, images are evenly divided (sliced) vertically from the top of the page at regular intervals (every 1200px to 1500px), and comparison canvases are generated in bulk, with the original comp on the left and the implemented screen on the right, aligned at the same scale.

Loading diagram...

Example Implementation of Slicing Script

Below is the core logic for automatically generating a set of side-by-side comparison slice images using Python's Pillow (PIL) library.

import os
from PIL import Image, ImageDraw, ImageFont

def generate_side_by_side_slices(figma_path, prod_path, out_dir, chunk_h=1200, target_w=1600):
    os.makedirs(out_dir, exist_ok=True)
    
    img_f = Image.open(figma_path).convert("RGB")
    img_p = Image.open(prod_path).convert("RGB")
    
    # Normalize width (resize while maintaining aspect ratio)
    def resize_width(img, width):
        if img.width == width:
            return img
        scale = width / img.width
        return img.resize((width, int(round(img.height * scale))), Image.Resampling.LANCZOS)
    
    img_f = resize_width(img_f, target_w)
    img_p = resize_width(img_p, target_w)
    
    max_h = max(img_f.height, img_p.height)
    header_h = 60
    gap = 20
    canvas_w = target_w * 2 + gap
    
    y_start = 0
    slice_idx = 0
    
    while y_start < max_h:
        y_end = min(y_start + chunk_h, max_h)
        cur_h = y_end - y_start
        
        # Crop each region (pad with white if out of bounds)
        f_crop = Image.new("RGB", (target_w, cur_h), (255, 255, 255))
        if y_start < img_f.height:
            f_crop.paste(img_f.crop((0, y_start, target_w, min(y_end, img_f.height))), (0, 0))
            
        p_crop = Image.new("RGB", (target_w, cur_h), (255, 255, 255))
        if y_start < img_p.height:
            p_crop.paste(img_p.crop((0, y_start, target_w, min(y_end, img_p.height))), (0, 0))
            
        # Create the side-by-side canvas
        canvas = Image.new("RGB", (canvas_w, cur_h + header_h), (230, 235, 240))
        draw = ImageDraw.Draw(canvas)
        
        # Draw header band (Left: dark blue, Right: deep green)
        draw.rectangle([0, 0, target_w, header_h], fill=(30, 50, 90))
        draw.rectangle([target_w + gap, 0, canvas_w, header_h], fill=(25, 90, 55))
        draw.text((20, 18), f"[FIGMA SSOT] Y: {y_start}-{y_end}px", fill=(255, 255, 255))
        draw.text((target_w + gap + 20, 18), f"[LIVE DEPLOYED] Y: {y_start}-{y_end}px", fill=(255, 255, 255))
        
        canvas.paste(f_crop, (0, header_h))
        canvas.paste(p_crop, (target_w + gap, header_h))
        
        canvas.save(os.path.join(out_dir, f"chunk_{slice_idx:02d}_{y_start}_{y_end}.png"), quality=95)
        y_start = y_end
        slice_idx += 1

The slice images generated by this script display the content of each section side-by-side at their original size, allowing for immediate identification of text alignment shifts and style discrepancies.


4. Design Difference Audit: 8 Major Perspectives Matrix

When scrutinizing slice images, instead of just looking for "places that somehow look different," by checking based on the following8 engineering perspectives, a comprehensive and exhaustive extraction of differences becomes possible.

PerspectiveAudit ItemTypical Detection Cases and Correction Guidelines
1. Placement/LayoutHorizontal/Vertical arrangement, Left-aligned/Center-aligned, Element order, Overlap (negative margin), Alignment linesThe logo on the left is left-aligned (x=52px) in the comp, but in the implementation, it's shifted towards the center (x=224px). Resolve the discrepancy in the top Y-coordinate of left and right elements.
2. Dimensions/SizeContainer max-width, Card width/height, Button dimensions, Image occupancy rate (%)The button within the search form is a horizontal rectangle (149×57px) in the comp, but a pill shape (220×49px) in the implementation.
3. Boundary SpacingOuter margin, Inner padding, Element spacing (gap), Vertical section spacingThe gap between cards is 24px compared to 16px in the comp. Re-adjust to match the design system's 4px/8px grid rhythm.
4. TypographyFont size, font-weight, text color HEX, line-height, letter-spacing, line break positionThe heading in the comp has a 2-line break with tight letter-spacing, whereas in the implementation, it's a single line with a smaller, bolder font size.
5. Fine Details/DecorationsRounded corners (border-radius), Borders, Shadows (box-shadow), Background color HEXThe four select boxes only have an underline, but the original comp has "4-sided 1px black border" and "sharp corners (rounded-none)". Missing 3D shadow (4px offset) on the button.
6. Icons/ImagesIcon presence/absence, Shape, Orientation, Size, Photo cropping area, Person's angleThe icon on the free consultation button is a right arrow ">", but the original comp has a white circular "handset (phone mark)" icon.
7. Wording/CopyExact text match, Particles ("wo", "de"), Presence/absence of parentheses, Label notationThe comp text is "Free Consultation\nCompleted in 30 seconds", whereas in the implementation, parentheses have been arbitrarily added, making it "Free Consultation (Completed in 30 seconds)".
8. Exclusion of Original CreationsIdentification of unnecessary elements not in the comp, Check for missing elements present in the compA "0" badge, which does not exist in the comp, has been created on the top right of the implemented favorite button, so it must be immediately removed.

5. End-to-End Overall Pipeline Design

The overall workflow from preliminary diff identification to implementation and post-verification is shown in the sequence diagram below.

Loading diagram...

6. Example of a "Diff Inventory" in practice

Differences identified in the audit phase are structured as a Markdown checklist per component and per section, as shown below. The existence of this inventory allows implementers to clearly understand "what needs to be fixed and to what extent to pass."

### Quick Search Card Section Discrepancy Ledger
- [ ] **Borders and Corner Radius**: Abolish the underline style of the four select boxes, and apply a square black border enclosing all four sides (border: 1px solid #000), sharp corners (rounded-none), and a black downward-pointing triangle (▼) on the right edge.
- [ ] **Button Shape**: Change the "Search Jobs" button from a pill shape (rounded-full) to a horizontal rounded rectangle as per the comp (rounded-md, approx. 149x57px).
- [ ] **Wording and Particle**: Exactly match the button text from "Job Search" to "Search for Jobs" (including the particle "wo").
- [ ] **Recommended Keywords**: Abolish the hashtag UI (#keyword) and correct it to pipe-separated text (| Keyword 01 | Keyword 02 |).

7. Post-verification: Real browser active probe and micro-comparison (zero-diff matching)

After applying the corrected code, you must not simply confirm that the build passed and finish. The following two-stage post-verification should be performed on the modified screen:

1. Real Browser Active Probe

Using automation tools like Playwright, the following verifications are mechanically run against the modified screen:

  • Zero-tolerance monitoring: console.error 0 occurrences, unhandled exceptions 0 occurrences, HTTP 4xx/5xx communication failures 0 occurrences.
  • Geometric layout audit: document.documentElement.scrollWidth > window.innerWidth (horizontal scroll) is 0px.
  • BoundingBox actual measurement: For the target component, get its getBoundingClientRect() and actually measure if it matches the design width and ratio of the comp.

2. Micro-magnification comparison (Micro Inspect)

For important blocks that have been modified (headers, search cards, CTA buttons, etc.), precisely cropped images are compared one-to-one with the original to confirm that corner radii, drop shadows, and text baselines are perfectly matched.

================================================================================
[QA-GATE FINAL VERDICT]
Is it in a complete state?: YES (FLAWLESS)
--------------------------------------------------------------------------------
[1] Difference Ledger Checklist : PASS (11 out of 11 items resolved)
[2] Zero Tolerance Errors   : PASS (0 console errors, 0 page errors, 0 network errors)
[3] Geometry/Design Fidelity : PASS (0 overflow, 100% perfect match for rounded corners, shadows, and text)
================================================================================

8. Summary: Guidelines for practical application

The essence of maximizing design reproducibility is not to rely on the implementer's sense or intuition, but ratherto clearly separate the responsibilities of "auditing (identifying differences)" and "implementation (code correction)"..

  1. Stop before writing code: Do not start coding immediately while looking at the comp; first, identify the differences from the current implementation.
  2. Compare side-by-side at the same scale: For long vertical pages, divide them into 1200px chunks and visually compare them with sliced images arranged side-by-side at actual size.
  3. Document with 8 key perspectives: Create a checklist based on 8 perspectives: placement, dimensions, spacing, text, decoration, icons, wording, and exclusion of original creations.
  4. Implement the inventory as a specification: Apply pinpoint corrections according to the confirmed diff list.
  5. Confirm zero diff with images: After correction, perform slice comparison again and consider it complete with objective evidence.

By incorporating this protocol as a standard flow in team development and AI-driven development, it is possible to prevent rework and design degradation, achieving both overwhelming speed and uncompromising quality.

Technical documents

We will continue to increase technical documentation.

We will continue to organize our thoughts on AI, cloud, business app development, requirements definition, and operational design into documents.

Go to technical documentation list