LLM-Powered Migration of UI Component Libraries at Scale
zalando · E-commerce · 2025 · source Agentic: no · promotional bias: low · source-backed · extracted with prompt 0.5.6 (schema v2)
Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.
Problem
Domain: UI component library migration
Zalando needed to migrate partner-facing B2B applications from one in-house UI component library to another while reducing duplicated maintenance, inconsistent UX, and manual migration effort.
Constraints:
- The migration covered 15 sophisticated B2B applications.
- Source and target UI libraries differed substantially in interfaces and visual behavior.
- Incorrect transformations could directly affect partner experience.
- LLM-generated code still required visual verification for layout and complex edge cases.
Architecture
Zalando iteratively developed a GPT-4o-powered Python migration tool. The team first experimented through an internal hackathon, then enriched prompts with component interfaces, transformation instructions, manually verified examples, system prompts, deterministic settings, grouped context, continuation handling, prompt caching, and automated validation tests. The tool processes source files and applies component migrations while humans handle visual verification and hard edge cases.
Diagram confidence: explicit (topology described by the source).
flowchart LR Prompt_builder["Component prompt builder"] --> Migration_tool["Python migration tool"] Migration_tool --> GPT4o["GPT-4o transformer"] Migration_tool --> Continuation["Continuation handler"] Continuation --> GPT4o GPT4o --> Formatter["Output formatter"] Formatter --> Validation_examples["Validation examples"] Validation_examples --> Prompt_builder Validation_examples --> Human_review["Human visual verification"]
Components
| Component | Role | Interacts with |
|---|---|---|
Component prompt builder |
Creates migration prompts from source component code, interfaces, transformation rules, and examples. | Python migration tool, Validation examples |
Python migration tool |
Processes source files and invokes GPT-4o through the llm conversation API. | Component prompt builder, GPT-4o transformer, Continuation handler |
GPT-4o transformer |
Transforms source UI component usage into target-library code according to prompts. | Python migration tool, Output formatter |
Continuation handler |
Sends a simple continue prompt when large-file transformations are truncated. | Python migration tool, GPT-4o transformer |
Output formatter |
System-prompt constraints that keep outputs as transformed code without explanatory markdown. | GPT-4o transformer, Validation examples |
Validation examples |
LLM-generated and manually verified examples used as regression tests for prompt changes. | Component prompt builder, Output formatter, Human visual verification |
Human visual verification |
Manual review path for visual implications and complex component-library gaps. | Validation examples |
Data flow
Source component code is used to craft migration prompts containing interfaces, transformation rules, and examples. The Python tool processes files in source directories, sends grouped context and file content to GPT-4o through the llm conversation API, continues truncated outputs when needed, and returns transformed code for tests and human verification.
3 supporting quotes
Why this architecture
Zalando chose an LLM migration tool because codemods require explicit edge-case programming, while LLMs can reason over code relationships when supplied with verified component context. The final architecture reflects lessons from failed single-pass attempts: divide context, provide examples, make output deterministic, validate prompt changes, and keep humans for visual risks.
3 supporting quotes
Models used: GPT-4o · LLMs · continue.dev
Scale
- The migration scope covered 15 sophisticated B2B applications.“The project's scope encompassed 15 sophisticated B2B applications, and due to significant differences between the source and target UI component libraries”article, stated
- The LLM migration approach reached about 90% accuracy.“the LLM-based approach achieved an accuracy of about 90% migrating components across large volumes of files”article, stated
- Estimated cost was less than $40 per code repository.“Based on the GPT-4o pricing, this would come to be less than $40 for each code repository.”article, stated
- Processing ranged from 30 to 200 seconds per file.“Processing times ranged between 30 and 200 seconds per file, making large-scale migrations time-intensive.”article, stated
Alternatives considered (roads not taken)
Direct migration from source code in one LLM pass
Rejected because: It produced inconsistent results because the model had to understand source, define interfaces, map libraries, and migrate all at once.
Interfaces without verified transformation instructions/examples
Rejected because: Accuracy stayed low or medium and automated mappings missed visual equivalence such as button sizing.
Traditional codemods for every edge case
Rejected because: Codemods require explicit coding for edge cases, whereas LLMs could infer some code relationships from context.
Patterns
context-engineering (prompting)
The team grouped components, constrained tokens, placed static examples before dynamic file content, and supplied interfaces/rules/examples to keep transformations focused.
eval-driven-development (evaluation)
Five prompt iterations, realistic test applications, and LLM-generated validation examples turned migration quality into an iterative measured process.
human-in-the-loop-gate (safety)
Examples were generated by the LLM but manually verified, and humans remained necessary for visual correctness and complex edge cases.
semantic-caching (cost-performance)
The migration prompt was structured to maximize prompt-cache hits across files.
Tradeoffs
Use LLM transformation with human verification
Chose GPT-4o migration plus tests and manual visual review over fully automated migration with no human oversight.
Rationale: The LLM achieved high accuracy but could not reliably catch visual/layout implications or complex library gaps.
Group component context rather than include everything
Chose logical groups with 40-50K context tokens over ever-growing all-component prompts.
Rationale: Accuracy declined as input prompt size grew, so grouping preserved model focus.
Gotchas (what bit them)
Single-pass migration overloaded the model.
Root cause: The prompt required understanding source code, defining interfaces, mapping libraries, and migrating test code all at once.
Resolution: Iteratively add interfaces, transformation instructions, verified examples, and system prompts.
Large-file output could truncate mid-transformation.
Root cause: Files exceeded the 4K token limit.
Resolution: Use the conversation API and a simple continue prompt to complete the transformation.
LLMs could produce syntactically migrated but visually broken pages.
Root cause: The model could not verify visual implications of design-system differences like spacing and grid units.
Resolution: Keep human visual verification and set realistic expectations for complex transformations.
Repeated runs on the same input produced inconsistent output.
Root cause: LLM outputs varied across runs unless deterministic settings were applied.
Resolution: Set temperature to 0 for reproducibility.
Evaluation
Zalando evaluated through iterative migration experiments, a realistic test application, automated regression tests using generated examples, cost estimates, and final migration accuracy.
Metrics: over 90% component migration accuracy · less than $40 per repository · 30 to 200 seconds per file · 15 B2B applications in scope
Outcomes
- The tool achieved over 90% accuracy for component migration.
- The estimated cost was under $40 per repository.
- The LLM approach reduced manual fixes and accelerated migration-tool development.
The migration targeted 15 B2B applications and large volumes of component files, with per-file processing taking 30-200 seconds.