@buivietphi/skill-mobile-mt 1.2.0 → 1.4.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.

Potentially problematic release.


This version of @buivietphi/skill-mobile-mt might be problematic. Click here for more details.

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: "1.2.0"
4
+ version: "1.4.0"
5
5
  author: buivietphi
6
6
  priority: high
7
7
  user-invocable: true
@@ -48,9 +48,12 @@ allowed-tools:
48
48
  10. [Quality Gate](#quality-gate)
49
49
  11. [Build & Deploy Gates](#build--deploy-gates)
50
50
  12. [Smart Loading](#smart-loading)
51
- 13. [Hard Bans](#hard-bans)
52
- 14. [Mobile Anti-Patterns](#mobile-anti-patterns)
53
- 15. [Reference Files](#reference-files)
51
+ 13. [Grounding Protocol (Anti-Hallucination)](#grounding-protocol-anti-hallucination)
52
+ 14. [Docs-First Protocol (Always Use Latest)](#docs-first-protocol-always-use-latest)
53
+ 15. [Security Protocol](#security-protocol)
54
+ 16. [Hard Bans](#hard-bans)
55
+ 17. [Mobile Anti-Patterns](#mobile-anti-patterns)
56
+ 18. [Reference Files](#reference-files)
54
57
 
55
58
  ---
56
59
 
@@ -101,8 +104,12 @@ USER REQUEST → ACTION (Read tool required)
101
104
  Read: shared/anti-patterns.md
102
105
  then: scan for all violations
103
106
 
104
- "Add package/library" → Read: shared/version-management.md
105
- then: check SDK compat FIRST suggest version
107
+ "Add package/library" → Docs-First Protocol (below) + Read: shared/version-management.md
108
+ then: WebSearch official docs → check SDK compat → install
109
+
110
+ "Setup/configure X library" → Docs-First Protocol (below)
111
+ then: WebSearch "[library] [version] setup guide [year]"
112
+ then: follow official docs, NOT memory
106
113
 
107
114
  "Platform UI / guidelines" → Read: shared/platform-excellence.md
108
115
  then: apply iOS 18+ vs Android 15+ native patterns
@@ -119,6 +126,13 @@ USER REQUEST → ACTION (Read tool required)
119
126
 
120
127
  "Build error / runtime crash" → Read: shared/error-recovery.md
121
128
  then: apply matching fix pattern
129
+
130
+ "Offline / cache / sync" → Read: shared/offline-first.md
131
+ then: implement local-first architecture
132
+
133
+ "On-device AI / ML / inference" → Read: shared/on-device-ai.md
134
+ then: choose Core ML / TFLite / llama.cpp per platform
135
+
122
136
  ```
123
137
 
124
138
  **⛔ NEVER start coding without identifying the task type first.**
@@ -728,6 +742,322 @@ FOR UI CHANGES:
728
742
 
729
743
  ---
730
744
 
745
+ ## Grounding Protocol (Anti-Hallucination)
746
+
747
+ **Every answer MUST be grounded in verifiable sources. NEVER answer from "memory" or "intuition".**
748
+
749
+ ### Source Hierarchy (use in order)
750
+
751
+ ```
752
+ PRIORITY 1: PROJECT CODE (highest trust)
753
+ → Read the actual file → cite file:line
754
+ → "Based on src/services/authService.ts:42, your project uses axios with interceptor"
755
+
756
+ PRIORITY 2: SKILL REFERENCE FILES
757
+ → Read shared/*.md or platform/*.md → cite which file
758
+ → "Per react-native/react-native.md, use FlatList instead of ScrollView for lists"
759
+
760
+ PRIORITY 3: OFFICIAL DOCS (via WebSearch)
761
+ → Search official docs → cite URL
762
+ → "Per React Native docs: https://reactnative.dev/docs/flatlist"
763
+
764
+ PRIORITY 4: PRODUCTION REPOS (from architecture-intelligence.md)
765
+ → Cite which repo the pattern comes from
766
+ → "Ignite (19.7k stars) uses this folder structure for features"
767
+
768
+ ⛔ PRIORITY 5: AI GENERAL KNOWLEDGE (lowest trust — AVOID)
769
+ → Only when Priorities 1-4 return nothing
770
+ → MUST prefix with: "⚠️ Not verified from your project or docs:"
771
+ → MUST add: "Verify this before using in production"
772
+ ```
773
+
774
+ ### Mandatory Rules
775
+
776
+ ```
777
+ RULE 1: READ BEFORE ANSWER
778
+ ⛔ NEVER suggest code changes to a file you haven't Read
779
+ ⛔ NEVER reference a function/class without verifying it exists
780
+ ✅ ALWAYS: Read file → find the code → then suggest fix
781
+
782
+ RULE 2: VERIFY APIs AND LIBRARIES EXIST
783
+ ⛔ NEVER suggest an import without verifying the package is installed
784
+ ⛔ NEVER use a function name without checking it exists in the codebase
785
+ ✅ Check package.json/pubspec.yaml FIRST → then suggest usage
786
+ ✅ Grep for the function → confirm it exists → then reference it
787
+
788
+ RULE 3: CITE YOUR SOURCE
789
+ Every code suggestion MUST cite where it came from:
790
+ - "Cloned from src/features/product/productService.ts" (project code)
791
+ - "Pattern from shared/architecture-intelligence.md" (skill file)
792
+ - "Per React Navigation v6 docs" (official docs)
793
+ ⛔ If you can't cite a source → say "I need to verify this first"
794
+
795
+ RULE 4: SAY "I DON'T KNOW" WHEN YOU DON'T KNOW
796
+ ✅ "I'm not sure about this API. Let me check the docs."
797
+ ✅ "I need to read your codebase to answer this correctly."
798
+ ✅ "This might work but I haven't verified — let me check."
799
+ ⛔ NEVER confidently state something you haven't verified
800
+ ⛔ NEVER invent function signatures, API endpoints, or library names
801
+
802
+ RULE 5: VERSION-SPECIFIC ANSWERS
803
+ ⛔ NEVER suggest code for "React Native" without knowing the version
804
+ ⛔ NEVER assume latest version — check package.json first
805
+ ✅ "Your project uses RN 0.73, so the correct API is..."
806
+ ✅ "Expo SDK 51 uses expo-router v3, here's the correct import..."
807
+
808
+ RULE 6: NO PHANTOM PACKAGES
809
+ Before suggesting ANY npm/pub/pod package:
810
+ ✅ Verify it exists: check package.json or search npm/pub
811
+ ✅ Verify it's compatible: check version against project SDK
812
+ ⛔ NEVER suggest a package name from memory without verification
813
+ ⛔ NEVER mix up similar packages (e.g., @react-navigation vs react-navigation)
814
+ ```
815
+
816
+ ### When Fixing Bugs
817
+
818
+ ```
819
+ GROUNDED BUG FIX PROTOCOL:
820
+
821
+ 1. READ the file with the bug (don't guess from error message alone)
822
+ 2. FIND the exact line causing the issue
823
+ 3. UNDERSTAND the data flow (what calls this? what does it return?)
824
+ 4. VERIFY the fix works with the actual types/interfaces in the project
825
+ 5. CHECK side effects (grep for other files using this function)
826
+ 6. CITE: "Fix in [file]:[line] — [root cause] — [why fix works]"
827
+
828
+ ⛔ NEVER:
829
+ - "The error is probably because..." (guess without reading code)
830
+ - "Try changing X to Y" (without reading the file first)
831
+ - "This should fix it" (without verifying types match)
832
+ ```
833
+
834
+ ### Anti-Hallucination Checklist (run before EVERY response)
835
+
836
+ ```
837
+ Before responding, verify:
838
+ □ Did I READ the relevant files? (not just guess from file names)
839
+ □ Are all function/class names I mentioned REAL? (verified via Grep/Read)
840
+ □ Are all package names I mentioned INSTALLED? (checked package.json)
841
+ □ Are my API suggestions compatible with the project's SDK version?
842
+ □ Did I cite where my solution comes from?
843
+ □ If I'm unsure about something, did I flag it?
844
+
845
+ If ANY checkbox fails → go back and verify before responding.
846
+ ```
847
+
848
+ ---
849
+
850
+ ## Docs-First Protocol (Always Use Latest)
851
+
852
+ **When setting up, installing, or configuring ANY library/SDK/tool — ALWAYS search official docs FIRST.**
853
+
854
+ ### When This Triggers
855
+
856
+ ```
857
+ TRIGGERS:
858
+ - "Install X" / "Add X package" / "Setup X"
859
+ - "Configure X" / "Integrate X"
860
+ - "How to use X" / "What's the API for X"
861
+ - "Upgrade from X to Y"
862
+ - ANY new library, framework feature, or SDK API
863
+
864
+ ⛔ DO NOT answer from memory. Docs change. APIs change. Syntax changes.
865
+ ```
866
+
867
+ ### Docs-First Protocol
868
+
869
+ ```
870
+ STEP 1: CHECK PROJECT VERSION
871
+ Read package.json / pubspec.yaml → get exact version of:
872
+ - Framework (react-native, expo, flutter)
873
+ - Target library (if already installed)
874
+ - Related dependencies
875
+
876
+ STEP 2: SEARCH OFFICIAL DOCS (WebSearch)
877
+ Search: "[library name] [version] official documentation [current year]"
878
+ Examples:
879
+ - "react-navigation v7 installation guide 2026"
880
+ - "expo-camera SDK 52 setup documentation"
881
+ - "riverpod 2.0 getting started flutter"
882
+
883
+ ✅ ALWAYS search with the CURRENT YEAR to get latest docs
884
+ ⛔ NEVER rely on training data — it may be outdated
885
+
886
+ STEP 3: VERIFY API / SYNTAX
887
+ From the docs, confirm:
888
+ - Import path (packages rename, move, split)
889
+ - Function signatures (params change between versions)
890
+ - Configuration format (config files change)
891
+ - Peer dependencies (new requirements)
892
+ - Breaking changes (v6 → v7 migration)
893
+
894
+ STEP 4: APPLY WITH CITATION
895
+ "Per [library] v[X] docs ([URL]):
896
+ import { X } from '[correct-package]';"
897
+
898
+ ⛔ If docs not found → say "I couldn't find current docs, let me try..."
899
+ ⛔ If conflicting info → use the OFFICIAL source, not blog posts
900
+ ```
901
+
902
+ ### Common Outdated Patterns (AI memory traps)
903
+
904
+ ```
905
+ ⛔ AI OFTEN GETS WRONG:
906
+ - React Navigation: v5 syntax vs v6 vs v7 (changed significantly)
907
+ - Expo Router: file-based routing changed between SDK versions
908
+ - Firebase: modular v9+ syntax vs old v8 namespaced syntax
909
+ - Swift: async/await vs completion handlers (iOS 15+ only)
910
+ - Jetpack Compose: API surface changes rapidly between versions
911
+ - React Native: New Architecture (Fabric/TurboModules) vs Bridge
912
+
913
+ ✅ ALWAYS WebSearch for the exact version in the project:
914
+ "react-navigation v7 createStackNavigator" ← correct for v7
915
+ NOT "react-navigation createStackNavigator" ← could return v4/v5 syntax
916
+ ```
917
+
918
+ ### Package Installation Protocol
919
+
920
+ ```
921
+ BEFORE running npm install / flutter pub add / pod install:
922
+
923
+ 1. CHECK if the package exists:
924
+ → WebSearch "[package name] npm" or "[package name] pub.dev"
925
+ → Verify it's maintained (last publish date)
926
+ → Verify it's compatible with project SDK version
927
+
928
+ 2. CHECK the correct install command:
929
+ → WebSearch "[package name] installation [framework version]"
930
+ → Some packages need peer dependencies
931
+ → Some packages need native setup (pod install, gradle sync)
932
+ → Expo packages: use "npx expo install" NOT "npm install"
933
+
934
+ 3. CHECK for breaking changes:
935
+ → If upgrading: WebSearch "[package name] migration guide v[old] to v[new]"
936
+ → Read CHANGELOG for breaking changes
937
+ → Check if config format changed
938
+
939
+ 4. AFTER install:
940
+ → Verify import works (no red squiggles)
941
+ → Run build to check native linking
942
+ → Test on BOTH platforms (iOS + Android)
943
+
944
+ ⛔ NEVER:
945
+ - "npm install [package]" without checking version compatibility
946
+ - Copy import from memory (import paths change between versions)
947
+ - Assume the API is the same as 6 months ago
948
+ - Skip native setup steps (pod install, gradle sync)
949
+ ```
950
+
951
+ ---
952
+
953
+ ## Security Protocol
954
+
955
+ **Security is NOT optional. Every feature MUST pass security checks before completion.**
956
+
957
+ ### Security Scan (run on EVERY feature)
958
+
959
+ ```
960
+ BEFORE marking any feature as done, scan for:
961
+
962
+ 1. 🔴 SECRETS & CREDENTIALS
963
+ □ No hardcoded API keys, tokens, passwords, or secrets
964
+ □ No secrets in source code, comments, or config files
965
+ □ .env files in .gitignore (NEVER committed)
966
+ □ API keys loaded from environment variables or secure config
967
+
968
+ 2. 🔴 TOKEN & AUTH STORAGE
969
+ □ Auth tokens → SecureStore (Expo) / Keychain (iOS) / EncryptedSharedPreferences (Android)
970
+ □ ⛔ NEVER AsyncStorage / SharedPreferences / UserDefaults for tokens
971
+ □ ⛔ NEVER localStorage / sessionStorage for tokens
972
+ □ Refresh tokens stored separately from access tokens
973
+ □ Token cleared on logout (all storage locations)
974
+
975
+ 3. 🔴 INPUT VALIDATION
976
+ □ User input sanitized before display (prevent XSS)
977
+ □ User input validated before API calls (prevent injection)
978
+ □ Deep link parameters validated before navigation
979
+ □ File uploads: validate type, size, content (not just extension)
980
+ □ Search/filter inputs: debounced + length-limited
981
+
982
+ 4. 🔴 NETWORK SECURITY
983
+ □ All API calls over HTTPS (never HTTP)
984
+ □ Certificate pinning for sensitive endpoints (banking, health)
985
+ □ API responses validated (don't trust server blindly)
986
+ □ Timeout on all network requests (prevent hanging)
987
+ □ No sensitive data in URL query parameters (use POST body)
988
+
989
+ 5. 🟠 DATA PROTECTION
990
+ □ PII (name, email, phone, location) never in logs
991
+ □ PII never in analytics events without anonymization
992
+ □ Crash reports don't contain user data
993
+ □ Cache/temp files cleared on logout
994
+ □ Clipboard cleared after paste of sensitive data
995
+
996
+ 6. 🟠 AUTHENTICATION FLOW
997
+ □ Login: rate-limited (prevent brute force)
998
+ □ 401 response → auto-refresh token OR logout
999
+ □ Session timeout after inactivity
1000
+ □ Biometric auth: use system APIs (Face ID / fingerprint)
1001
+ □ OAuth: validate redirect URI, use PKCE
1002
+
1003
+ 7. 🟡 PLATFORM-SPECIFIC
1004
+ iOS:
1005
+ □ App Transport Security (ATS) enabled
1006
+ □ Keychain access groups configured correctly
1007
+ □ Privacy manifest (PrivacyInfo.xcprivacy) for required APIs
1008
+ □ NSCameraUsageDescription / NSLocationUsageDescription set
1009
+
1010
+ Android:
1011
+ □ android:usesCleartextTraffic="false" in manifest
1012
+ □ ProGuard/R8 rules for obfuscation in release
1013
+ □ Exported activities/receivers properly restricted
1014
+ □ Backup rules exclude sensitive data (android:allowBackup)
1015
+ ```
1016
+
1017
+ ### Security Non-Negotiables (NEVER bypass)
1018
+
1019
+ ```
1020
+ ⛔ ABSOLUTE RULES — no exceptions, no workarounds:
1021
+
1022
+ 1. NEVER store tokens in plain storage
1023
+ AsyncStorage / SharedPreferences / UserDefaults = ❌ CRITICAL
1024
+ SecureStore / Keychain / EncryptedSharedPreferences = ✅ ONLY
1025
+
1026
+ 2. NEVER hardcode secrets
1027
+ const API_KEY = "sk-..." = ❌ CRITICAL
1028
+ process.env.API_KEY / Config.API_KEY = ✅ ONLY
1029
+
1030
+ 3. NEVER log sensitive data
1031
+ console.log(user.password) = ❌ CRITICAL
1032
+ console.log("Login attempt for user:", user.id) = ✅ OK (ID only)
1033
+
1034
+ 4. NEVER trust deep links
1035
+ navigation.navigate(params.screen) = ❌ CRITICAL (arbitrary navigation)
1036
+ if (ALLOWED_SCREENS.includes(params.screen)) navigate(params.screen) = ✅
1037
+
1038
+ 5. NEVER disable SSL verification
1039
+ rejectUnauthorized: false = ❌ CRITICAL
1040
+ Proper certificate handling = ✅ ONLY
1041
+
1042
+ 6. NEVER commit .env files
1043
+ .env in git = ❌ CRITICAL
1044
+ .env in .gitignore + .env.example committed = ✅
1045
+ ```
1046
+
1047
+ ### When User Asks to "Skip Security" or "Do It Quick"
1048
+
1049
+ ```
1050
+ ✅ Response: "I'll implement it correctly AND quickly. Security doesn't slow down development — it prevents emergency patches later."
1051
+
1052
+ ⛔ NEVER skip security checks because:
1053
+ - "It's just a prototype" → Prototypes become production
1054
+ - "We'll fix it later" → Technical debt compounds
1055
+ - "It's internal only" → Internal apps get attacked too
1056
+ - "Just hardcode it for now" → Secrets leak to git history permanently
1057
+ ```
1058
+
1059
+ ---
1060
+
731
1061
  ## Hard Bans
732
1062
 
733
1063
  **❌ These will CRASH, LEAK, or get REJECTED from app stores:**
@@ -1035,9 +1365,14 @@ skill-mobile-mt/
1035
1365
  ├── ios/ios-native.md ← iOS Swift MVVM + Clean Architecture
1036
1366
  ├── android/android-native.md ← Android Kotlin + Clean Architecture
1037
1367
  └── shared/
1368
+
1369
+ ├── ── CORE (always load) ────────────────────────────────
1038
1370
  ├── code-review.md ← 🔴 Senior review checklist
1039
1371
  ├── bug-detection.md ← 🔴 Auto bug scanner
1040
- ├── prompt-engineering.md ← 🟡 Auto-think templates
1372
+ ├── prompt-engineering.md ← 🔴 Auto-think templates
1373
+
1374
+ ├── ── ON-DEMAND (load by task) ──────────────────────────
1375
+ ├── architecture-intelligence.md ← 🟡 Patterns from 30+ production repos
1041
1376
  ├── release-checklist.md ← 🟡 Before shipping to app store
1042
1377
  ├── common-pitfalls.md ← 🟡 Problem → Symptoms → Solution
1043
1378
  ├── error-recovery.md ← 🟡 Fix build/runtime errors
@@ -1046,5 +1381,7 @@ skill-mobile-mt/
1046
1381
  ├── performance-prediction.md ← 🟡 Predict FPS/memory BEFORE shipping
1047
1382
  ├── platform-excellence.md ← 🟡 iOS 18+ vs Android 15+ guidelines
1048
1383
  ├── version-management.md ← 🟡 SDK compatibility matrix
1049
- └── observability.md ← 🟡 Sessions as 4th pillar
1384
+ ├── observability.md ← 🟡 Sessions as 4th pillar
1385
+
1386
+ └── offline-first.md ← 🟢 Local-first + sync patterns
1050
1387
  ```
@@ -192,6 +192,54 @@ dependencies {
192
192
  }
193
193
  ```
194
194
 
195
+ ## Compose Performance Optimization
196
+
197
+ ```kotlin
198
+ // @Stable / @Immutable — tell Compose when to skip recomposition
199
+ // Use when your class isn't a data class but values never change
200
+ @Stable
201
+ class UserState(val id: String, val name: String)
202
+
203
+ @Immutable
204
+ data class ProductUiModel(val id: String, val price: Double)
205
+
206
+ // derivedStateOf — compute derived state only when inputs change
207
+ // Prevents recomposition on every scroll position change
208
+ val showFab by remember {
209
+ derivedStateOf { listState.firstVisibleItemIndex > 0 }
210
+ }
211
+
212
+ // key() in LazyColumn — stable identity prevents full recomposition
213
+ LazyColumn {
214
+ items(products, key = { it.id }) { product ->
215
+ ProductCard(product) // Only recomposes if THIS product changes
216
+ }
217
+ }
218
+
219
+ // Stateless components — pass data + callbacks, not ViewModel
220
+ @Composable
221
+ fun ProductCard(
222
+ product: Product, // data only
223
+ onClick: () -> Unit, // callback only
224
+ ) { /* no ViewModel here */ }
225
+ ```
226
+
227
+ ## Baseline Profiles (Startup Optimization)
228
+
229
+ ```kotlin
230
+ // app/src/main/baseline-prof.txt (generated by Macrobenchmark)
231
+ // Speeds up cold start 20-30% by AOT-compiling hot code paths
232
+
233
+ // build.gradle.kts
234
+ dependencies {
235
+ implementation("androidx.profileinstaller:profileinstaller:1.3.1")
236
+ }
237
+
238
+ // Generate with Macrobenchmark:
239
+ // ./gradlew :app:generateBaselineProfile
240
+ // Commit the generated baseline-prof.txt
241
+ ```
242
+
195
243
  ## Common Pitfalls
196
244
 
197
245
  | Pitfall | Fix |
@@ -201,6 +249,8 @@ dependencies {
201
249
  | Context leak | `@ApplicationContext`, never Activity |
202
250
  | Missing ProGuard | Test release builds |
203
251
  | Main thread blocking | `Dispatchers.IO` |
252
+ | Unstable lambdas in Compose | `remember { {} }` or move to ViewModel |
253
+ | List without keys | `items(list, key = { it.id })` |
204
254
 
205
255
  ---
206
256