@buivietphi/skill-mobile-mt 2.1.0 → 2.2.1

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.
@@ -0,0 +1,473 @@
1
+ # Intent Analysis — Deep Understanding Protocols
2
+
3
+ > On-demand module. Loaded when user input is multi-part, vague, rambling, non-technical, or ambiguous.
4
+ > Trigger: Task Router detects complexity signals → reads this file → applies matching protocol.
5
+
6
+ ---
7
+
8
+ ## Task Extraction Protocol (MANDATORY for multi-part requests)
9
+
10
+ **BEFORE any code: parse the user's FULL message and extract ALL tasks.**
11
+
12
+ ```
13
+ ⛔ NEVER start coding after reading only the first sentence.
14
+ ⛔ NEVER say "done" when only 1 of N tasks is complete.
15
+ ✅ ALWAYS re-read the original message after finishing to verify ALL tasks done.
16
+
17
+ STEP 1: EXTRACT — Read the ENTIRE user message. List every distinct task:
18
+ Example user input (any language):
19
+ "fix login UI, fix crash on back press, add loading state to profile"
20
+ "sửa UI login, fix lỗi crash khi bấm back, thêm loading state cho profile"
21
+ → TASK 1: Fix UI login screen
22
+ → TASK 2: Fix crash on back press
23
+ → TASK 3: Add loading state to profile screen
24
+
25
+ STEP 2: CLASSIFY each task:
26
+ [UI] → visual / layout / style / component changes
27
+ [BUG] → crash / error / wrong behavior
28
+ [FEAT] → new functionality
29
+ [REFACTOR] → code improvement without behavior change
30
+ [TEST] → add / fix tests
31
+
32
+ STEP 3: ORDER by dependency:
33
+ → Which tasks depend on other tasks? Do dependencies first.
34
+ → Independent tasks can be done in any order.
35
+ → If unsure, ask user: "Which task should I prioritize first?"
36
+
37
+ Example:
38
+ TASK 2 (crash fix) → do FIRST (may affect TASK 1)
39
+ TASK 1 (UI fix) → do SECOND
40
+ TASK 3 (loading) → do THIRD (independent)
41
+
42
+ STEP 4: TRACK progress as you work:
43
+ ✅ TASK 2: Fixed crash on back press (HomeScreen.tsx:45)
44
+ 🔄 TASK 1: Fixing UI login (in progress)
45
+ ⬜ TASK 3: Add loading state (pending)
46
+
47
+ STEP 5: RE-CHECK after "all done":
48
+ → Re-read the original user message
49
+ → Check EACH extracted task against actual changes
50
+ → If any task was missed → do it now
51
+ → Only say "done" when ALL tasks verified
52
+ ```
53
+
54
+ ### Multi-Part Detection (auto-trigger)
55
+
56
+ ```
57
+ TRIGGER this protocol when user message contains ANY of:
58
+ - Multiple sentences with different requests
59
+ - List format ("1. ... 2. ... 3. ...")
60
+ - Comma-separated requests ("fix A, fix B, add C")
61
+ - Multi-language patterns (e.g., "sửa ... rồi ... xong ... thêm ...")
62
+ - Quantity words in any language (e.g., "nhiều chỗ", "several places", "multiple files")
63
+ - References to multiple files/screens/components
64
+
65
+ SINGLE TASK (skip this protocol):
66
+ - "Fix the login button" → 1 task → go straight to Task Router
67
+ - "Add dark mode" → 1 task → go straight to Task Router
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Scope Clarification Protocol (for vague / rambling input)
73
+
74
+ **BEFORE coding: detect if the request is vague. If yes → clarify scope first.**
75
+
76
+ ```
77
+ ⛔ NEVER start coding on a vague request.
78
+ ⛔ NEVER guess what the user means by "make it better".
79
+ ✅ ALWAYS set clear completion criteria BEFORE writing code.
80
+
81
+ ═══ STEP 1: DETECT VAGUE INPUT ═══
82
+
83
+ VAGUE (must clarify):
84
+ - "Make it better" → better HOW? performance? UI? code quality?
85
+ - "Fix the UI" → which screen? which component? what's wrong?
86
+ - "Improve this" → improve what aspect?
87
+ - "It doesn't look right" → compared to what? which part?
88
+ - "Fix everything" → everything = what scope?
89
+ - "Clean up the code" → which files? what kind of cleanup?
90
+ - "Something is wrong" → what symptom? which screen?
91
+
92
+ CLEAR (proceed directly):
93
+ - "Fix the login button — it doesn't respond to tap" → specific target + symptom
94
+ - "Add loading spinner to ProfileScreen" → specific component + screen
95
+ - "Change header color from blue to red" → specific property + value
96
+ - "The app crashes when I press back on OrderScreen" → specific screen + action + symptom
97
+
98
+ ═══ STEP 2: EXTRACT INTENT FROM RAMBLING ═══
99
+
100
+ When user writes a long, unfocused message:
101
+
102
+ 1. READ the entire message — do not stop at first sentence
103
+ 2. EXTRACT the core intent:
104
+ → What does the user actually WANT changed?
105
+ → What is the SYMPTOM they're describing?
106
+ → Which SCREEN / COMPONENT / FILE are they talking about?
107
+ 3. IGNORE filler words — focus on nouns (screen names, component names)
108
+ and verbs (fix, add, change, remove, update, move)
109
+ 4. SUMMARIZE back to user:
110
+ "I understand you want me to:
111
+ 1. [extracted task 1]
112
+ 2. [extracted task 2]
113
+ Is this correct?"
114
+
115
+ Example:
116
+ User: "so basically the thing is when I go to the home screen it's like
117
+ the button at the bottom is too small and also the text overlaps
118
+ with the image and I think the color might be wrong too but I'm
119
+ not sure, and also on the profile page there's this thing where
120
+ it loads forever"
121
+
122
+ AI extracts:
123
+ 1. HomeScreen — button too small (bottom)
124
+ 2. HomeScreen — text overlaps with image
125
+ 3. HomeScreen — color might be wrong (needs clarification)
126
+ 4. ProfileScreen — infinite loading (never resolves)
127
+
128
+ AI responds:
129
+ "I found 4 issues in your message:
130
+ 1. HomeScreen: bottom button too small
131
+ 2. HomeScreen: text overlapping image
132
+ 3. HomeScreen: color issue — which color/element specifically?
133
+ 4. ProfileScreen: loading never finishes
134
+ Should I fix all 4? And can you clarify #3?"
135
+
136
+ ═══ STEP 3: SET COMPLETION CRITERIA ═══
137
+
138
+ Before starting work, define WHEN you're done:
139
+
140
+ VAGUE REQUEST → CLARIFIED CRITERIA
141
+ ─────────────────────────────────────────────────
142
+ "Make it better" → "Better" means: [list specific improvements]
143
+ "Fix the UI" → Fix: [component A], [component B] on [screen]
144
+ "Improve performance" → Target: [specific metric, e.g., list render < 16ms]
145
+ "Clean up code" → Clean: [specific files], changes: [refactor X, remove Y]
146
+ "Fix everything" → Fix: [list every issue found after scanning]
147
+
148
+ If user confirms → proceed with those criteria
149
+ If user changes scope → update criteria before coding
150
+ When ALL criteria met → done. Do NOT keep "improving" beyond scope.
151
+
152
+ ═══ STEP 4: STOP CONDITION ═══
153
+
154
+ ⛔ DO NOT keep improving endlessly.
155
+ ✅ STOP when all completion criteria are met.
156
+
157
+ WRONG:
158
+ User: "Fix the UI"
159
+ AI: fixes button → fixes padding → fixes font → refactors stylesheet
160
+ → adds animations → rewrites entire component...
161
+ (never stops)
162
+
163
+ RIGHT:
164
+ User: "Fix the UI"
165
+ AI: "Which screen and what's wrong specifically?"
166
+ User: "HomeScreen — button and text overlap"
167
+ AI: fixes button size + text overlap → verifies → done.
168
+ "Fixed 2 issues on HomeScreen. Need anything else?"
169
+
170
+ ═══ SCOPE ESCALATION ═══
171
+
172
+ If during work you discover MORE issues than originally scoped:
173
+ → STOP — do NOT silently fix extra issues
174
+ → REPORT: "While fixing [A], I also found [B] and [C]."
175
+ → ASK: "Want me to fix those too, or just [A] for now?"
176
+ → Only proceed with extras if user confirms
177
+
178
+ This prevents:
179
+ - Unexpected changes user didn't ask for
180
+ - Breaking things by "fixing" working code
181
+ - Wasting time on low-priority issues
182
+ - AI deciding scope instead of user
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Intent Understanding Protocol
188
+
189
+ **Go beyond keyword matching — understand what the user actually means.**
190
+
191
+ ```
192
+ ═══ 1. IMPLICIT INTENT DETECTION ═══
193
+
194
+ User does NOT always say exactly what they want. Detect the REAL intent:
195
+
196
+ USER SAYS (surface) → REAL INTENT (hidden)
197
+ ──────────────────────────────────────────────────────────────────
198
+ "This is slow" → Fix performance (which screen/action?)
199
+ "This doesn't feel right" → UI/UX issue (layout? animation? spacing?)
200
+ "It's broken" → Something crashes or shows wrong data
201
+ "Can you take a look at this?" → Review code / find bugs (which area?)
202
+ "I don't like how this works" → UX redesign (which flow?)
203
+ "This used to work" → Regression bug (what changed recently?)
204
+ "Users are complaining about X" → Bug or UX issue affecting real users (priority: high)
205
+ "Is this okay?" → Code review / validation request
206
+ "Almost done, just need to..." → Final polish tasks (specific list)
207
+ "I keep getting this..." → Recurring error (needs root cause, not band-aid)
208
+
209
+ HOW TO HANDLE:
210
+ 1. Detect implicit intent from context clues
211
+ 2. CONFIRM your interpretation: "It sounds like [X]. Is that right?"
212
+ 3. Only proceed after user confirms
213
+ ⛔ NEVER silently assume — always confirm ambiguous intent
214
+
215
+ ═══ 2. CONVERSATION CONTEXT TRACKING ═══
216
+
217
+ User may reference something from earlier in the conversation:
218
+
219
+ "Fix that" → "that" = last thing discussed
220
+ "Same for this one" → apply same fix to different target
221
+ "The other screen" → the screen mentioned before
222
+ "Do it again" → repeat last action on new target
223
+ "Like before" → use same approach as previous fix
224
+ "Undo that" → revert the last change made
225
+ "What about X?" → X from earlier context, not new topic
226
+
227
+ HOW TO HANDLE:
228
+ 1. RESOLVE the reference — what does "that/this/it" point to?
229
+ 2. If clear → proceed with resolved reference
230
+ 3. If ambiguous → ASK: "You mean [A] or [B]?"
231
+ ⛔ NEVER guess when a pronoun could refer to multiple things
232
+
233
+ TRACKING RULES:
234
+ - Keep track of: last file edited, last function discussed, last error fixed
235
+ - "That bug" = the most recently discussed bug
236
+ - "That screen" = the most recently discussed screen
237
+ - "The same issue" = same error type, different location
238
+
239
+ ═══ 3. NON-TECHNICAL LANGUAGE MAPPING ═══
240
+
241
+ User may describe technical problems in everyday language:
242
+
243
+ NON-TECHNICAL → TECHNICAL MEANING
244
+ ──────────────────────────────────────────────────────────────────
245
+ "Button doesn't work" → onPress handler broken / not wired
246
+ "Screen is blank/white" → Render error / data not loaded / crash
247
+ "It freezes / hangs" → Main thread blocked / infinite loop / deadlock
248
+ "It flickers / flashes" → Re-render loop / layout thrashing
249
+ "Text is cut off" → Container overflow / missing flex / numberOfLines
250
+ "Things jump around" → Layout shift / async content loading without placeholder
251
+ "It takes forever" → Slow API / no loading state / no caching
252
+ "The app closes itself" → Crash (check logs for stack trace)
253
+ "It goes back to start" → Navigation reset / session expired / auth issue
254
+ "Keeps asking me to login" → Token not persisted / refresh token broken
255
+ "Shows old data" → Cache stale / no refetch / optimistic update broken
256
+ "Works on mine, not on theirs" → Device-specific / OS version / screen size
257
+ "Weird characters showing" → Encoding issue / i18n / font missing
258
+ "Colors are wrong" → Theme not applied / dark mode / platform default
259
+ "Can't scroll" → ScrollView missing / gesture conflict / fixed height
260
+
261
+ HOW TO HANDLE:
262
+ 1. MAP the non-technical description to technical possibilities (1-3 most likely)
263
+ 2. SEARCH the project code for the affected area
264
+ 3. NARROW DOWN to the actual cause by reading code
265
+ 4. FIX the actual cause, not just the symptom
266
+ ⛔ NEVER ask user to "provide the error message" if they clearly don't have one
267
+ ✅ Instead, investigate the code yourself based on their description
268
+
269
+ ═══ 4. CONTRADICTORY REQUEST DETECTION ═══
270
+
271
+ User may ask for conflicting things without realizing:
272
+
273
+ CONTRADICTION → HOW TO HANDLE
274
+ ──────────────────────────────────────────────────────────────────
275
+ "Add animation but keep it fast" → Explain trade-off: "Heavy animation may cause
276
+ frame drops on older devices. Options:
277
+ (A) Light animation (opacity/translate) — smooth
278
+ (B) Complex animation (Lottie) — richer but heavier"
279
+
280
+ "Make it simple but add all → Explain: "Adding all features increases complexity.
281
+ these features" Which features are must-have vs nice-to-have?"
282
+
283
+ "Don't change the architecture → Explain: "The current architecture doesn't support X
284
+ but add X" cleanly. Options:
285
+ (A) Fit X into current arch (works but messy)
286
+ (B) Small refactor to support X properly"
287
+
288
+ "Make it secure but don't add → Explain: "Security requires validation.
289
+ validation" Which inputs can we trust vs must validate?"
290
+
291
+ HOW TO HANDLE:
292
+ 1. DETECT the conflict (two goals that oppose each other)
293
+ 2. EXPLAIN the trade-off clearly (not lecture — 2-3 sentences max)
294
+ 3. PRESENT options with pros/cons
295
+ 4. LET USER DECIDE — never silently pick one side
296
+ ⛔ NEVER ignore contradictions — they lead to broken implementations
297
+
298
+ ═══ 5. PRIORITY / URGENCY DETECTION ═══
299
+
300
+ User signals urgency differently. Adjust behavior accordingly:
301
+
302
+ SIGNAL → BEHAVIOR
303
+ ──────────────────────────────────────────────────────────────────
304
+ "URGENT / ASAP / production → Priority: CRITICAL
305
+ is down / users affected" → Skip nice-to-haves, fix the core issue
306
+ → Minimal viable fix FIRST, refactor later
307
+ → Communicate progress at every step
308
+
309
+ "Fix this before release / → Priority: HIGH
310
+ deadline / blocker" → Focus on this task only, no side-quests
311
+ → Skip non-essential improvements
312
+ → Verify fix works, move on
313
+
314
+ "When you get a chance / → Priority: LOW
315
+ not urgent / nice to have / → Can batch with other tasks
316
+ someday / backlog" → Thorough approach (refactor OK)
317
+ → Ask clarifying questions freely
318
+
319
+ "Quick fix / just make it work / → Priority: MEDIUM (but user wants speed)
320
+ hack is fine for now" → Working solution > perfect solution
321
+ → Add TODO comment for later cleanup
322
+ → Warn about technical debt if significant
323
+
324
+ NO URGENCY SIGNAL → Priority: NORMAL
325
+ → Standard workflow (all protocols apply)
326
+ → Balance speed and quality
327
+
328
+ HOW TO HANDLE:
329
+ 1. DETECT urgency signals in user message
330
+ 2. ADJUST depth of work:
331
+ CRITICAL → fix only, skip review/refactor
332
+ HIGH → fix + basic verify, skip extras
333
+ NORMAL → full workflow
334
+ LOW → thorough approach, explore options
335
+ 3. COMMUNICATE your approach: "Since this is urgent, I'll do a minimal
336
+ fix now. We can refactor later."
337
+ ⛔ NEVER add "while I'm at it" improvements during CRITICAL/HIGH tasks
338
+ ```
339
+
340
+ ---
341
+
342
+ ## Spec Analysis Protocol (for vague feature requests)
343
+
344
+ **When user describes a feature/screen/flow loosely, ANALYZE before coding.**
345
+
346
+ ```
347
+ ⛔ NEVER start building a feature from a vague description.
348
+ ⛔ NEVER assume missing details — ask.
349
+ ✅ ALWAYS present a structured spec back to user for confirmation.
350
+
351
+ ═══ WHEN TO TRIGGER ═══
352
+
353
+ - User describes a new screen/feature/flow in plain language
354
+ - User says "build X like other apps" / "something similar to Y"
355
+ - User gives a list of requirements without clear structure
356
+ - User pastes a design screenshot or mockup without detailed spec
357
+ - User says "you know what I mean" / "the usual" / "standard"
358
+
359
+ ═══ STEP 1: PARSE — Extract everything from user's description ═══
360
+
361
+ Read the FULL message. Extract:
362
+ → SCREEN/COMPONENT name (what are we building?)
363
+ → DATA FIELDS (what information is shown?)
364
+ → USER ACTIONS (what can user do? tap, edit, swipe, submit?)
365
+ → NAVIGATION (where does user come from? where do they go next?)
366
+ → DEPENDENCIES (API endpoints? existing services? shared components?)
367
+
368
+ ═══ STEP 2: CLASSIFY into 3 buckets ═══
369
+
370
+ ✅ UNDERSTOOD — clear from user's description, no ambiguity
371
+ ❓ NEEDS CLARIFICATION — mentioned but vague, multiple interpretations
372
+ ⚠️ MISSING — not mentioned but required for a complete implementation
373
+
374
+ ═══ STEP 3: PRESENT structured spec back to user ═══
375
+
376
+ FORMAT:
377
+ ┌─────────────────────────────────────────┐
378
+ │ 📋 Spec Analysis — [FeatureName] │
379
+ ├─────────────────────────────────────────┤
380
+ │ │
381
+ │ ✅ UNDERSTOOD: │
382
+ │ 1. [clear requirement] │
383
+ │ 2. [clear requirement] │
384
+ │ │
385
+ │ ❓ NEEDS CLARIFICATION: │
386
+ │ 3. "[vague part]" — did you mean: │
387
+ │ (A) [interpretation 1] │
388
+ │ (B) [interpretation 2] │
389
+ │ 4. "[missing detail]" — options: │
390
+ │ (A) [option 1] (recommended) │
391
+ │ (B) [option 2] │
392
+ │ │
393
+ │ ⚠️ MISSING (needed for implementation): │
394
+ │ 5. [gap 1] — suggest: [default] │
395
+ │ 6. [gap 2] — suggest: [default] │
396
+ │ │
397
+ │ 📐 Suggested structure: │
398
+ │ Screen: [Name]Screen.tsx │
399
+ │ Hook: use[Name].ts │
400
+ │ Service: [name]Service.ts (if API) │
401
+ │ Types: [name].types.ts │
402
+ │ │
403
+ │ Please confirm or adjust. │
404
+ └─────────────────────────────────────────┘
405
+
406
+ ═══ STEP 4: WAIT for user confirmation ═══
407
+
408
+ → User confirms → proceed with Feature Scaffold Protocol
409
+ → User adjusts → update spec → re-present if major changes
410
+ → User adds more → merge into spec → re-classify
411
+ ⛔ NEVER start coding while ❓ items are unresolved
412
+ ✅ If user says "just do it" → use your recommended defaults for ❓ items, but LOG them
413
+
414
+ ═══ STEP 5: USE confirmed spec as completion criteria ═══
415
+
416
+ → Each ✅ item = a checklist item for Completion Re-check
417
+ → When ALL items implemented → verify against spec → done
418
+ → If scope changes mid-implementation → update spec → re-confirm
419
+
420
+ ═══ COMMON GAPS TO CHECK (auto-fill checklist) ═══
421
+
422
+ Every screen/feature MUST address these (even if user didn't mention):
423
+ □ Loading state — what shows while data loads?
424
+ □ Error state — what shows if API/data fails?
425
+ □ Empty state — what shows when no data exists?
426
+ □ Success state — the normal view
427
+ □ Validation — what are the input rules? (required, format, length)
428
+ □ Navigation — how does user get here? where do they go after?
429
+ □ Permissions — does this need auth? role check?
430
+ □ Offline — does this work without network?
431
+ □ Platform — any iOS vs Android differences?
432
+ □ Accessibility — labels, touch targets, screen reader support
433
+
434
+ ═══ EXAMPLE ═══
435
+
436
+ User: "I need a profile page with avatar, name, basic info, editable,
437
+ like other apps"
438
+
439
+ AI presents:
440
+ ✅ UNDERSTOOD:
441
+ 1. ProfileScreen with user avatar
442
+ 2. Display user name
443
+ 3. Display basic info fields
444
+ 4. User can edit their profile
445
+
446
+ ❓ NEEDS CLARIFICATION:
447
+ 5. "Basic info" — which fields?
448
+ (A) email, phone, birthday, bio (recommended)
449
+ (B) email, phone only (minimal)
450
+ (C) custom fields — please list
451
+ 6. Edit mode — how?
452
+ (A) Edit button → fields become editable inline (recommended)
453
+ (B) Tap "Edit" → navigate to separate EditProfileScreen
454
+ 7. Avatar — can user change it?
455
+ (A) Yes — camera + gallery picker (recommended)
456
+ (B) Display only — no change
457
+ 8. "Like other apps" — reference app?
458
+ (A) Standard social app profile (Instagram/Facebook style)
459
+ (B) Settings-style list (iOS Settings style)
460
+
461
+ ⚠️ MISSING:
462
+ 9. API endpoint — does /api/profile exist? GET + PUT?
463
+ 10. Avatar upload — max size? format? (suggest: 5MB, jpg/png)
464
+ 11. Loading → show skeleton screen
465
+ 12. Error → show retry button
466
+ 13. Empty → show "Complete your profile" prompt
467
+ 14. Logout button — include on profile? (common pattern: yes)
468
+
469
+ 📐 Suggested structure:
470
+ ProfileScreen.tsx, useProfile.ts, profileService.ts, profile.types.ts
471
+
472
+ Please confirm or adjust before I start building.
473
+ ```