@leejungkiin/awkit 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.
Files changed (139) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +146 -0
  3. package/VERSION +1 -0
  4. package/bin/awf.js +549 -0
  5. package/bin/awk.js +1759 -0
  6. package/core/AGENTS.md +39 -0
  7. package/core/GEMINI.md +202 -0
  8. package/core/GEMINI.md.bak +244 -0
  9. package/core/orchestrator.md +58 -0
  10. package/package.json +46 -0
  11. package/schemas/brain.schema.json +342 -0
  12. package/schemas/preferences.schema.json +95 -0
  13. package/schemas/session.schema.json +112 -0
  14. package/skill-packs/neural-memory/README.md +111 -0
  15. package/skill-packs/neural-memory/pack.json +35 -0
  16. package/skill-packs/neural-memory/schemas/brain-snapshot.json +167 -0
  17. package/skill-packs/neural-memory/skills/nm-memory-audit/SKILL.md +157 -0
  18. package/skill-packs/neural-memory/skills/nm-memory-evolution/SKILL.md +202 -0
  19. package/skill-packs/neural-memory/skills/nm-memory-intake/SKILL.md +135 -0
  20. package/skill-packs/neural-memory/skills/nm-memory-sync/SKILL.md +184 -0
  21. package/skill-packs/neural-memory/workflows/nm-import.md +73 -0
  22. package/skill-packs/neural-memory/workflows/nm-recall.md +67 -0
  23. package/skill-packs/neural-memory/workflows/nm-snapshot.md +69 -0
  24. package/skills/adaptive-language/SKILL.md +189 -0
  25. package/skills/ambient-brain/SKILL.md +314 -0
  26. package/skills/ambient-brain/brain-router.md +185 -0
  27. package/skills/ambient-brain/brain-templates.md +201 -0
  28. package/skills/auto-save/SKILL.md +223 -0
  29. package/skills/awf-adaptive-language/SKILL.md +189 -0
  30. package/skills/awf-context-help/SKILL.md +180 -0
  31. package/skills/awf-error-translator/SKILL.md +153 -0
  32. package/skills/awf-session-restore/SKILL.md +270 -0
  33. package/skills/awf-version-tracker/SKILL.md +32 -0
  34. package/skills/awf-version-tracker/scripts/snapshot.sh +22 -0
  35. package/skills/beads-manager/SKILL.md +323 -0
  36. package/skills/brainstorm-agent/SKILL.md +295 -0
  37. package/skills/context-help/SKILL.md +180 -0
  38. package/skills/error-translator/SKILL.md +153 -0
  39. package/skills/ios-engineer/SKILL.md +101 -0
  40. package/skills/memory-sync/SKILL.md +378 -0
  41. package/skills/memory-sync/memory-router.md +185 -0
  42. package/skills/memory-sync/memory-templates.md +201 -0
  43. package/skills/orchestrator/SKILL.md +193 -0
  44. package/skills/session-restore/SKILL.md +240 -0
  45. package/templates/CODEBASE.md +80 -0
  46. package/templates/brain.example.json +321 -0
  47. package/templates/preferences.example.json +21 -0
  48. package/templates/project-identity/android.json +28 -0
  49. package/templates/project-identity/backend-nestjs.json +24 -0
  50. package/templates/project-identity/expo.json +27 -0
  51. package/templates/project-identity/ios.json +27 -0
  52. package/templates/project-identity/web-nextjs.json +24 -0
  53. package/templates/session.example.json +53 -0
  54. package/templates/specs/design-template.md +166 -0
  55. package/templates/specs/requirements-template.md +65 -0
  56. package/templates/specs/tasks-template.md +132 -0
  57. package/templates/structures/android.txt +10 -0
  58. package/templates/structures/backend-nestjs.txt +6 -0
  59. package/templates/structures/expo.txt +9 -0
  60. package/templates/structures/ios.txt +9 -0
  61. package/templates/structures/web-nextjs.txt +6 -0
  62. package/templates/workflow_dual_mode_template.md +87 -0
  63. package/workflows/_uncategorized/README.md +339 -0
  64. package/workflows/_uncategorized/ads-creative.md +357 -0
  65. package/workflows/_uncategorized/ads-full-optimization.md +308 -0
  66. package/workflows/_uncategorized/ads-plan.md +247 -0
  67. package/workflows/_uncategorized/ads-user-analysis.md +337 -0
  68. package/workflows/_uncategorized/skill-health.md +35 -0
  69. package/workflows/_uncategorized/skill-rollback.md +35 -0
  70. package/workflows/ads/admob.md +62 -0
  71. package/workflows/ads/ads-analyst.md +201 -0
  72. package/workflows/ads/ads-audit.md +106 -0
  73. package/workflows/ads/ads-optimize.md +97 -0
  74. package/workflows/ads/ads-targeting.md +241 -0
  75. package/workflows/ads/adsExpert.md +160 -0
  76. package/workflows/ads/smali-ads-config.md +400 -0
  77. package/workflows/ads/smali-ads-flow.md +331 -0
  78. package/workflows/ads/smali-ads-interstitial.md +377 -0
  79. package/workflows/ads/smali-ads-native.md +382 -0
  80. package/workflows/context/auto-execution-workflow.md +291 -0
  81. package/workflows/context/auto-implement.md +211 -0
  82. package/workflows/context/codebase-sync.md +163 -0
  83. package/workflows/context/logic-reasoning-workflow.md +260 -0
  84. package/workflows/context/next.md +195 -0
  85. package/workflows/context/recap.md +212 -0
  86. package/workflows/context/save-brain.md +285 -0
  87. package/workflows/context/user-intent-analysis-workflow.md +206 -0
  88. package/workflows/expert/codeExpert.md +126 -0
  89. package/workflows/expert/debugExpert.md +136 -0
  90. package/workflows/expert/planExpert.md +112 -0
  91. package/workflows/git/cloudflare-tunnel.md +135 -0
  92. package/workflows/git/git-commit-workflow.md +75 -0
  93. package/workflows/git/hotfix.md +357 -0
  94. package/workflows/git/release-notes.md +160 -0
  95. package/workflows/git/rollback.md +52 -0
  96. package/workflows/git/smart-git-ops.md +103 -0
  97. package/workflows/lifecycle/brainstorm.md +377 -0
  98. package/workflows/lifecycle/code.md +663 -0
  99. package/workflows/lifecycle/debug.md +116 -0
  100. package/workflows/lifecycle/deploy.md +95 -0
  101. package/workflows/lifecycle/init.md +152 -0
  102. package/workflows/lifecycle/master-code-workflow.md +300 -0
  103. package/workflows/lifecycle/migration.md +196 -0
  104. package/workflows/lifecycle/plan.md +91 -0
  105. package/workflows/lifecycle/refactor.md +165 -0
  106. package/workflows/lifecycle/run.md +52 -0
  107. package/workflows/lifecycle/test.md +91 -0
  108. package/workflows/meta/customize.md +346 -0
  109. package/workflows/meta/file-protection-rules.md +129 -0
  110. package/workflows/meta/help.html +350 -0
  111. package/workflows/meta/project-identity-enforcement.md +180 -0
  112. package/workflows/mobile/app-analysis.md +64 -0
  113. package/workflows/mobile/maestro-qa-workflow.md +470 -0
  114. package/workflows/mobile/maestro-test-workflow.md +84 -0
  115. package/workflows/mobile/structure-clean-architect.md +271 -0
  116. package/workflows/mobile/turbo-mobile-build.md +190 -0
  117. package/workflows/quality/accessibility-audit.md +311 -0
  118. package/workflows/quality/audit.md +217 -0
  119. package/workflows/quality/bug-hunter.md +243 -0
  120. package/workflows/quality/code-janitor.md +209 -0
  121. package/workflows/quality/code-quality-rules.md +132 -0
  122. package/workflows/quality/performance-audit.md +343 -0
  123. package/workflows/quality/project-audit.md +61 -0
  124. package/workflows/quality/self-healing-test.md +192 -0
  125. package/workflows/quality/ui-review.md +130 -0
  126. package/workflows/quality/ux-audit.md +213 -0
  127. package/workflows/quality/visual-debug.md +34 -0
  128. package/workflows/roles/oracle.md +267 -0
  129. package/workflows/roles/product-manager-workflow.md +52 -0
  130. package/workflows/roles/qa-engineer-workflow.md +41 -0
  131. package/workflows/roles/tech-lead-workflow.md +45 -0
  132. package/workflows/roles/ui-ux-designer-workflow.md +42 -0
  133. package/workflows/roles/vibe-coding-master-workflow.md +52 -0
  134. package/workflows/ui/app-screen-analyzer.md +152 -0
  135. package/workflows/ui/create-feature.md +332 -0
  136. package/workflows/ui/create-spec-architect.md +184 -0
  137. package/workflows/ui/design-to-ui.md +308 -0
  138. package/workflows/ui/ui-first-methodology.md +279 -0
  139. package/workflows/ui/visualize.md +298 -0
