@buivietphi/skill-mobile-mt 2.0.1 → 2.1.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 +56 -38
- package/README.md +68 -40
- package/SKILL.md +471 -50
- package/package.json +1 -1
- package/shared/bug-detection.md +411 -27
- package/shared/code-review.md +899 -37
- package/shared/debugging-intelligence.md +787 -0
- package/shared/i18n-localization.md +426 -0
- package/shared/prompt-engineering.md +176 -20
- package/shared/storage-patterns.md +312 -0
package/SKILL.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: skill-mobile-mt
|
|
3
3
|
description: "Master Senior Mobile Engineer. Patterns from 30+ production repos (200k+ GitHub stars: Ignite, Expensify, Mattermost, Immich, AppFlowy, Now in Android, TCA). Use when: building mobile features, fixing mobile bugs, reviewing mobile code, mobile architecture, React Native, Flutter, iOS Swift, Android Kotlin, mobile performance, mobile security audit, mobile code review, app release. Two modes: (1) default = pre-built production patterns, (2) 'project' = reads current project and adapts."
|
|
4
|
-
version: "2.
|
|
4
|
+
version: "2.1.0"
|
|
5
5
|
author: buivietphi
|
|
6
6
|
priority: high
|
|
7
7
|
user-invocable: true
|
|
@@ -51,24 +51,26 @@ RULE 7: ASK AFTER 3 FAILS — 3 failed attempts at same error → STOP → prese
|
|
|
51
51
|
1. [Cardinal Rules](#cardinal-rules-inviolable)
|
|
52
52
|
2. [Task Router](#task-router)
|
|
53
53
|
3. [Communication Protocol](#communication-protocol)
|
|
54
|
-
4. [
|
|
55
|
-
5. [
|
|
56
|
-
6. [
|
|
57
|
-
7. [
|
|
58
|
-
8. [
|
|
59
|
-
9. [
|
|
60
|
-
10. [
|
|
61
|
-
11. [
|
|
62
|
-
12. [
|
|
63
|
-
13. [
|
|
64
|
-
14. [
|
|
65
|
-
15. [
|
|
66
|
-
16. [
|
|
67
|
-
17. [
|
|
68
|
-
18. [
|
|
69
|
-
19. [
|
|
70
|
-
20. [
|
|
71
|
-
21. [
|
|
54
|
+
4. [Decision Matrix Protocol](#decision-matrix-protocol)
|
|
55
|
+
5. [Execution Modes](#execution-modes)
|
|
56
|
+
6. [Mandatory Checkpoint](#mandatory-checkpoint)
|
|
57
|
+
7. [Auto-Detect](#auto-detect)
|
|
58
|
+
8. [Mobile Context](#mobile-context)
|
|
59
|
+
9. [Mode Selection](#mode-selection)
|
|
60
|
+
10. [Feature Scaffold Protocol](#feature-scaffold-protocol-project-mode)
|
|
61
|
+
11. [Error Recovery Protocol](#error-recovery-protocol)
|
|
62
|
+
12. [Quality Gate](#quality-gate)
|
|
63
|
+
13. [Build & Deploy Gates](#build--deploy-gates)
|
|
64
|
+
14. [Codebase Scan Strategy](#codebase-scan-strategy)
|
|
65
|
+
15. [Smart Loading](#smart-loading)
|
|
66
|
+
16. [Grounding Protocol (Anti-Hallucination)](#grounding-protocol-anti-hallucination)
|
|
67
|
+
17. [Docs-First Protocol (Always Use Latest)](#docs-first-protocol-always-use-latest)
|
|
68
|
+
18. [Security Protocol](#security-protocol)
|
|
69
|
+
19. [Hard Bans](#hard-bans)
|
|
70
|
+
20. [Mobile Anti-Patterns](#mobile-anti-patterns)
|
|
71
|
+
21. [Leverage Pyramid](#leverage-pyramid-where-to-invest-review-time)
|
|
72
|
+
22. [Session State Tracking](#session-state-tracking-for-long-tasks)
|
|
73
|
+
23. [Reference Files](#reference-files)
|
|
72
74
|
|
|
73
75
|
---
|
|
74
76
|
|
|
@@ -94,12 +96,90 @@ USER REQUEST → ACTION (Read tool required)
|
|
|
94
96
|
then: Read platform file (see Smart Loading below)
|
|
95
97
|
then: suggest structure based on project size + stack
|
|
96
98
|
|
|
97
|
-
"Fix / debug X" →
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
"Fix / debug X" → ⛔ STOP — DO NOT suggest anything yet
|
|
100
|
+
Step 1: CLASSIFY error type (crash/build/type/network/render/state/native)
|
|
101
|
+
Step 2: SEARCH PROJECT FIRST (mandatory before ANY suggestion)
|
|
102
|
+
→ Grep error keywords in src/ (class name, function name, error message)
|
|
103
|
+
→ Glob for related files (*.ts, *.tsx, *.dart, *.swift, *.kt)
|
|
104
|
+
→ Read the TOP 3-5 matched files — understand actual code
|
|
105
|
+
Step 3: Find root cause IN PROJECT CODE (cite file:line)
|
|
106
|
+
Step 4: Fix → verify → cite source
|
|
107
|
+
⛔ NEVER skip Step 1-2 — even if you "think" you know the answer
|
|
108
|
+
If complex/unfamiliar bug → also Read: shared/debugging-intelligence.md
|
|
109
|
+
|
|
110
|
+
"Check issue / investigate X" → ⛔ DO NOT FIX YET — investigate first
|
|
111
|
+
Step 1: Read issue description fully
|
|
112
|
+
Step 2: Extract affected feature + expected vs actual behavior
|
|
113
|
+
Step 3: Search project for affected code area (Grep/Glob src/)
|
|
114
|
+
Step 4: Read code → trace data flow → find root cause
|
|
115
|
+
Step 5: REPORT findings — ask user if they want a fix
|
|
116
|
+
⛔ NEVER jump straight to fixing without reporting first
|
|
117
|
+
|
|
118
|
+
"Paste error log / stack trace" → Step 1: FILTER noise (skip node_modules, engine frames)
|
|
119
|
+
Step 2: Extract signal lines (YOUR file paths, Error:, Caused by:)
|
|
120
|
+
Step 3: Parse stack trace by platform (RN/Flutter/iOS/Android)
|
|
121
|
+
Step 4: Search project src/ for extracted keywords
|
|
122
|
+
Step 5: Root cause → fix → cite
|
|
123
|
+
If long/complex trace → also Read: shared/debugging-intelligence.md
|
|
124
|
+
|
|
125
|
+
"Check giùm / xem thử / sao nó → ⛔ USER DOESN'T KNOW THE CAUSE — run Diagnostic Scan:
|
|
126
|
+
lạ / something's off / not sure Step 1: EXTRACT AREA from what user said or showed:
|
|
127
|
+
why / take a look / describe → Screen name? Feature name? Module name? File name?
|
|
128
|
+
symptoms without error" → If user paste code → that IS the area
|
|
129
|
+
→ If user describe behavior → extract the feature/screen name
|
|
130
|
+
Step 2: SEARCH project for that area (mandatory):
|
|
131
|
+
→ Grep "[feature/screen name]" src/
|
|
132
|
+
→ Glob "**/*[name]*" to find all related files
|
|
133
|
+
→ Read ALL matched files (not just 1 — scan broadly)
|
|
134
|
+
Step 3: RUN SCAN CHECKLIST on the code you just read:
|
|
135
|
+
→ Walk through bug-detection.md Step 5 checklist
|
|
136
|
+
→ Check: crash risks, memory leaks, race conditions,
|
|
137
|
+
security, performance, UX — against ACTUAL code
|
|
138
|
+
Step 4: REPORT what you found (structured):
|
|
139
|
+
→ "I scanned [N files] in [area]."
|
|
140
|
+
→ "Found [N] potential issues:" (list with severity + file:line)
|
|
141
|
+
→ "No critical issues found." (if clean)
|
|
142
|
+
→ "Suspicious: [describe what looks off based on code]"
|
|
143
|
+
Step 5: ASK what user wants to do:
|
|
144
|
+
→ "Want me to fix [specific issue]?"
|
|
145
|
+
→ "Want me to investigate [suspicious area] deeper?"
|
|
146
|
+
⛔ NEVER say "I don't see any issues" without having searched
|
|
147
|
+
⛔ NEVER suggest fixes before completing the scan report
|
|
148
|
+
|
|
149
|
+
"Review" (generic, no scope) → Read: shared/code-review.md → detect Review Mode:
|
|
150
|
+
→ Check git status → if changes exist → MODE: CHANGES
|
|
151
|
+
→ If no changes → ASK user: "Review full code hay file cụ thể?"
|
|
152
|
+
|
|
153
|
+
"Review full / review toàn bộ" → Read: shared/code-review.md → MODE: FULL
|
|
154
|
+
Read ALL src/ files → 12-category checklist → full report
|
|
155
|
+
|
|
156
|
+
"Review changes / review thay đổi /
|
|
157
|
+
review code đã sửa" → Read: shared/code-review.md → MODE: CHANGES
|
|
158
|
+
git diff → review only changed lines + context
|
|
159
|
+
|
|
160
|
+
"Review file X / review file này" → Read: shared/code-review.md → MODE: FILE
|
|
161
|
+
Read specified file → 12-category checklist on that file
|
|
162
|
+
|
|
163
|
+
"Review function X / review hàm" → Read: shared/code-review.md → MODE: FUNCTION
|
|
164
|
+
Find function → trace callers → deep review
|
|
165
|
+
|
|
166
|
+
"Review PR / review pull request" → Read: shared/code-review.md → MODE: PR
|
|
167
|
+
Read: shared/anti-patterns.md
|
|
168
|
+
Step 0 PR-Level → git diff base..HEAD → 12-category → verdict
|
|
169
|
+
|
|
170
|
+
"Review modified files /
|
|
171
|
+
review file đã sửa" → Read: shared/code-review.md → MODE: MODIFIED
|
|
172
|
+
git status → read modified files → review
|
|
173
|
+
|
|
174
|
+
"Review commit / review commits" → Read: shared/code-review.md → MODE: COMMITS
|
|
175
|
+
git log → git show each commit → review diffs
|
|
176
|
+
|
|
177
|
+
"Check PR / check review PR" → Read: shared/code-review.md → MODE: PR-CHECK
|
|
178
|
+
Step 0 ONLY (size, scope, tests, commits) → quick ✅/🔴
|
|
179
|
+
|
|
180
|
+
"Review accessibility / a11y" → Read: shared/code-review.md (§ Accessibility)
|
|
181
|
+
then: WCAG 2.1 mobile checklist — labels, touch targets,
|
|
182
|
+
contrast, screen reader, font scaling, color, focus, motion
|
|
103
183
|
|
|
104
184
|
"Optimize / performance X" → Read: shared/bug-detection.md (§ Performance section)
|
|
105
185
|
then: profile → identify bottleneck → fix
|
|
@@ -145,6 +225,17 @@ USER REQUEST → ACTION (Read tool required)
|
|
|
145
225
|
"Offline / cache / sync" → Read: shared/offline-first.md
|
|
146
226
|
then: implement local-first architecture
|
|
147
227
|
|
|
228
|
+
"Storage / lưu data / AsyncStorage / MMKV / SecureStore / Keychain /
|
|
229
|
+
SQLite / WatermelonDB / Realm / token storage / local database /
|
|
230
|
+
save to device / persist data" → Read: shared/storage-patterns.md
|
|
231
|
+
then: pick storage type from matrix → implement → security check
|
|
232
|
+
|
|
233
|
+
"i18n / multi-language / translation / localization / đa ngôn ngữ /
|
|
234
|
+
multilang / RTL / Arabic / locale / language switcher / date format /
|
|
235
|
+
number format / plural / slang / i18next / l10n" →
|
|
236
|
+
Read: shared/i18n-localization.md
|
|
237
|
+
then: pick library per platform → scaffold translations → RTL check
|
|
238
|
+
|
|
148
239
|
"Write/run E2E tests" → Read: shared/testing-strategy.md
|
|
149
240
|
then: Detox (RN) or Maestro (cross-platform) or XCUITest/Espresso
|
|
150
241
|
|
|
@@ -160,6 +251,14 @@ USER REQUEST → ACTION (Read tool required)
|
|
|
160
251
|
"Big feature / multi-screen" → Read: shared/ai-dlc-workflow.md
|
|
161
252
|
then: Elaborate → Construct (4 Hats) → Backpressure → Complete
|
|
162
253
|
|
|
254
|
+
"Which is better / compare / → Decision Matrix Protocol (in this file — no extra read)
|
|
255
|
+
nên dùng gì / best approach / Present 2-3 options in matrix format → recommend → wait
|
|
256
|
+
options / trade-offs / ⛔ NEVER just pick one without showing comparison
|
|
257
|
+
upgrade or not / migrate"
|
|
258
|
+
|
|
259
|
+
"How much work / big change? / → Estimation Protocol (in Decision Matrix Protocol section)
|
|
260
|
+
scope / effort / risk" Scan → classify XS/S/M/L/XL → risk → present
|
|
261
|
+
|
|
163
262
|
```
|
|
164
263
|
|
|
165
264
|
**⛔ NEVER start coding without identifying the task type first.**
|
|
@@ -219,6 +318,130 @@ BAD:
|
|
|
219
318
|
|
|
220
319
|
---
|
|
221
320
|
|
|
321
|
+
## Decision Matrix Protocol
|
|
322
|
+
|
|
323
|
+
**When multiple valid approaches exist, ALWAYS present a structured comparison — NEVER just pick one.**
|
|
324
|
+
|
|
325
|
+
### When This Triggers
|
|
326
|
+
|
|
327
|
+
```
|
|
328
|
+
TRIGGERS:
|
|
329
|
+
- User asks "how should I..." / "what's the best way to..."
|
|
330
|
+
- Multiple libraries/tools can solve the same problem
|
|
331
|
+
- Architecture decisions (monolith vs modular, REST vs GraphQL, etc.)
|
|
332
|
+
- Migration/upgrade questions ("should I upgrade to X?")
|
|
333
|
+
- Trade-off situations (performance vs simplicity, native vs cross-platform)
|
|
334
|
+
- User says "give me options" / "what are my choices"
|
|
335
|
+
|
|
336
|
+
⛔ DO NOT just pick one approach and implement it
|
|
337
|
+
✅ Present comparison → let user decide → then implement
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Decision Matrix Format
|
|
341
|
+
|
|
342
|
+
```
|
|
343
|
+
STEP 1: RESEARCH (before presenting options)
|
|
344
|
+
→ Read project code to understand constraints
|
|
345
|
+
→ Check existing patterns (what does the project already use?)
|
|
346
|
+
→ WebSearch for latest recommendations + benchmarks
|
|
347
|
+
→ Identify 2-3 viable options (no more — too many = analysis paralysis)
|
|
348
|
+
|
|
349
|
+
STEP 2: PRESENT MATRIX
|
|
350
|
+
|
|
351
|
+
┌────────────────────────────────────────────────────────────┐
|
|
352
|
+
│ DECISION: [What we're deciding] │
|
|
353
|
+
│ CONTEXT: [Project constraints — framework, SDK, team size] │
|
|
354
|
+
├──────────────┬──────────────┬──────────────┬───────────────┤
|
|
355
|
+
│ │ Option A │ Option B │ Option C │
|
|
356
|
+
├──────────────┼──────────────┼──────────────┼───────────────┤
|
|
357
|
+
│ What │ [1 sentence] │ [1 sentence] │ [1 sentence] │
|
|
358
|
+
│ Pros │ • fast │ • simple │ • scalable │
|
|
359
|
+
│ │ • typed │ • small │ • official │
|
|
360
|
+
│ Cons │ • complex │ • no types │ • heavy │
|
|
361
|
+
│ Performance │ [fast/med/slow]│ [fast/med/slow]│ [fast/med/slow]│
|
|
362
|
+
│ Bundle Size │ [small/med/large]│ [small/med/large]│ [small/med/large]│
|
|
363
|
+
│ Learning │ [easy/med/hard]│ [easy/med/hard]│ [easy/med/hard]│
|
|
364
|
+
│ Maintenance │ [low/med/high]│ [low/med/high]│ [low/med/high]│
|
|
365
|
+
│ Community │ [stars/npm weekly]│ [stars/npm weekly]│ [stars/npm weekly]│
|
|
366
|
+
│ Fits Project │ ✅/⚠️/❌ │ ✅/⚠️/❌ │ ✅/⚠️/❌ │
|
|
367
|
+
└──────────────┴──────────────┴──────────────┴───────────────┘
|
|
368
|
+
|
|
369
|
+
STEP 3: RECOMMENDATION (with reasoning)
|
|
370
|
+
→ "I recommend Option [X] because:
|
|
371
|
+
1. [reason based on project code — cite file]
|
|
372
|
+
2. [reason based on constraints]
|
|
373
|
+
3. [reason based on trade-offs]"
|
|
374
|
+
→ "However, Option [Y] is better if [condition]."
|
|
375
|
+
|
|
376
|
+
STEP 4: WAIT FOR USER DECISION
|
|
377
|
+
→ ⛔ DO NOT implement until user picks
|
|
378
|
+
→ If user says "just pick one" → implement your recommendation
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### Estimation Protocol (for scope/effort questions)
|
|
382
|
+
|
|
383
|
+
```
|
|
384
|
+
When user asks "how much work is this?" / "is this a big change?" / "should we do X?":
|
|
385
|
+
|
|
386
|
+
STEP 1: SCAN SCOPE
|
|
387
|
+
→ Glob + Grep to count affected files
|
|
388
|
+
→ Identify: how many files change? how many new files?
|
|
389
|
+
→ Check: any breaking changes to existing features?
|
|
390
|
+
|
|
391
|
+
STEP 2: CLASSIFY EFFORT
|
|
392
|
+
┌──────────────────────────────────────────────────┐
|
|
393
|
+
│ XS │ 1-2 files │ Simple change, no side effects │
|
|
394
|
+
│ S │ 3-5 files │ Contained change, few deps │
|
|
395
|
+
│ M │ 6-15 files│ Cross-feature, some testing │
|
|
396
|
+
│ L │ 16+ files │ Architectural, needs planning │
|
|
397
|
+
│ XL │ 30+ files │ Major refactor, phased approach │
|
|
398
|
+
└──────────────────────────────────────────────────┘
|
|
399
|
+
|
|
400
|
+
STEP 3: RISK ASSESSMENT
|
|
401
|
+
→ Breaking changes: [none / minor / major]
|
|
402
|
+
→ Test coverage: [good / partial / none — need to add]
|
|
403
|
+
→ Rollback difficulty: [easy / medium / hard]
|
|
404
|
+
→ Dependencies affected: [list them]
|
|
405
|
+
|
|
406
|
+
STEP 4: PRESENT
|
|
407
|
+
"This is a [S/M/L] change:
|
|
408
|
+
→ [N] files to modify, [N] new files
|
|
409
|
+
→ Risk: [low/medium/high] — [why]
|
|
410
|
+
→ Suggestion: [do it now / plan first / phase it]"
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Migration/Upgrade Decision Protocol
|
|
414
|
+
|
|
415
|
+
```
|
|
416
|
+
When user asks "should I upgrade to X?" / "migrate from A to B?":
|
|
417
|
+
|
|
418
|
+
STEP 1: CHECK CURRENT STATE
|
|
419
|
+
→ Read package.json / pubspec.yaml → exact current versions
|
|
420
|
+
→ Grep for deprecated APIs currently used in src/
|
|
421
|
+
→ Count how many files use the library/API being upgraded
|
|
422
|
+
|
|
423
|
+
STEP 2: CHECK TARGET STATE
|
|
424
|
+
→ WebSearch "[library] migration guide [current version] to [target version]"
|
|
425
|
+
→ WebSearch "[library] breaking changes [target version]"
|
|
426
|
+
→ List ALL breaking changes that affect THIS project
|
|
427
|
+
|
|
428
|
+
STEP 3: IMPACT ANALYSIS
|
|
429
|
+
→ For each breaking change → Grep in src/ → count affected files
|
|
430
|
+
→ Classify: auto-fixable (codemod) vs manual fix
|
|
431
|
+
|
|
432
|
+
STEP 4: PRESENT DECISION
|
|
433
|
+
"Upgrading [X] from [v1] to [v2]:
|
|
434
|
+
→ Breaking changes: [N] that affect your project
|
|
435
|
+
→ Files to update: [N]
|
|
436
|
+
→ Auto-fixable: [N] (via codemod)
|
|
437
|
+
→ Manual fixes: [N]
|
|
438
|
+
→ Risk: [low/medium/high]
|
|
439
|
+
→ Recommendation: [upgrade now / wait / partial upgrade]
|
|
440
|
+
→ If upgrading: [suggest phased plan]"
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
222
445
|
## Execution Modes
|
|
223
446
|
|
|
224
447
|
**Switch modes based on task phase. Each mode has different behavior.**
|
|
@@ -568,28 +791,47 @@ file upload / camera →
|
|
|
568
791
|
```
|
|
569
792
|
ERROR ENCOUNTERED → RECOVERY FLOW:
|
|
570
793
|
|
|
571
|
-
ATTEMPT
|
|
572
|
-
|
|
573
|
-
|
|
794
|
+
⛔ BEFORE ANY ATTEMPT: Search project source code first
|
|
795
|
+
→ Grep error keywords in src/ (file name, function name, class name)
|
|
796
|
+
→ Read matched files to understand actual code context
|
|
797
|
+
→ ONLY THEN proceed to fix attempts
|
|
798
|
+
|
|
799
|
+
ATTEMPT 1: Fix based on project code analysis
|
|
800
|
+
- You already searched src/ → you know WHERE the issue is
|
|
801
|
+
- Missing imports? → Check what the file actually imports → add correct one
|
|
802
|
+
- Type errors? → Read the actual types/interfaces in project → fix to match
|
|
574
803
|
- Linter errors? → Auto-format
|
|
575
804
|
- Run verification → success? DONE : next attempt
|
|
576
805
|
|
|
577
|
-
ATTEMPT 2:
|
|
578
|
-
-
|
|
579
|
-
-
|
|
806
|
+
ATTEMPT 2: Widen search — read related files
|
|
807
|
+
- Grep for the function/class across entire project (not just src/)
|
|
808
|
+
- Read files that CALL or IMPORT the broken code
|
|
809
|
+
- Check dependencies installed (package.json / pubspec.yaml)
|
|
580
810
|
- Verify native module linked (mobile)
|
|
581
811
|
- Run verification → success? DONE : next attempt
|
|
582
812
|
|
|
583
|
-
ATTEMPT 3: Alternative approach
|
|
584
|
-
-
|
|
585
|
-
-
|
|
586
|
-
- Simplify implementation
|
|
813
|
+
ATTEMPT 3: Alternative approach (still based on project context)
|
|
814
|
+
- Look at how SIMILAR features are implemented in the project
|
|
815
|
+
- Clone working pattern → adapt for this case
|
|
816
|
+
- Simplify implementation if needed
|
|
587
817
|
- Run verification → success? DONE : next attempt
|
|
588
818
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
-
|
|
592
|
-
-
|
|
819
|
+
⚠️ 3 FAILS = QUESTION ARCHITECTURE (mandatory checkpoint):
|
|
820
|
+
If 3 attempts failed on the SAME error → STOP fixing and ask:
|
|
821
|
+
- "Is this the right approach entirely?"
|
|
822
|
+
- "Is the underlying pattern/architecture wrong?"
|
|
823
|
+
- "Should I be solving a DIFFERENT problem?"
|
|
824
|
+
Search project for working alternatives:
|
|
825
|
+
→ Grep for similar feature that WORKS → compare the patterns
|
|
826
|
+
→ The bug may not be a bug — it may be a wrong approach
|
|
827
|
+
|
|
828
|
+
ATTEMPT 4: STOP & ASK USER (with evidence)
|
|
829
|
+
- Show what you searched and found in project
|
|
830
|
+
- Show EACH attempt: what you tried + what happened + why it failed
|
|
831
|
+
- ⛔ NEVER say "I tried everything" — show EXACTLY what you tried
|
|
832
|
+
- If 3+ fails: "This suggests the issue may be architectural.
|
|
833
|
+
I found [working_pattern] in [file] that solves this differently."
|
|
834
|
+
- Present 2-3 options with trade-offs
|
|
593
835
|
- Wait for user decision
|
|
594
836
|
```
|
|
595
837
|
|
|
@@ -795,6 +1037,118 @@ FOR UI CHANGES:
|
|
|
795
1037
|
|
|
796
1038
|
---
|
|
797
1039
|
|
|
1040
|
+
## Codebase Scan Strategy
|
|
1041
|
+
|
|
1042
|
+
**Protocol for large projects, monorepos, and multi-module codebases. Choose the right scan depth.**
|
|
1043
|
+
|
|
1044
|
+
### When This Triggers
|
|
1045
|
+
|
|
1046
|
+
```
|
|
1047
|
+
TRIGGERS:
|
|
1048
|
+
- Project has > 50 files in src/
|
|
1049
|
+
- Monorepo with multiple apps/packages
|
|
1050
|
+
- Multi-module project (app/ + packages/ + shared/)
|
|
1051
|
+
- User says "new project" / "first time seeing this code"
|
|
1052
|
+
- User says "check the whole codebase" / "audit"
|
|
1053
|
+
- You don't know where to start
|
|
1054
|
+
|
|
1055
|
+
⛔ DO NOT Read every file — token waste
|
|
1056
|
+
⛔ DO NOT guess structure from folder names alone
|
|
1057
|
+
✅ Scan strategically: breadth first, depth on demand
|
|
1058
|
+
```
|
|
1059
|
+
|
|
1060
|
+
### Scan Levels
|
|
1061
|
+
|
|
1062
|
+
```
|
|
1063
|
+
LEVEL 1: QUICK SCAN (~5 reads) — for focused tasks
|
|
1064
|
+
┌─────────────────────────────────────────────────────────┐
|
|
1065
|
+
│ 1. ls src/ (or app/ or lib/) → map top-level folders │
|
|
1066
|
+
│ 2. Read package.json / pubspec.yaml → deps + scripts │
|
|
1067
|
+
│ 3. Read 1 config file (tsconfig / eslint / analysis) │
|
|
1068
|
+
│ 4. Read CLAUDE.md / README.md (if exists) │
|
|
1069
|
+
│ 5. Glob "**/*[feature_name]*" → find target files │
|
|
1070
|
+
│ │
|
|
1071
|
+
│ USE WHEN: Task is focused (fix bug, add to existing) │
|
|
1072
|
+
└─────────────────────────────────────────────────────────┘
|
|
1073
|
+
|
|
1074
|
+
LEVEL 2: STANDARD SCAN (~15 reads) — for new features
|
|
1075
|
+
┌─────────────────────────────────────────────────────────┐
|
|
1076
|
+
│ Everything in Level 1 PLUS: │
|
|
1077
|
+
│ 6. ls each top-level src/ subfolder → map full tree │
|
|
1078
|
+
│ 7. Read 1 screen file (UI pattern) │
|
|
1079
|
+
│ 8. Read 1 service/api file (data pattern) │
|
|
1080
|
+
│ 9. Read 1 hook/viewmodel file (state pattern) │
|
|
1081
|
+
│ 10. Read 1 store/slice file (state management) │
|
|
1082
|
+
│ 11. Read navigation/router config │
|
|
1083
|
+
│ 12. Read .env.example (if exists) → API endpoints │
|
|
1084
|
+
│ 13. Grep "TODO\|FIXME\|HACK" src/ → known issues │
|
|
1085
|
+
│ 14. Read types/models directory → data shapes │
|
|
1086
|
+
│ 15. Read test file (if exists) → testing patterns │
|
|
1087
|
+
│ │
|
|
1088
|
+
│ USE WHEN: Building new feature, need full context │
|
|
1089
|
+
└─────────────────────────────────────────────────────────┘
|
|
1090
|
+
|
|
1091
|
+
LEVEL 3: DEEP SCAN (~30+ reads) — for audits & architecture
|
|
1092
|
+
┌─────────────────────────────────────────────────────────┐
|
|
1093
|
+
│ Everything in Level 2 PLUS: │
|
|
1094
|
+
│ 16. Read ALL screen/page files (list them all) │
|
|
1095
|
+
│ 17. Read ALL service/api files │
|
|
1096
|
+
│ 18. Read ALL store/state files │
|
|
1097
|
+
│ 19. Map dependency graph: who imports whom │
|
|
1098
|
+
│ 20. Check circular imports │
|
|
1099
|
+
│ 21. Read native config (ios/Info.plist, AndroidManifest)│
|
|
1100
|
+
│ 22. Read CI/CD config (if exists) │
|
|
1101
|
+
│ 23. Read ALL test files │
|
|
1102
|
+
│ 24. Grep for security issues (hardcoded keys, tokens) │
|
|
1103
|
+
│ 25+. Read shared/common components │
|
|
1104
|
+
│ │
|
|
1105
|
+
│ USE WHEN: Full audit, architecture review, migration │
|
|
1106
|
+
└─────────────────────────────────────────────────────────┘
|
|
1107
|
+
```
|
|
1108
|
+
|
|
1109
|
+
### Monorepo Strategy
|
|
1110
|
+
|
|
1111
|
+
```
|
|
1112
|
+
MONOREPO DETECTED WHEN:
|
|
1113
|
+
→ Root has packages/ or apps/ or modules/ or workspaces in package.json
|
|
1114
|
+
→ Multiple package.json files at different levels
|
|
1115
|
+
→ lerna.json / nx.json / turbo.json exists
|
|
1116
|
+
|
|
1117
|
+
SCAN PROTOCOL FOR MONOREPOS:
|
|
1118
|
+
1. READ ROOT: package.json → workspaces field → list all packages
|
|
1119
|
+
2. MAP PACKAGES: ls packages/ (or apps/) → list each package
|
|
1120
|
+
3. IDENTIFY TARGET: Which package does the user's task affect?
|
|
1121
|
+
4. FOCUS: Scan ONLY the target package at Level 2
|
|
1122
|
+
5. SHARED: Also scan shared packages that target imports
|
|
1123
|
+
→ Grep "from ['\"](../../packages|@monorepo)" in target package
|
|
1124
|
+
6. IGNORE: Other packages unless explicitly asked
|
|
1125
|
+
|
|
1126
|
+
⛔ NEVER scan the entire monorepo — scan the target package
|
|
1127
|
+
✅ Treat each package as its own project with its own scan
|
|
1128
|
+
```
|
|
1129
|
+
|
|
1130
|
+
### Multi-Module Strategy (React Native + Native)
|
|
1131
|
+
|
|
1132
|
+
```
|
|
1133
|
+
MULTI-MODULE DETECTED WHEN:
|
|
1134
|
+
→ Project has src/ (JS/TS) + ios/ + android/ folders
|
|
1135
|
+
→ Native modules exist (react-native.config.js or manual linking)
|
|
1136
|
+
→ Custom native code beyond standard template
|
|
1137
|
+
|
|
1138
|
+
SCAN PROTOCOL:
|
|
1139
|
+
1. IDENTIFY LAYER: Is the task JS/TS-only or involves native?
|
|
1140
|
+
2. JS/TS TASK → Scan src/ only (Level 1 or 2)
|
|
1141
|
+
3. NATIVE TASK → Also scan:
|
|
1142
|
+
→ ios/[AppName]/ → Swift/ObjC source files
|
|
1143
|
+
→ android/app/src/main/java/ → Kotlin/Java source files
|
|
1144
|
+
→ Check bridging: ios/[AppName]-Bridging-Header.h
|
|
1145
|
+
→ Check native modules: Grep "RCT_EXPORT_MODULE" or "@ReactMethod"
|
|
1146
|
+
4. CROSS-LAYER TASK (JS calls native) → Scan both layers
|
|
1147
|
+
→ Find the bridge: NativeModules.X in JS → X module in native
|
|
1148
|
+
```
|
|
1149
|
+
|
|
1150
|
+
---
|
|
1151
|
+
|
|
798
1152
|
## Smart Loading
|
|
799
1153
|
|
|
800
1154
|
**After auto-detect, use the Read tool to open ONLY relevant files.**
|
|
@@ -818,6 +1172,9 @@ FOR UI CHANGES:
|
|
|
818
1172
|
| All platforms | `shared/platform-excellence.md` | 🟡 Task Router says so |
|
|
819
1173
|
| All platforms | `shared/version-management.md` | 🟡 Task Router says so |
|
|
820
1174
|
| All platforms | `shared/observability.md` | 🟡 Task Router says so |
|
|
1175
|
+
| All platforms | `shared/storage-patterns.md` | 🟡 Task Router says so |
|
|
1176
|
+
| All platforms | `shared/i18n-localization.md` | 🟡 Task Router says so |
|
|
1177
|
+
| All platforms | `shared/debugging-intelligence.md` | 🟡 Complex bugs / stack traces / issue investigation |
|
|
821
1178
|
|
|
822
1179
|
**Cross-platform:** Flutter/RN projects also Read `ios/ios-native.md` + `android/android-native.md` for native modules.
|
|
823
1180
|
|
|
@@ -899,19 +1256,80 @@ RULE 6: NO PHANTOM PACKAGES
|
|
|
899
1256
|
### When Fixing Bugs
|
|
900
1257
|
|
|
901
1258
|
```
|
|
902
|
-
GROUNDED BUG FIX PROTOCOL:
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
1259
|
+
GROUNDED BUG FIX PROTOCOL (NON-NEGOTIABLE):
|
|
1260
|
+
|
|
1261
|
+
⛔ BEFORE YOU SAY ANYTHING — SEARCH THE PROJECT FIRST:
|
|
1262
|
+
|
|
1263
|
+
STEP 0: EXTRACT KEYWORDS + CHECK GIT (mandatory)
|
|
1264
|
+
→ Parse error message for: file name, function name, class name, module name, line number
|
|
1265
|
+
→ If error says "Cannot find X" → Grep for "X" in src/
|
|
1266
|
+
→ If error says "TypeError in Y" → Grep for "Y" in src/
|
|
1267
|
+
→ If error says "Module not found: Z" → Grep for "Z" in package.json AND src/
|
|
1268
|
+
→ CHECK RECENT CHANGES (if git project):
|
|
1269
|
+
→ First: git rev-parse --is-inside-work-tree 2>/dev/null
|
|
1270
|
+
→ If NOT git / no commits → skip git check → go to Step 1
|
|
1271
|
+
→ If git: git log --oneline -5 + git diff HEAD~3 --name-only
|
|
1272
|
+
→ If broken file was recently changed → read that diff FIRST
|
|
1273
|
+
→ 80%+ of bugs are caused by recent changes
|
|
1274
|
+
|
|
1275
|
+
STEP 1: SEARCH PROJECT SOURCE (mandatory — NEVER skip)
|
|
1276
|
+
→ Grep: search error keywords in src/ directory FIRST
|
|
1277
|
+
→ Glob: find related files by pattern (*.ts, *.tsx, *.dart, *.swift, *.kt)
|
|
1278
|
+
→ Read: open the TOP 3-5 most relevant matched files
|
|
1279
|
+
→ If no match in src/ → search in lib/, app/, packages/, modules/
|
|
1280
|
+
→ If STILL no match → expand to project root
|
|
1281
|
+
|
|
1282
|
+
STEP 2: READ & UNDERSTAND actual code
|
|
1283
|
+
→ Read the file(s) found in Step 1
|
|
1284
|
+
→ Trace the data flow: what calls this? what does it return?
|
|
1285
|
+
→ Check imports, types, interfaces IN THE PROJECT
|
|
1286
|
+
→ Check package.json / pubspec.yaml for dependency versions
|
|
1287
|
+
|
|
1288
|
+
STEP 3: FIND ROOT CAUSE in project code
|
|
1289
|
+
→ Cite exact file:line where the bug originates
|
|
1290
|
+
→ Explain WHY it fails based on the actual code you just read
|
|
1291
|
+
|
|
1292
|
+
STEP 4: FIND WORKING EXAMPLE (before fixing)
|
|
1293
|
+
→ Search SAME project for similar code that WORKS
|
|
1294
|
+
→ Compare broken code vs working code → list differences
|
|
1295
|
+
→ The fix should make broken code match the working pattern
|
|
1296
|
+
→ If no working example → proceed to Step 5
|
|
1297
|
+
|
|
1298
|
+
STEP 5: SINGLE HYPOTHESIS FIX
|
|
1299
|
+
→ Form ONE hypothesis from root cause
|
|
1300
|
+
→ Make the SMALLEST possible change
|
|
1301
|
+
→ ⛔ NEVER stack multiple fixes at once
|
|
1302
|
+
→ ⛔ NEVER "fix it and also refactor nearby code"
|
|
1303
|
+
→ Verify: does this fix ALL symptoms?
|
|
1304
|
+
→ If no → REVERT → new hypothesis (don't carry failed fixes forward)
|
|
1305
|
+
|
|
1306
|
+
STEP 6: DEFENSE IN DEPTH (after fix verified)
|
|
1307
|
+
→ Add validation at every layer data passes through
|
|
1308
|
+
→ Make the bug structurally impossible to recur
|
|
1309
|
+
→ Grep for side effects (other files using this function)
|
|
1310
|
+
|
|
1311
|
+
STEP 7: CITE source with evidence
|
|
1312
|
+
→ "Root cause: [file]:[line] — [what's wrong] — [traced from Step 2-3]"
|
|
1313
|
+
→ "Working example: [file]:[line] — [how it works correctly]"
|
|
1314
|
+
→ "Fix: [change] — [why it works] — [defense added at layers X, Y]"
|
|
1315
|
+
|
|
1316
|
+
⛔ HARD VIOLATIONS (auto-fail):
|
|
1317
|
+
- Suggesting a fix WITHOUT first running Grep/Glob on the project
|
|
912
1318
|
- "The error is probably because..." (guess without reading code)
|
|
913
1319
|
- "Try changing X to Y" (without reading the file first)
|
|
914
1320
|
- "This should fix it" (without verifying types match)
|
|
1321
|
+
- Suggesting generic Stack Overflow solutions without checking project context
|
|
1322
|
+
- Jumping to package.json/config fixes before checking src/ code
|
|
1323
|
+
- Stacking 3+ changes at once (1 hypothesis → 1 change → verify)
|
|
1324
|
+
- Claiming "done" without fresh verification evidence
|
|
1325
|
+
- "Should work now" / "I'm confident" without running/reading output
|
|
1326
|
+
|
|
1327
|
+
🚩 ANTI-RATIONALIZATION (catch yourself):
|
|
1328
|
+
"Should work now" → You didn't verify. RUN IT.
|
|
1329
|
+
"I'm confident this fixes" → Confidence ≠ evidence. PROVE IT.
|
|
1330
|
+
"Probably a race condition" → Buzzword. TRACE the async flow.
|
|
1331
|
+
"Let me also clean up..." → STOP. Fix the bug only.
|
|
1332
|
+
Same fix 3+ times → Architecture problem. STOP & rethink.
|
|
915
1333
|
```
|
|
916
1334
|
|
|
917
1335
|
### Anti-Hallucination Checklist (run before EVERY response)
|
|
@@ -1527,6 +1945,9 @@ skill-mobile-mt/
|
|
|
1527
1945
|
├── platform-excellence.md ← 🟡 iOS 18+ vs Android 15+ guidelines
|
|
1528
1946
|
├── version-management.md ← 🟡 SDK compatibility matrix
|
|
1529
1947
|
├── observability.md ← 🟡 Sessions as 4th pillar
|
|
1948
|
+
├── offline-first.md ← 🟢 Local-first + sync patterns
|
|
1949
|
+
├── storage-patterns.md ← 🟡 MMKV / SecureStore / SQLite / WatermelonDB / Keychain
|
|
1950
|
+
├── i18n-localization.md ← 🟡 i18next / slang / .xcstrings / strings.xml / RTL
|
|
1530
1951
|
│
|
|
1531
|
-
└──
|
|
1952
|
+
└── debugging-intelligence.md ← 🟡 30+ error patterns + search strategies + issue investigation
|
|
1532
1953
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buivietphi/skill-mobile-mt",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Master Senior Mobile Engineer skill for AI agents. Pre-built patterns from 30+ production repos. React Native, Flutter, iOS, Android. Supports Claude, Cline, Cursor, Windsurf, Copilot, Codex, Gemini, Kimi, Kilo Code, Kiro, Antigravity.",
|
|
5
5
|
"author": "buivietphi",
|
|
6
6
|
"license": "MIT",
|