mobileui-os 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +47 -0
- package/CHANGELOG.md +25 -0
- package/README.md +78 -0
- package/bin/cli.mjs +375 -0
- package/knowledge/android/00-apple-to-android-adaption.md +1499 -0
- package/knowledge/android/accessibility.md +333 -0
- package/knowledge/android/components-controls.md +270 -0
- package/knowledge/android/material-design-3.md +174 -0
- package/knowledge/android/navigation-patterns.md +212 -0
- package/knowledge/apple/00-skill-reading-protocol.md +1296 -0
- package/knowledge/apple/Accessibility, Inclusive Design & Human Factors Intelligence.md +735 -0
- package/knowledge/apple/Advanced Interaction Patterns, Gestures, Feedback & State Transitions.md +1140 -0
- package/knowledge/apple/Advanced Navigation, Information Architecture & Wayfinding.md +551 -0
- package/knowledge/apple/Autonomus Ui-UX Improvement Loop.md +611 -0
- package/knowledge/apple/Color, Materials, Contrast, Themes & Visual Depth.md +1351 -0
- package/knowledge/apple/Content, Copy, Microinteractions & UX Communication.md +642 -0
- package/knowledge/apple/Data-Heavy Interfaces, Tables, Lists, Search, Filtering & Large-Scale Content.md +721 -0
- package/knowledge/apple/Design Systems & Component Architecture.md +412 -0
- package/knowledge/apple/Forms, Input, Data Entry & Validation Intelligence.md +705 -0
- package/knowledge/apple/Interaction, State & Edge-Case Engineering.md +491 -0
- package/knowledge/apple/Interaction-behaviour.md +1378 -0
- package/knowledge/apple/Layout Architecture, Responsive Design & Spatial Systems.md +1365 -0
- package/knowledge/apple/MASTER UI-UX ORCHESTRATOR.md +1210 -0
- package/knowledge/apple/Navigation Architecture, Routing, Deep Linking & State Restoration.md +1392 -0
- package/knowledge/apple/Navigation, Information Architecture & Spatial Hierarchy.md +1613 -0
- package/knowledge/apple/Notifications, Permissions, Privacy and Trust.md +1540 -0
- package/knowledge/apple/Patterns-templates-composition.md +647 -0
- package/knowledge/apple/Performance, Perceived Speed, Motion & Rendering Intelligence.md +855 -0
- package/knowledge/apple/Responsive, Adaptive & Cross-Platform UI Intelligence.md +669 -0
- package/knowledge/apple/Responsive, Adaptive, Accessible & Performant UI.md +545 -0
- package/knowledge/apple/Tablet Adaptation & Multi-Device UX.md +1447 -0
- package/knowledge/apple/UI Implementation & Refactoring.md +498 -0
- package/knowledge/apple/UI-UX Decision-Making, Prioritization & Trade-offs.md +533 -0
- package/knowledge/apple/UI-UX Project Lifecycle & Delivery.md +544 -0
- package/knowledge/apple/User Flows & Experience Architecture.md +335 -0
- package/knowledge/apple/Visual Design Systems, Theming, Tokens & Brand Intelligence.md +764 -0
- package/knowledge/apple/Visual QA, Testing & Validation.md +557 -0
- package/knowledge/apple/accessibility-inclusive-interaction.md +1361 -0
- package/knowledge/apple/accessibility.md +2162 -0
- package/knowledge/apple/color.md +1933 -0
- package/knowledge/apple/component-architecture.md +2208 -0
- package/knowledge/apple/components.md +2172 -0
- package/knowledge/apple/design-decision-framework.md +1883 -0
- package/knowledge/apple/design-review-engine.md +2108 -0
- package/knowledge/apple/design-tokens.md +1943 -0
- package/knowledge/apple/designing-for-ios.md +1680 -0
- package/knowledge/apple/gestures, touch behavior, feedback, motion, and micro-interactions.md +1538 -0
- package/knowledge/apple/hig-foundation.md +1806 -0
- package/knowledge/apple/iconography.md +1903 -0
- package/knowledge/apple/interaction-patterns.md +2513 -0
- package/knowledge/apple/interaction.md +2141 -0
- package/knowledge/apple/ios-alerts-confirmations-destructive-actions.md +1342 -0
- package/knowledge/apple/ios-components-and-controls.md +1634 -0
- package/knowledge/apple/ios-components-patterns.md +1343 -0
- package/knowledge/apple/ios-design-system-architecture.md +1520 -0
- package/knowledge/apple/ios-empty-error-offline-states.md +1370 -0
- package/knowledge/apple/ios-empty-loading-error-recovery.md +1674 -0
- package/knowledge/apple/ios-forms-and-input.md +1458 -0
- package/knowledge/apple/ios-forms-input-data-entry.md +1308 -0
- package/knowledge/apple/ios-gestures-and-touch.md +1272 -0
- package/knowledge/apple/ios-lists-collections-and-data-display.md +1735 -0
- package/knowledge/apple/ios-loading-progress-async-states.md +1378 -0
- package/knowledge/apple/ios-materials-and-surfaces.md +1543 -0
- package/knowledge/apple/ios-motion-animation-transitions.md +1178 -0
- package/knowledge/apple/ios-navigation-and-information-architecture.md +1674 -0
- package/knowledge/apple/ios-navigation-user-flows-design-architecture.md +1195 -0
- package/knowledge/apple/ios-search-and-discovery.md +1456 -0
- package/knowledge/apple/ios-search-filtering-discovery.md +1402 -0
- package/knowledge/apple/ios-sheets-modals-popovers.md +1205 -0
- package/knowledge/apple/ios-typography-icons-visual-hierarchy.md +1431 -0
- package/knowledge/apple/layout.md +2331 -0
- package/knowledge/apple/media-centric-content-ui-patterns.md +1470 -0
- package/knowledge/apple/motion, transitions, physics, and animation language.md +1535 -0
- package/knowledge/apple/motion-and-animation.md +1698 -0
- package/knowledge/apple/motion.md +2087 -0
- package/knowledge/apple/navigation.md +2281 -0
- package/knowledge/apple/responsive-adaptive.md +2159 -0
- package/knowledge/apple/screen-architecture.md +2067 -0
- package/knowledge/apple/typography, Content Hierarchy & Readability.md +1411 -0
- package/knowledge/apple/typography.md +1802 -0
- package/knowledge/apple/ui-ux inteligence audit.md +106 -0
- package/knowledge/apple/visual-design-and-premium-ui.md +1555 -0
- package/knowledge/apple/visual-hierarchy-engine.md +1647 -0
- package/knowledge/apple/visual-materials.md +2189 -0
- package/package.json +53 -0
- package/principles/design-principles.md +37 -0
- package/principles/platform-principles.md +25 -0
- package/principles/ux-principles.md +16 -0
- package/references/official-links.md +11 -0
- package/skills/accessibility-engineer/SKILL.md +125 -0
- package/skills/analytics-engineer/SKILL.md +283 -0
- package/skills/animation-engineer/SKILL.md +316 -0
- package/skills/component-designer/SKILL.md +75 -0
- package/skills/component-library-engineer/SKILL.md +140 -0
- package/skills/component-library-ops/SKILL.md +155 -0
- package/skills/design-system/SKILL.md +77 -0
- package/skills/design-token-engineer/SKILL.md +203 -0
- package/skills/design-token-pipeline/SKILL.md +277 -0
- package/skills/device-lab-engineer/SKILL.md +387 -0
- package/skills/forms-engineer/SKILL.md +79 -0
- package/skills/internationalization-engineer/SKILL.md +256 -0
- package/skills/motion-designer/SKILL.md +77 -0
- package/skills/native-data-fetching/SKILL.md +50 -0
- package/skills/navigation-architect/SKILL.md +65 -0
- package/skills/performance-engineer/SKILL.md +250 -0
- package/skills/platform-specialist/SKILL.md +95 -0
- package/skills/pre-release-gate/SKILL.md +75 -0
- package/skills/screen-designer/SKILL.md +117 -0
- package/skills/security-engineer/SKILL.md +375 -0
- package/skills/skills.json +134 -0
- package/skills/testing-auditor/SKILL.md +62 -0
- package/skills/ui-architect/SKILL.md +86 -0
- package/skills/ui-implementer/SKILL.md +188 -0
- package/skills/ux-architect/SKILL.md +49 -0
- package/skills/ux-auditor/SKILL.md +52 -0
- package/skills/visual-auditor/SKILL.md +71 -0
- package/templates/audit-report.md +29 -0
- package/templates/design-tokens.ts +33 -0
- package/templates/screen-spec.md +61 -0
- package/workflows/new-screen.md +17 -0
- package/workflows/pre-release.md +21 -0
- package/workflows/redesign.md +14 -0
- package/workflows/ui-audit.md +22 -0
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
## File 60 — UI Implementation & Refactoring
|
|
2
|
+
|
|
3
|
+
This is the bridge between **design intelligence and production code**.
|
|
4
|
+
|
|
5
|
+
Files 55–59 taught the agent how to understand, structure, flow, behave, adapt, and validate the experience. File 60 teaches it to **actually build that experience in a maintainable codebase**.
|
|
6
|
+
|
|
7
|
+
> **Translate design intent into clean implementation without losing UX quality, consistency, performance, or existing functionality.**
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
### 1. Design → implementation pipeline
|
|
12
|
+
|
|
13
|
+
The agent should follow:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
DESIGN INTENT
|
|
17
|
+
↓
|
|
18
|
+
SCREEN ARCHITECTURE
|
|
19
|
+
↓
|
|
20
|
+
COMPONENT MAPPING
|
|
21
|
+
↓
|
|
22
|
+
STATE MODEL
|
|
23
|
+
↓
|
|
24
|
+
DATA / BEHAVIOR REQUIREMENTS
|
|
25
|
+
↓
|
|
26
|
+
IMPLEMENTATION PLAN
|
|
27
|
+
↓
|
|
28
|
+
CODE
|
|
29
|
+
↓
|
|
30
|
+
RUN
|
|
31
|
+
↓
|
|
32
|
+
INSPECT
|
|
33
|
+
↓
|
|
34
|
+
REFINE
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Never jump directly from a screenshot to writing random JSX.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### 2. Understand the existing codebase first
|
|
42
|
+
|
|
43
|
+
Before modifying UI, inspect:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
Project structure
|
|
47
|
+
Framework
|
|
48
|
+
Navigation
|
|
49
|
+
State management
|
|
50
|
+
Theme system
|
|
51
|
+
Design tokens
|
|
52
|
+
Component library
|
|
53
|
+
Styling system
|
|
54
|
+
Data layer
|
|
55
|
+
Existing screens
|
|
56
|
+
Platform configuration
|
|
57
|
+
Dependencies
|
|
58
|
+
Build constraints
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The agent should **reuse what already exists** where appropriate.
|
|
62
|
+
|
|
63
|
+
A common failure is introducing a new architecture when the project already has one.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
### 3. Component mapping
|
|
68
|
+
|
|
69
|
+
Translate visual structure into appropriate components.
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
SCREEN
|
|
73
|
+
├── ScreenContainer
|
|
74
|
+
├── Header
|
|
75
|
+
│ ├── BackButton
|
|
76
|
+
│ └── HeaderActions
|
|
77
|
+
├── Content
|
|
78
|
+
│ ├── Section
|
|
79
|
+
│ └── List
|
|
80
|
+
│ └── ListItem
|
|
81
|
+
└── BottomAction
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Then determine:
|
|
85
|
+
|
|
86
|
+
```text
|
|
87
|
+
Reusable?
|
|
88
|
+
↓
|
|
89
|
+
Existing component?
|
|
90
|
+
↓
|
|
91
|
+
Extend existing?
|
|
92
|
+
↓
|
|
93
|
+
Create new?
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
This connects directly to **File 56**.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### 4. Separate concerns
|
|
101
|
+
|
|
102
|
+
Avoid giant components containing everything.
|
|
103
|
+
|
|
104
|
+
Bad:
|
|
105
|
+
|
|
106
|
+
```text
|
|
107
|
+
Screen
|
|
108
|
+
├── UI
|
|
109
|
+
├── API calls
|
|
110
|
+
├── business logic
|
|
111
|
+
├── navigation
|
|
112
|
+
├── animations
|
|
113
|
+
├── persistence
|
|
114
|
+
└── every state
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Prefer appropriate separation:
|
|
118
|
+
|
|
119
|
+
```text
|
|
120
|
+
Screen
|
|
121
|
+
├── Components
|
|
122
|
+
├── Hooks
|
|
123
|
+
├── State
|
|
124
|
+
├── Services
|
|
125
|
+
└── Utilities
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
The exact architecture depends on the application.
|
|
129
|
+
|
|
130
|
+
The principle is:
|
|
131
|
+
|
|
132
|
+
> **Separate responsibilities without creating needless abstraction.**
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
### 5. Component boundaries
|
|
137
|
+
|
|
138
|
+
Create a component when it has:
|
|
139
|
+
|
|
140
|
+
* a clear responsibility
|
|
141
|
+
* meaningful reuse
|
|
142
|
+
* independent state
|
|
143
|
+
* independent behavior
|
|
144
|
+
* significant visual complexity
|
|
145
|
+
* a stable semantic identity
|
|
146
|
+
|
|
147
|
+
Don't extract every `<View>`.
|
|
148
|
+
|
|
149
|
+
The agent should optimize for **comprehensibility**, not maximum component count.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
### 6. Design-system implementation
|
|
154
|
+
|
|
155
|
+
Implementation should consume the system created in File 56.
|
|
156
|
+
|
|
157
|
+
Prefer:
|
|
158
|
+
|
|
159
|
+
```text id="m5y7n3"
|
|
160
|
+
theme.colors.background
|
|
161
|
+
theme.spacing.md
|
|
162
|
+
theme.radius.lg
|
|
163
|
+
theme.typography.body
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
over arbitrary values scattered throughout the application.
|
|
167
|
+
|
|
168
|
+
When a new value is genuinely needed:
|
|
169
|
+
|
|
170
|
+
```text id="w3r8j2"
|
|
171
|
+
New value
|
|
172
|
+
↓
|
|
173
|
+
Does it represent a system concept?
|
|
174
|
+
↓
|
|
175
|
+
If yes → update system
|
|
176
|
+
If no → local value may be appropriate
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
### 7. Preserve behavior during redesign
|
|
182
|
+
|
|
183
|
+
When redesigning an existing screen:
|
|
184
|
+
|
|
185
|
+
```text id="8lq4r1"
|
|
186
|
+
Existing behavior
|
|
187
|
+
↓
|
|
188
|
+
Document
|
|
189
|
+
↓
|
|
190
|
+
Separate behavior from presentation
|
|
191
|
+
↓
|
|
192
|
+
Redesign presentation
|
|
193
|
+
↓
|
|
194
|
+
Reconnect behavior
|
|
195
|
+
↓
|
|
196
|
+
Test
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Never accidentally remove:
|
|
200
|
+
|
|
201
|
+
* navigation
|
|
202
|
+
* persistence
|
|
203
|
+
* data loading
|
|
204
|
+
* permissions
|
|
205
|
+
* media functionality
|
|
206
|
+
* error handling
|
|
207
|
+
* background operations
|
|
208
|
+
* accessibility
|
|
209
|
+
* existing user workflows
|
|
210
|
+
|
|
211
|
+
A visual redesign is **not permission to break functionality**.
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
### 8. Refactoring strategy
|
|
216
|
+
|
|
217
|
+
Refactoring should be incremental:
|
|
218
|
+
|
|
219
|
+
```text id="3z6v1k"
|
|
220
|
+
Understand
|
|
221
|
+
↓
|
|
222
|
+
Identify problem
|
|
223
|
+
↓
|
|
224
|
+
Define target architecture
|
|
225
|
+
↓
|
|
226
|
+
Make smallest safe change
|
|
227
|
+
↓
|
|
228
|
+
Test
|
|
229
|
+
↓
|
|
230
|
+
Continue
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Avoid rewriting everything simply because the existing code isn't perfect.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
### 9. UI modernization
|
|
238
|
+
|
|
239
|
+
When improving legacy UI:
|
|
240
|
+
|
|
241
|
+
```text id="0g2y8x"
|
|
242
|
+
OLD UI
|
|
243
|
+
↓
|
|
244
|
+
Audit
|
|
245
|
+
↓
|
|
246
|
+
Identify structural problems
|
|
247
|
+
↓
|
|
248
|
+
Map existing functionality
|
|
249
|
+
↓
|
|
250
|
+
Define target system
|
|
251
|
+
↓
|
|
252
|
+
Migrate components
|
|
253
|
+
↓
|
|
254
|
+
Migrate screens
|
|
255
|
+
↓
|
|
256
|
+
Remove obsolete patterns
|
|
257
|
+
↓
|
|
258
|
+
Validate
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Preserve important behavior while improving:
|
|
262
|
+
|
|
263
|
+
* hierarchy
|
|
264
|
+
* consistency
|
|
265
|
+
* accessibility
|
|
266
|
+
* responsiveness
|
|
267
|
+
* performance
|
|
268
|
+
* maintainability
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
### 10. React Native / Expo awareness
|
|
273
|
+
|
|
274
|
+
For mobile implementations, the agent should account for:
|
|
275
|
+
|
|
276
|
+
* Safe areas
|
|
277
|
+
* Platform differences
|
|
278
|
+
* Native navigation
|
|
279
|
+
* Keyboard behavior
|
|
280
|
+
* Gestures
|
|
281
|
+
* Scroll performance
|
|
282
|
+
* FlatList/virtualized lists
|
|
283
|
+
* Image handling
|
|
284
|
+
* Animations
|
|
285
|
+
* Native modules
|
|
286
|
+
* Permissions
|
|
287
|
+
* App lifecycle
|
|
288
|
+
* Android/iOS conventions
|
|
289
|
+
|
|
290
|
+
The agent should avoid blindly applying web assumptions to native mobile UI.
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
### 11. State-driven UI
|
|
295
|
+
|
|
296
|
+
UI should represent actual application state.
|
|
297
|
+
|
|
298
|
+
Conceptually:
|
|
299
|
+
|
|
300
|
+
```text id="j7k4p2"
|
|
301
|
+
state
|
|
302
|
+
↓
|
|
303
|
+
derive UI
|
|
304
|
+
↓
|
|
305
|
+
render
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
rather than:
|
|
309
|
+
|
|
310
|
+
```text id="f9m3x7"
|
|
311
|
+
manually manipulate UI everywhere
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
For example:
|
|
315
|
+
|
|
316
|
+
```text id="z2r8c5"
|
|
317
|
+
loading → LoadingView
|
|
318
|
+
error → ErrorView
|
|
319
|
+
empty → EmptyView
|
|
320
|
+
data → ContentView
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
This produces predictable behavior.
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
### 12. Avoid premature abstraction
|
|
328
|
+
|
|
329
|
+
The agent should recognize:
|
|
330
|
+
|
|
331
|
+
```text id="h5n1q8"
|
|
332
|
+
One occurrence
|
|
333
|
+
↓
|
|
334
|
+
Keep local
|
|
335
|
+
|
|
336
|
+
Repeated pattern
|
|
337
|
+
↓
|
|
338
|
+
Consider abstraction
|
|
339
|
+
|
|
340
|
+
Stable repeated pattern
|
|
341
|
+
↓
|
|
342
|
+
Extract into system
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
Don't create a universal component because two screens happen to look similar.
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
### 13. Performance-aware implementation
|
|
350
|
+
|
|
351
|
+
The agent should inspect:
|
|
352
|
+
|
|
353
|
+
* unnecessary re-renders
|
|
354
|
+
* unstable callbacks
|
|
355
|
+
* excessive state updates
|
|
356
|
+
* large component trees
|
|
357
|
+
* expensive calculations
|
|
358
|
+
* oversized images
|
|
359
|
+
* unvirtualized lists
|
|
360
|
+
* unnecessary animations
|
|
361
|
+
* expensive effects
|
|
362
|
+
* unnecessary network requests
|
|
363
|
+
|
|
364
|
+
But it should **measure or reason about actual bottlenecks** rather than blindly adding memoization everywhere.
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
### 14. Refactoring safety
|
|
369
|
+
|
|
370
|
+
Before major changes:
|
|
371
|
+
|
|
372
|
+
```text id="v6s2q9"
|
|
373
|
+
Identify dependencies
|
|
374
|
+
↓
|
|
375
|
+
Identify affected screens
|
|
376
|
+
↓
|
|
377
|
+
Identify affected components
|
|
378
|
+
↓
|
|
379
|
+
Identify behavior
|
|
380
|
+
↓
|
|
381
|
+
Implement
|
|
382
|
+
↓
|
|
383
|
+
Build
|
|
384
|
+
↓
|
|
385
|
+
Run tests
|
|
386
|
+
↓
|
|
387
|
+
Inspect UI
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
For critical functionality, preserve a clear rollback path.
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
### 15. Implementation checklist
|
|
395
|
+
|
|
396
|
+
Before considering implementation complete:
|
|
397
|
+
|
|
398
|
+
```text id="q2w7m4"
|
|
399
|
+
□ Design intent preserved
|
|
400
|
+
□ Existing behavior preserved
|
|
401
|
+
□ Design-system components reused
|
|
402
|
+
□ Component boundaries make sense
|
|
403
|
+
□ State is modeled correctly
|
|
404
|
+
□ Loading handled
|
|
405
|
+
□ Empty handled
|
|
406
|
+
□ Error handled
|
|
407
|
+
□ Accessibility implemented
|
|
408
|
+
□ Responsive behavior implemented
|
|
409
|
+
□ Platform behavior considered
|
|
410
|
+
□ Performance reviewed
|
|
411
|
+
□ Navigation verified
|
|
412
|
+
□ No unnecessary duplication
|
|
413
|
+
□ No dead code introduced
|
|
414
|
+
□ Build succeeds
|
|
415
|
+
□ Runtime behavior verified
|
|
416
|
+
□ Visual result inspected
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
### 16. Refactoring decision framework
|
|
422
|
+
|
|
423
|
+
When encountering bad UI code:
|
|
424
|
+
|
|
425
|
+
```text id="n8k3v6"
|
|
426
|
+
Is it broken?
|
|
427
|
+
↓
|
|
428
|
+
Fix first.
|
|
429
|
+
|
|
430
|
+
Is it duplicated?
|
|
431
|
+
↓
|
|
432
|
+
Consolidate.
|
|
433
|
+
|
|
434
|
+
Is it difficult to understand?
|
|
435
|
+
↓
|
|
436
|
+
Simplify.
|
|
437
|
+
|
|
438
|
+
Is it tightly coupled?
|
|
439
|
+
↓
|
|
440
|
+
Separate responsibilities.
|
|
441
|
+
|
|
442
|
+
Is it slow?
|
|
443
|
+
↓
|
|
444
|
+
Measure → identify bottleneck → optimize.
|
|
445
|
+
|
|
446
|
+
Is it merely unconventional?
|
|
447
|
+
↓
|
|
448
|
+
Don't change it without a reason.
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
This prevents **refactoring for aesthetics**.
|
|
452
|
+
|
|
453
|
+
---
|
|
454
|
+
|
|
455
|
+
### 17. Implementation quality hierarchy
|
|
456
|
+
|
|
457
|
+
The agent should prioritize:
|
|
458
|
+
|
|
459
|
+
```text id="p7v2m5"
|
|
460
|
+
1. Correctness
|
|
461
|
+
2. User experience
|
|
462
|
+
3. Accessibility
|
|
463
|
+
4. Reliability
|
|
464
|
+
5. Maintainability
|
|
465
|
+
6. Performance
|
|
466
|
+
7. Consistency
|
|
467
|
+
8. Visual polish
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
These priorities can shift depending on the project, but **visual polish should never compensate for broken behavior**.
|
|
471
|
+
|
|
472
|
+
---
|
|
473
|
+
|
|
474
|
+
### File 60 operating principle
|
|
475
|
+
|
|
476
|
+
```text id="k9x4s1"
|
|
477
|
+
UNDERSTAND EXISTING SYSTEM
|
|
478
|
+
↓
|
|
479
|
+
PRESERVE BEHAVIOR
|
|
480
|
+
↓
|
|
481
|
+
MAP DESIGN TO COMPONENTS
|
|
482
|
+
↓
|
|
483
|
+
USE THE DESIGN SYSTEM
|
|
484
|
+
↓
|
|
485
|
+
IMPLEMENT STATE + INTERACTION
|
|
486
|
+
↓
|
|
487
|
+
KEEP ARCHITECTURE CLEAN
|
|
488
|
+
↓
|
|
489
|
+
OPTIMIZE WHERE JUSTIFIED
|
|
490
|
+
↓
|
|
491
|
+
BUILD + TEST
|
|
492
|
+
↓
|
|
493
|
+
VISUALLY VERIFY
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
The key mindset is:
|
|
497
|
+
|
|
498
|
+
> **Don't merely make the code look like the design. Make the implementation faithfully express the design system, interaction model, accessibility requirements, and product behavior.**
|