@@ -0,0 +1,382 @@
1
+ ---
2
+ description: 📰 Tích hợp Native Ads vào APK mod - Tận dụng library có sẵn
3
+ ---
4
+
5
+ # Smali Native Ads Integration
6
+
7
+ > **🎯 Mục tiêu**: Tích hợp Native Ads bằng cách tận dụng ads library có sẵn trong APK.
8
+
9
+ ---
10
+
11
+ ## 🔍 Phase 1: Discovery - Tìm Native Ads Library
12
+
13
+ ### 1.1. Scan Pattern-based Search
14
+
15
+ **Pattern 1: Tìm theo keyword**
16
+ ```bash
17
+ # Tìm file chứa "Native"
18
+ find smali* -name "*Native*.smali" | grep -i ad
19
+
20
+ # Tìm theo nội dung
21
+ find smali* -name "*.smali" | xargs grep -l "NativeAd\|native.*ad"
22
+ ```
23
+
24
+ **Pattern 2: Tìm theo View components**
25
+ ```bash
26
+ # Native Ad thường có View custom
27
+ find smali* -name "*AdView*.smali"
28
+ find smali* -name "*NativeView*.smali"
29
+
30
+ # Hoặc trong layout
31
+ grep -r "NativeAd" res/layout/
32
+ ```
33
+
34
+ **Pattern 3: Google AdMob Native**
35
+ ```bash
36
+ # Native Ad từ AdMob SDK
37
+ find smali* -path "*/gms/ads/nativead/*" -type f
38
+ ```
39
+
40
+ ### 1.2. Identify Components
41
+
42
+ **Common structures:**
43
+ - `NativeAd.smali` - Core ad object
44
+ - `NativeAdView.smali` - Container view
45
+ - `NativeAdOptions.smali` - Configuration
46
+ - `MediaView.smali` - Media content view
47
+ - Custom wrappers: `*NativeAdHelper*.smali`
48
+
49
+ **Document findings:**
50
+ ```
51
+ [Native Ads Discovery]
52
+
53
+ Library Location: smali_classes*/{path}/
54
+ Core Classes:
55
+ - NativeAd: {ClassName}.smali
56
+ - AdView: {ViewClassName}.smali
57
+ - Loader: {LoaderClassName}.smali
58
+
59
+ View Components:
60
+ - Layout: res/layout/{native_ad_layout}.xml
61
+ - Binding: {package}/databinding/{Binding}.smali (nếu có)
62
+
63
+ Current Usage:
64
+ - Used in: {Activity/Fragment}.smali
65
+ - Inflated in: {methodName}()
66
+ ```
67
+
68
+ ---
69
+
70
+ ## 📦 Phase 2: Understanding Native Ad Structure
71
+
72
+ ### 2.1. Ad Assets Components
73
+
74
+ **Standard Native Ad có các thành phần:**
75
+
76
+ | Asset | Purpose | View Type |
77
+ |-------|---------|-----------|
78
+ | **Headline** | Tiêu đề chính | TextView |
79
+ | **Body** | Mô tả | TextView |
80
+ | **Icon** | Logo/Icon | ImageView |
81
+ | **Media** | Ảnh/Video lớn | MediaView |
82
+ | **Call to Action** | Button hành động | Button |
83
+ | **Advertiser** | Tên advertiser | TextView |
84
+ | **Star Rating** | Đánh giá | RatingBar |
85
+ | **Price** | Giá (nếu có) | TextView |
86
+ | **Store** | Store name | TextView |
87
+
88
+ ### 2.2. Analyze Existing Layout
89
+
90
+ **Tìm layout XML:**
91
+ ```bash
92
+ # Tìm layout có Native Ad
93
+ grep -r "NativeAdView\|native.*ad" res/layout/
94
+
95
+ # Hoặc tìm theo ID
96
+ grep -r "@id/ad_" res/layout/
97
+ ```
98
+
99
+ **Structure thường gặp:**
100
+ ```xml
101
+ <com.google.android.gms.ads.nativead.NativeAdView>
102
+ <ImageView android:id="@+id/ad_app_icon" />
103
+ <TextView android:id="@+id/ad_headline" />
104
+ <TextView android:id="@+id/ad_body" />
105
+ <com.google.android.gms.ads.nativead.MediaView
106
+ android:id="@+id/ad_media" />
107
+ <Button android:id="@+id/ad_call_to_action" />
108
+ </com.google.android.gms.ads.nativead.NativeAdView>
109
+ ```
110
+
111
+ ### 2.3. API Pattern Recognition
112
+
113
+ **Sử dụng jadx để xem pattern:**
114
+ ```java
115
+ // Example pattern
116
+ AdLoader adLoader = new AdLoader.Builder(context, "AD_UNIT_ID")
117
+ .forNativeAd(new NativeAd.OnNativeAdLoadedListener() {
118
+ @Override
119
+ public void onNativeAdLoaded(NativeAd nativeAd) {
120
+ // Populate views
121
+ }
122
+ })
123
+ .build();
124
+
125
+ adLoader.loadAd(new AdRequest.Builder().build());
126
+ ```
127
+
128
+ ---
129
+
130
+ ## 🔧 Phase 3: Integration Strategy
131
+
132
+ ### 3.1. Determine Placement
133
+
134
+ **Từ `/smali-ads-flow`:**
135
+ - **Onboarding Activity** - Between slides
136
+ - **Other screens** (optional) - List items, feed, etc.
137
+
138
+ **Layout Strategy:**
139
+
140
+ **Option A: Inline placement**
141
+ ```xml
142
+ <ScrollView>
143
+ <LinearLayout>
144
+ <!-- Content -->
145
+ <TextView .../>
146
+
147
+ <!-- Native Ad Container -->
148
+ <include layout="@layout/native_ad_layout" />
149
+
150
+ <!-- More content -->
151
+ </LinearLayout>
152
+ </ScrollView>
153
+ ```
154
+
155
+ **Option B: Overlay placement**
156
+ ```xml
157
+ <FrameLayout>
158
+ <!-- Main content -->
159
+ <ViewPager .../>
160
+
161
+ <!-- Ad overlay -->
162
+ <include
163
+ layout="@layout/native_ad_layout"
164
+ android:layout_gravity="bottom" />
165
+ </FrameLayout>
166
+ ```
167
+
168
+ ### 3.2. Loading Pattern
169
+
170
+ **Lifecycle integration:**
171
+ ```
172
+ onCreate/onViewCreated:
173
+ → Initialize AdLoader
174
+ → Load ad
175
+
176
+ onNativeAdLoaded:
177
+ → Populate NativeAdView
178
+ → Show ad container
179
+ → Track impression
180
+
181
+ onDestroy:
182
+ → Destroy ad
183
+ → Cleanup resources
184
+ ```
185
+
186
+ ### 3.3. View Population
187
+
188
+ **Generic pattern trong Smali:**
189
+ ```
190
+ 1. Get ad assets (headline, body, icon, etc.)
191
+ 2. Set to corresponding views
192
+ 3. Register NativeAdView
193
+ 4. Track loaded state
194
+ ```
195
+
196
+ **Implementation**: Xem existing usage trong APK để copy pattern
197
+
198
+ ---
199
+
200
+ ## 🎨 Phase 4: UI Implementation
201
+
202
+ ### 4.1. Layout Creation/Reuse
203
+
204
+ **Option 1: Reuse existing layout**
205
+ ```bash
206
+ # Tìm layout có sẵn
207
+ find res/layout -name "*native*.xml"
208
+ find res/layout -name "*ad*.xml"
209
+
210
+ # Copy và modify cho use case mới
211
+ cp res/layout/existing_native_ad.xml res/layout/onboarding_native_ad.xml
212
+ ```
213
+
214
+ **Option 2: Create new layout**
215
+ - Design theo style app
216
+ - Include all required ad components
217
+ - Match NativeAdView structure
218
+
219
+ ### 4.2. Styling Considerations
220
+
221
+ **Tuân thủ AdMob policy:**
222
+ - Phải có "Ad" badge/label
223
+ - Không được misleading
224
+ - CTA button phải rõ ràng
225
+ - Không che khuất nội dung bắt buộc
226
+
227
+ **Implementation:**
228
+ ```xml
229
+ <!-- Ad badge -->
230
+ <TextView
231
+ android:text="Ad"
232
+ android:background="@color/ad_badge_bg"
233
+ .../>
234
+ ```
235
+
236
+ ---
237
+
238
+ ## 🔌 Phase 5: Code Injection
239
+
240
+ ### 5.1. Hook Points
241
+
242
+ **Trong OnboardingActivity:**
243
+ ```
244
+ Location: OnboardingActivity.smali
245
+ Method: onCreate() hoặc setupUI()
246
+
247
+ Actions:
248
+ 1. Initialize AdLoader
249
+ 2. Load native ad
250
+ 3. Setup callback handlers
251
+ ```
252
+
253
+ ### 5.2. Injection Pattern
254
+
255
+ **Generic template:**
256
+ ```smali
257
+ # In onCreate or initialization method
258
+
259
+ # Create AdLoader
260
+ new-instance v0, Lcom/google/android/gms/ads/AdLoader$Builder;
261
+ const-string v1, "{AD_UNIT_ID}"
262
+ invoke-direct {v0, p0, v1}, ...; <init>(...)
263
+
264
+ # Set native ad listener
265
+ # ... (copy pattern from existing usage)
266
+
267
+ # Build and load
268
+ invoke-virtual {v0}, ...; build()
269
+ move-result-object v1
270
+ invoke-virtual {v1, ...}, ...; loadAd(...)
271
+ ```
272
+
273
+ ### 5.3. Callback Implementation
274
+
275
+ **Pattern:**
276
+ ```smali
277
+ .method private onNativeAdLoaded(Lcom/.../NativeAd;)V
278
+ # 1. Get ad container view
279
+ # 2. Populate assets to views
280
+ # 3. Register ad view
281
+ # 4. Make container visible
282
+ .end method
283
+
284
+ .method private onAdFailedToLoad()V
285
+ # Fallback: hide ad container
286
+ # Continue without ad
287
+ .end method
288
+ ```
289
+
290
+ ---
291
+
292
+ ## ✅ Phase 6: Testing & Validation
293
+
294
+ ### 6.1. Functional Tests
295
+
296
+ | Test | Expected | Verification |
297
+ |------|----------|--------------|
298
+ | **Load Success** | Ad loads, views populated | Visual check |
299
+ | **All Assets** | Headline, body, media, CTA shown | Check each element |
300
+ | **Click Works** | Clicking opens advertiser page | Test CTA |
301
+ | **Fallback** | No ad = hidden container | Test with no network |
302
+ | **No Memory Leak** | Destroy properly | Monitor memory |
303
+
304
+ ### 6.2. UI/UX Tests
305
+
306
+ - [ ] Ad không che khuất content quan trọng
307
+ - [ ] "Ad" badge visible
308
+ - [ ] Layout responsive với different screen sizes
309
+ - [ ] Không conflict với app UI
310
+ - [ ] Smooth scroll/transition
311
+
312
+ ### 6.3. Debug Commands
313
+
314
+ ```bash
315
+ # Monitor native ad events
316
+ adb logcat | grep -E "NativeAd|AdLoader|MediaView"
317
+
318
+ # Test with test ad ID
319
+ # ca-app-pub-3940256099942544/2247696110 (Android Test Native)
320
+
321
+ # Check view hierarchy
322
+ adb shell uiautomator dump
323
+ adb pull /sdcard/window_dump.xml
324
+ ```
325
+
326
+ ---
327
+
328
+ ## 📋 Implementation Checklist
329
+
330
+ ### Discovery
331
+ - [ ] Tìm được native ad library/wrapper
332
+ - [ ] Xác định NativeAd và NativeAdView classes
333
+ - [ ] Tìm được existing layout
334
+ - [ ] Document API usage pattern
335
+
336
+ ### Layout
337
+ - [ ] Có layout cho native ad
338
+ - [ ] Include tất cả required components
339
+ - [ ] Add "Ad" badge
340
+ - [ ] Styling match app design
341
+
342
+ ### Integration
343
+ - [ ] Hook vào OnboardingActivity
344
+ - [ ] Inject AdLoader initialization
345
+ - [ ] Implement onNativeAdLoaded callback
346
+ - [ ] Populate view assets
347
+
348
+ ### Testing
349
+ - [ ] Load ad successfully
350
+ - [ ] All assets display correctly
351
+ - [ ] Click tracking works
352
+ - [ ] Fallback when no ad
353
+ - [ ] No memory leaks
354
+
355
+ ---
356
+
357
+ ## 🔗 Related Resources
358
+
359
+ ### Workflows
360
+ - `/smali-ads-flow` - Main ads flow
361
+ - `/smali-ads-interstitial` - Interstitial ads
362
+ - `/smali-ads-config` - Remote config
363
+
364
+ ### References
365
+ - [AdMob Native Ads Guide](https://developers.google.com/admob/android/native)
366
+ - [Native Ads Policies](https://support.google.com/admob/answer/6329638)
367
+ - [Test Ads](https://developers.google.com/admob/android/test-ads)
368
+
369
+ ---
370
+
371
+ ## 💡 Tips & Best Practices
372
+
373
+ 1. **Reuse existing implementation**: Copy pattern từ native ad có sẵn trong app
374
+ 2. **Respect policies**: Luôn có "Ad" badge, không misleading
375
+ 3. **Test thoroughly**: Native ad có nhiều assets, test kỹ
376
+ 4. **Handle missing assets**: Một số ad không có đủ assets (rating, price)
377
+ 5. **Cleanup properly**: Destroy ad trong onDestroy để tránh memory leak
378
+ 6. **Responsive design**: Test với nhiều screen sizes
379
+
380
+ ---
381
+
382
+ **⚠️ Quan trọng**: Native Ads phải tuân thủ strict policies về disclosure và presentation!
@@ -0,0 +1,291 @@
1
+ ---
2
+ description: ⚡ Auto-execution với verification gates
3
+ ---
4
+
5
+ # UI-First Auto Execution Workflow
6
+
7
+ ## Philosophy: UI-First Spec-Driven Development
8
+
9
+ **Core Principle**: Build and verify UI first, then implement logic with confidence
10
+ **Purpose**: Ensure polished UX before investing in complex logic
11
+ **Benefit**: Reduced rework, better UX, improved code reusability
12
+
13
+ ### Key Benefits
14
+
15
+ - **User-Centric**: UI validated before logic implementation
16
+ - **Reduced Rework**: UI changes don't affect completed logic
17
+ - **Better Planning**: Logic design informed by confirmed UI
18
+ - **Code Reusability**: Components designed for reuse from start
19
+ - **Quality Focus**: Clear quality gates per phase
20
+
21
+ ## Workflow Phases Overview
22
+
23
+ ```mermaid
24
+ graph TD
25
+ A[Phase 1: UI] --> B{Verify}
26
+ B -->|OK| C[Phase 2: UI Test]
27
+ B -->|No| A
28
+ C --> D{Pass?}
29
+ D -->|Yes| E[Phase 3: Logic]
30
+ D -->|No| A
31
+ E --> F[Phase 4: Logic Test]
32
+ F --> G{Pass?}
33
+ G -->|Yes| H[Phase 5: Integration]
34
+ G -->|No| E
35
+ H --> I[Done]
36
+ ```
37
+
38
+ ## Phase 1: UI Implementation
39
+
40
+ ### Objectives
41
+ Build complete UI with design specs, animations, responsive design, and reusable components
42
+
43
+ ### Execution Steps
44
+
45
+ ```yaml
46
+ # 1. Spec Analysis
47
+ ui_spec_review:
48
+ - Read docs/specs/[feature]/design.md
49
+ - Identify screens, components, UI states
50
+ - Note animations, transitions, reusable parts
51
+
52
+ # 2. Component Architecture
53
+ component_structure:
54
+ - Design hierarchy, shared components
55
+ - Plan composition, props, UI state management
56
+
57
+ # 3. Build Sequence
58
+ build_sequence:
59
+ 1. Shared: Buttons, inputs, cards, tokens, layouts
60
+ 2. Feature: Screen layouts, components, custom elements
61
+ 3. Polish: Animations, micro-interactions, responsive, a11y
62
+
63
+ # 4. Implementation Rules
64
+ implementation_rules:
65
+ - Use mock data, implement all visual states
66
+ - Add placeholder handlers, focus on visual perfection
67
+ - No business logic, API calls, or data persistence yet
68
+ ```
69
+
70
+ ### Quality Checklist
71
+
72
+ - [ ] All screens/states implemented (loading, error, empty, success)
73
+ - [ ] Smooth animations (60fps), responsive design
74
+ - [ ] Accessibility (VoiceOver, Dynamic Type)
75
+ - [ ] Consistent design system, reusable components
76
+
77
+ ## Phase 2: UI Verification Gate
78
+
79
+ **MANDATORY CHECKPOINT**: User must approve UI before logic
80
+
81
+ ### Verification Process
82
+
83
+ ```yaml
84
+ # 1. Demo Prep
85
+ demo_preparation:
86
+ - Build app, prepare scenarios
87
+ - Document limitations (mock data)
88
+
89
+ # 2. Review Checklist
90
+ review_checklist:
91
+ Visual: Colors, typography, spacing, icons
92
+ Interactions: Animations, transitions, touch targets, gestures
93
+ UX: Navigation, hierarchy, error/loading states
94
+ Responsive: Devices, orientations, content lengths
95
+ A11y: VoiceOver, Dynamic Type, contrast
96
+
97
+ # 3. Feedback
98
+ feedback_format:
99
+ changes_required: [List, priority, affected screens]
100
+ approval_status: approved | minor_changes | major_changes
101
+
102
+ # 4. Decision
103
+ gate_decision:
104
+ approved/minor_changes: Document → Phase 3
105
+ major_changes: Document → Phase 1
106
+ ```
107
+
108
+ **Gate Doc**: Create `docs/specs/[feature]/ui-approval.md` with review date, status, feedback, changes, approver, next steps
109
+
110
+ ## Phase 3: UI Testing
111
+
112
+ ### Test Implementation
113
+
114
+ ```yaml
115
+ # Snapshot, Component, Accessibility, Visual Regression Tests
116
+ tests:
117
+ snapshot: All screens, states, devices, light/dark
118
+ component: Rendering, props, state, interactions
119
+ accessibility: VoiceOver, Dynamic Type, contrast, touch sizes
120
+ visual_regression: Compare designs, detect changes
121
+ ```
122
+
123
+ **Run**: `npm run test:ui` or `./scripts/run-ui-tests.sh`
124
+
125
+ ### Quality Gate
126
+ - [ ] All tests pass (snapshot, component, a11y, visual regression)
127
+ - [ ] No warnings/errors, performance < 16ms render
128
+
129
+ ## Phase 4: Logic Implementation
130
+
131
+ ### Objectives
132
+ Implement business logic, API integration, persistence, error handling, reusability
133
+
134
+ ### Planning & Strategy
135
+
136
+ ```yaml
137
+ # Architecture
138
+ architecture_review:
139
+ - Review UI, design data flow, state management
140
+ - Identify reusable logic, design service layer
141
+
142
+ # Reusability
143
+ reusability_planning:
144
+ shared: Common patterns → services/utilities
145
+ feature: Isolated logic, dependency injection, testability
146
+
147
+ # Implementation
148
+ implementation:
149
+ 1. Service Layer: Interfaces, API clients, repositories, logic, errors
150
+ 2. State: Connect UI, updates, side effects, async
151
+ 3. Integration: Replace mocks, connect handlers, add states/errors/validation
152
+
153
+ # Build Sequence
154
+ logic_build:
155
+ 1. Core: API clients, repositories, utilities
156
+ 2. Business: Feature logic, transformations, validation
157
+ 3. State: Containers, actions/reducers, side effects
158
+ 4. Integration: Connect UI, replace mocks, errors
159
+ ```
160
+
161
+ ### Code Reusability Patterns
162
+
163
+ **Service Pattern**
164
+ ```typescript
165
+ interface DataService<T> {
166
+ fetch(id: string): Promise<T>
167
+ create(data: Partial<T>): Promise<T>
168
+ update(id: string, data: Partial<T>): Promise<T>
169
+ delete(id: string): Promise<void>
170
+ }
171
+ class UserService implements DataService<User> { /* ... */ }
172
+ ```
173
+
174
+ **Repository Pattern**
175
+ ```typescript
176
+ abstract class BaseRepository<T> {
177
+ abstract fetch(id: string): Promise<T>
178
+ abstract save(data: T): Promise<void>
179
+ protected handleError(error: Error): void { /* shared */ }
180
+ }
181
+ class UserRepository extends BaseRepository<User> { /* ... */ }
182
+ ```
183
+
184
+ **Hook Pattern**
185
+ ```typescript
186
+ function useDataFetch<T>(fetcher: () => Promise<T>) {
187
+ const [data, setData] = useState<T | null>(null)
188
+ const [loading, setLoading] = useState(false)
189
+ const [error, setError] = useState<Error | null>(null)
190
+ return { data, loading, error, refetch }
191
+ }
192
+ ```
193
+
194
+ ### Quality Checklist
195
+ - [ ] Logic, API, persistence complete
196
+ - [ ] Comprehensive error handling
197
+ - [ ] Reusable, composable, testable code
198
+ - [ ] SOLID principles, dependency injection
199
+
200
+ ## Phase 5: Logic Testing
201
+
202
+ ### Test Implementation
203
+
204
+ ```yaml
205
+ tests:
206
+ unit: Services, logic, transformations, validation (mock deps)
207
+ integration: API, persistence, state, errors
208
+ e2e: User flows, real data, errors, edge cases
209
+ ```
210
+
211
+ **Run**: `npm run test:logic|integration|e2e|coverage`
212
+
213
+ ### Quality Gate
214
+ - [ ] Coverage > 80%, all tests pass
215
+ - [ ] E2E for critical flows, no critical bugs
216
+ - [ ] Performance acceptable, errors verified
217
+
218
+ ## Phase 6: Integration & Final Validation
219
+
220
+ ### Integration Steps
221
+
222
+ ```yaml
223
+ integration:
224
+ final: Remove mocks, connect UI to logic, verify states/errors
225
+ testing: Run all UI/logic/integration/e2e/performance tests
226
+ uat: Build RC, prepare scenarios, document issues, schedule UAT
227
+ ```
228
+
229
+ ### Final Quality Gate
230
+ - [ ] All tests pass, no critical bugs
231
+ - [ ] Performance, accessibility verified
232
+ - [ ] Documentation complete, user acceptance obtained
233
+
234
+ ## Automation Support
235
+
236
+ ### Task Spec Format
237
+
238
+ ```yaml
239
+ feature_task:
240
+ id: "feature_001"
241
+ name: "User Profile"
242
+
243
+ phase_1_ui:
244
+ components: [{name: "ProfileHeader", type: "component", reusable: true}]
245
+ states: [loading, error, empty, success]
246
+ animations: [fade_in, slide_up, spring_bounce]
247
+
248
+ phase_2_verification:
249
+ demo_scenarios: ["View with data", "loading", "error"]
250
+ approval_required: true
251
+
252
+ phase_3_ui_testing:
253
+ test_types: [snapshot, component, accessibility, visual_regression]
254
+
255
+ phase_4_logic:
256
+ services: [{name: "UserService", reusable: true}]
257
+ integrations: [{api: "GET /users/:id"}, {storage: "UserDefaults"}]
258
+
259
+ phase_5_logic_testing:
260
+ test_types: [unit, integration, e2e]
261
+ coverage_target: 80
262
+
263
+ phase_6_integration:
264
+ validation: [full_test_suite, performance_check, uat_approval]
265
+ ```
266
+
267
+ ### Execution Control
268
+
269
+ ```yaml
270
+ execution_rules:
271
+ phase_gates:
272
+ - {phase: ui_implementation, next: ui_verification, auto_proceed: false}
273
+ - {phase: ui_verification, next: ui_testing, auto_proceed: true, conditions: [approval_status: approved]}
274
+ - {phase: ui_testing, next: logic_implementation, auto_proceed: true, conditions: [all_tests_pass: true]}
275
+ - {phase: logic_implementation, next: logic_testing, auto_proceed: true}
276
+ - {phase: logic_testing, next: integration, auto_proceed: true, conditions: [coverage: ">=80%", all_tests_pass: true]}
277
+ - {phase: integration, next: complete, auto_proceed: false, conditions: [uat_approved: true]}
278
+ ```
279
+
280
+ ## Error Handling
281
+
282
+ **UI Errors**: Syntax → fix/rebuild | Design → spec review | Component → isolate/fix
283
+ **UI Rejection**: Document → prioritize → Phase 1 → schedule review
284
+ **UI Test Fail**: Identify → fix → re-run → update snapshots
285
+ **Logic Errors**: API → check integration | State → review mgmt | Data → validate transforms
286
+ **Logic Test Fail**: Fix → improve coverage → re-run
287
+ **Integration Issues**: Isolate → fix → re-test → validate flow
288
+
289
+ ---
290
+
291
+ **Success**: Polished UI approved, comprehensive tests, clean reusable code, smooth UI-logic integration