@buivietphi/skill-mobile-mt 2.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.
@@ -0,0 +1,343 @@
1
+ # Agent Rules Template — All Agents
2
+
3
+ > Each AI agent reads a specific project-level file automatically every session.
4
+ > Copy the relevant section below to your project root.
5
+
6
+ ---
7
+
8
+ ## Quick Reference
9
+
10
+ | Agent | File to create | Location |
11
+ |-------|---------------|----------|
12
+ | **Claude Code** | `CLAUDE.md` | Project root |
13
+ | **Cursor** | `.cursorrules` | Project root |
14
+ | **Windsurf** | `.windsurfrules` | Project root |
15
+ | **GitHub Copilot** | `.github/copilot-instructions.md` | `.github/` folder |
16
+ | **Codex (OpenAI)** | `AGENTS.md` | Project root |
17
+ | **Gemini CLI** | `GEMINI.md` | Project root |
18
+ | **Kimi** | No auto-load file — paste rules as context | — |
19
+ | **Antigravity** | Configured in Antigravity YAML `context.rules` | Agent config |
20
+
21
+ ---
22
+
23
+ ## Claude Code → `CLAUDE.md`
24
+
25
+ ```markdown
26
+ # Project: [Your App Name]
27
+
28
+ ## Stack
29
+ - Framework: [React Native CLI / Expo SDK XX / Flutter X.X / iOS / Android]
30
+ - Language: [TypeScript / JavaScript / Dart / Swift / Kotlin]
31
+ - State: [Redux Toolkit / Zustand / Riverpod / BLoC / StateFlow]
32
+ - Navigation: [React Navigation v6 / Expo Router / GoRouter / UIKit / Jetpack]
33
+ - API: [axios / fetch / Dio / Firebase / GraphQL]
34
+ - Package Manager: [yarn / npm / pnpm / bun / flutter pub]
35
+
36
+ ## Auto-Check Rules (apply after EVERY code change)
37
+
38
+ Before saying "done", verify:
39
+ - No console.log / print / NSLog in production code
40
+ - No hardcoded secrets or API keys
41
+ - All async operations wrapped in try/catch
42
+ - All 4 states handled: loading / error / empty / success
43
+ - useEffect / dispose / viewModelScope has cleanup
44
+ - FlatList (not ScrollView) for lists > 20 items
45
+ - No force unwrap (! / !! / as!) without null check
46
+ - TypeScript: no implicit 'any'
47
+ - New screens registered in navigator
48
+
49
+ If ANY check fails → fix it before marking done.
50
+
51
+ ## What NOT to do
52
+ - NEVER suggest migrating to a different framework
53
+ - NEVER change state management library
54
+ - NEVER add packages without checking SDK compatibility
55
+ - NEVER mix package managers (yarn + npm)
56
+ ```
57
+
58
+ ---
59
+
60
+ ## Cursor → `.cursorrules`
61
+
62
+ ```
63
+ # [Your App Name] — Cursor Rules
64
+
65
+ ## Project
66
+ - Framework: [React Native CLI / Expo SDK XX / Flutter X.X / iOS / Android]
67
+ - Language: [TypeScript / Dart / Swift / Kotlin]
68
+ - State: [Redux Toolkit / Zustand / Riverpod / BLoC]
69
+ - Package Manager: [yarn / npm / bun / flutter pub]
70
+
71
+ ## Code Style
72
+ - PascalCase for screens and components
73
+ - camelCase for hooks, services, utils
74
+ - Absolute imports with @/ alias (if configured)
75
+
76
+ ## Auto-Check (before every completion)
77
+ - No console.log in production code
78
+ - No hardcoded secrets or API keys
79
+ - All async wrapped in try/catch
80
+ - All 4 states: loading / error / empty / success
81
+ - useEffect has cleanup (return () => ...)
82
+ - FlatList (not ScrollView) for dynamic lists
83
+ - No implicit 'any' in TypeScript
84
+
85
+ ## Never
86
+ - Change framework or architecture
87
+ - Change state management library
88
+ - Add packages without checking SDK compatibility
89
+ - Mix package managers
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Windsurf → `.windsurfrules`
95
+
96
+ ```
97
+ # [Your App Name] — Windsurf Rules
98
+
99
+ Project: [Your App Name]
100
+ Framework: [React Native CLI / Expo / Flutter / iOS / Android]
101
+ Language: [TypeScript / Dart / Swift / Kotlin]
102
+ State management: [Redux Toolkit / Zustand / Riverpod / BLoC]
103
+ Package manager: [yarn / npm / bun / flutter pub]
104
+
105
+ ## Coding Rules
106
+
107
+ Always:
108
+ - Wrap all async operations in try/catch
109
+ - Handle all 4 states: loading, error, empty, success
110
+ - Add cleanup to useEffect (return () => ...)
111
+ - Use FlatList for dynamic lists (not ScrollView)
112
+ - Use PascalCase for components and screens
113
+ - Use camelCase for hooks, services, and utilities
114
+ - No implicit 'any' in TypeScript
115
+
116
+ Never:
117
+ - Leave console.log in production code
118
+ - Hardcode secrets, tokens, or API keys
119
+ - Store tokens in AsyncStorage / SharedPreferences / UserDefaults
120
+ - Change the framework or architecture
121
+ - Add packages without verifying SDK compatibility
122
+ - Mix yarn and npm
123
+
124
+ ## Security (non-negotiable)
125
+ - Tokens → SecureStore / Keychain / EncryptedSharedPreferences
126
+ - API calls → HTTPS only
127
+ - Sensitive data → never in logs
128
+ - User input → sanitize before display
129
+ ```
130
+
131
+ ---
132
+
133
+ ## GitHub Copilot → `.github/copilot-instructions.md`
134
+
135
+ ```markdown
136
+ # Copilot Instructions — [Your App Name]
137
+
138
+ ## Project Context
139
+ - **Framework:** [React Native CLI / Expo SDK XX / Flutter X.X / iOS / Android]
140
+ - **Language:** [TypeScript / JavaScript / Dart / Swift / Kotlin]
141
+ - **State Management:** [Redux Toolkit / Zustand / Riverpod / BLoC]
142
+ - **Package Manager:** [yarn / npm / bun / flutter pub]
143
+
144
+ ## Conventions
145
+ - PascalCase: components, screens, classes
146
+ - camelCase: hooks, services, utilities, variables
147
+ - Files named same as their default export
148
+
149
+ ## Required Patterns
150
+
151
+ ### Every async function
152
+ ```typescript
153
+ try {
154
+ setLoading(true);
155
+ const result = await apiCall();
156
+ setData(result);
157
+ } catch (error) {
158
+ setError(error.message);
159
+ } finally {
160
+ setLoading(false);
161
+ }
162
+ ```
163
+
164
+ ### Every screen must handle 4 states
165
+ ```typescript
166
+ if (loading) return <LoadingScreen />;
167
+ if (error) return <ErrorScreen error={error} />;
168
+ if (!data?.length) return <EmptyScreen />;
169
+ return <DataScreen data={data} />;
170
+ ```
171
+
172
+ ### Every useEffect with subscriptions
173
+ ```typescript
174
+ useEffect(() => {
175
+ const sub = subscribe();
176
+ return () => sub.unsubscribe(); // REQUIRED
177
+ }, []);
178
+ ```
179
+
180
+ ## Rules
181
+ - No console.log in production
182
+ - No hardcoded secrets or API keys
183
+ - FlatList (not ScrollView) for dynamic lists
184
+ - Tokens in SecureStore / Keychain only
185
+ - No force unwrap without null check
186
+ - No implicit 'any' in TypeScript
187
+ ```
188
+
189
+ ---
190
+
191
+ ## Codex (OpenAI) → `AGENTS.md` (project root)
192
+
193
+ ```markdown
194
+ # [Your App Name] — Agent Rules
195
+
196
+ ## Project
197
+ - Framework: [React Native / Expo / Flutter / iOS / Android]
198
+ - Language: [TypeScript / Dart / Swift / Kotlin]
199
+ - State: [Redux Toolkit / Zustand / Riverpod / BLoC]
200
+ - Package Manager: [yarn / npm / bun / flutter pub]
201
+
202
+ ## Rules for All Tasks
203
+
204
+ ### Always
205
+ - Wrap async in try/catch
206
+ - Handle: loading / error / empty / success states
207
+ - Cleanup useEffect (return unsubscribe/cancel)
208
+ - Use FlatList for dynamic lists
209
+ - PascalCase components, camelCase hooks/services
210
+
211
+ ### Never
212
+ - console.log in production
213
+ - Hardcode secrets or API keys
214
+ - Store tokens in AsyncStorage (use SecureStore/Keychain)
215
+ - Suggest changing framework or state management
216
+ - Add packages without verifying SDK compatibility
217
+ - Mix yarn and npm
218
+
219
+ ### Security
220
+ - Tokens → SecureStore (RN) / Keychain (iOS) / EncryptedSharedPreferences (Android)
221
+ - API → HTTPS only
222
+ - Logs → never include sensitive data
223
+ - Input → sanitize before display
224
+
225
+ ## Architecture
226
+ [FILL IN: describe your feature structure]
227
+ Example: feature-based (src/features/auth/, src/features/home/)
228
+
229
+ ## Preferred Commands
230
+ - Install: [yarn install / npm install / flutter pub get]
231
+ - Run: [yarn ios / yarn android / flutter run]
232
+ - Test: [yarn test / flutter test]
233
+ ```
234
+
235
+ ---
236
+
237
+ ## Gemini CLI → `GEMINI.md`
238
+
239
+ ```markdown
240
+ # [Your App Name] — Gemini Rules
241
+
242
+ ## Project Stack
243
+ - Framework: [React Native / Expo / Flutter / iOS / Android]
244
+ - Language: [TypeScript / Dart / Swift / Kotlin]
245
+ - State: [Redux Toolkit / Zustand / Riverpod / BLoC]
246
+ - Package Manager: [yarn / npm / bun / flutter pub]
247
+
248
+ ## Code Quality Rules
249
+
250
+ Apply before every completion:
251
+
252
+ 1. No console.log / print / NSLog in production
253
+ 2. No hardcoded API keys, tokens, or secrets
254
+ 3. All async wrapped in try/catch with proper error handling
255
+ 4. All 4 states implemented: loading / error / empty / success
256
+ 5. useEffect cleanup present when using subscriptions or timers
257
+ 6. FlatList used for lists (not ScrollView with map)
258
+ 7. TypeScript: no implicit 'any'
259
+ 8. New screens registered in the navigator
260
+
261
+ ## Security Rules
262
+ - Token storage: SecureStore / Keychain / EncryptedSharedPreferences ONLY
263
+ - API calls: HTTPS only
264
+ - Logs: no sensitive data
265
+ - User input: sanitize before rendering
266
+
267
+ ## Constraints
268
+ - Do not change framework or architecture
269
+ - Do not change state management library
270
+ - Do not add packages without checking SDK compatibility
271
+ - Do not mix package managers
272
+ ```
273
+
274
+ ---
275
+
276
+ ## Kimi — No Auto-Load
277
+
278
+ Kimi does not read a project file automatically. Options:
279
+
280
+ **Option 1 — Paste at start of conversation:**
281
+ ```
282
+ Project rules:
283
+ - Framework: [React Native / Flutter / iOS / Android]
284
+ - No console.log in production
285
+ - All async in try/catch
286
+ - All 4 states: loading/error/empty/success
287
+ - Tokens in SecureStore/Keychain only
288
+ - No implicit 'any' in TypeScript
289
+ - Do not change framework or state management
290
+ ```
291
+
292
+ **Option 2 — Use skill-mobile-mt:**
293
+ Load SKILL.md as context at the start of the Kimi conversation.
294
+
295
+ ---
296
+
297
+ ## Antigravity — YAML Config
298
+
299
+ Add to your Antigravity configuration:
300
+
301
+ ```yaml
302
+ skill:
303
+ name: skill-mobile-mt
304
+ version: "1.0.0"
305
+
306
+ context:
307
+ rules:
308
+ - No console.log / print / NSLog in production code
309
+ - No hardcoded secrets or API keys
310
+ - Tokens in SecureStore / Keychain / EncryptedSharedPreferences ONLY
311
+ - All async wrapped in try/catch
312
+ - All 4 states handled: loading / error / empty / success
313
+ - useEffect / dispose / viewModelScope has cleanup
314
+ - FlatList (not ScrollView) for dynamic lists
315
+ - No implicit 'any' in TypeScript
316
+
317
+ project:
318
+ framework: "[react-native / flutter / ios / android]"
319
+ language: "[typescript / dart / swift / kotlin]"
320
+ state_management: "[redux / zustand / riverpod / bloc]"
321
+ package_manager: "[yarn / npm / bun / flutter-pub]"
322
+
323
+ constraints:
324
+ - NEVER suggest migrating to a different framework
325
+ - NEVER change state management library
326
+ - NEVER add packages without checking SDK compatibility
327
+ - NEVER mix package managers
328
+ ```
329
+
330
+ ---
331
+
332
+ ## Summary
333
+
334
+ | Agent | Auto-loaded? | File |
335
+ |-------|-------------|------|
336
+ | Claude Code | YES — every session | `CLAUDE.md` |
337
+ | Cursor | YES — every chat | `.cursorrules` |
338
+ | Windsurf | YES — every session | `.windsurfrules` |
339
+ | GitHub Copilot | YES — workspace context | `.github/copilot-instructions.md` |
340
+ | Codex | YES — when AGENTS.md exists | `AGENTS.md` |
341
+ | Gemini CLI | YES — when GEMINI.md exists | `GEMINI.md` |
342
+ | Kimi | NO — paste manually | (none) |
343
+ | Antigravity | YES — via YAML config | Antigravity config |
@@ -0,0 +1,237 @@
1
+ # AI-DLC Workflow — Mobile Development
2
+
3
+ > AI-Driven Development Lifecycle adapted for mobile projects.
4
+ > Based on AWS AI-DLC methodology. Use for complex features (3+ screens/units).
5
+
6
+ ---
7
+
8
+ ## When to Activate
9
+
10
+ | Task | AI-DLC? |
11
+ |------|---------|
12
+ | Bug fix, single-file change | No — direct fix |
13
+ | Add 1 screen, minor feature | No — Feature Scaffold in SKILL.md |
14
+ | Multi-screen feature (auth, checkout, onboarding) | **Yes** |
15
+ | New project setup / architecture decision | **Yes** |
16
+ | Major refactor across multiple files | **Yes** |
17
+ | Performance optimization (app-wide) | **Yes** |
18
+
19
+ **Rule:** If task requires 3+ units of work → use AI-DLC. Otherwise → use normal flow.
20
+
21
+ ---
22
+
23
+ ## Phase 1: Elaboration
24
+
25
+ **Goal:** Decompose task before writing any code.
26
+
27
+ ### Step 1 — Define Intent
28
+
29
+ ```
30
+ Intent: [One sentence describing the goal]
31
+ Example: "Auth feature — login, register, forgot password with biometric"
32
+ ```
33
+
34
+ ### Step 2 — Decompose into Units
35
+
36
+ Each Unit = 1 deliverable piece (screen, service, config).
37
+
38
+ ```
39
+ Units:
40
+ 1. [Screen/Component/Service name] — [what it does]
41
+ 2. [Screen/Component/Service name] — [what it does]
42
+ ...
43
+
44
+ Example:
45
+ 1. Login screen — email/password form + validation + API call
46
+ 2. Register screen — form + password rules + terms checkbox
47
+ 3. Forgot password flow — email input → OTP verify → new password
48
+ 4. Token storage — SecureStore (RN) / Keychain (iOS) / EncryptedSharedPrefs (Android)
49
+ 5. Auth state manager — global auth state + auto-refresh
50
+ 6. Navigation guard — redirect unauthenticated users to login
51
+ ```
52
+
53
+ ### Step 3 — Select Operating Mode
54
+
55
+ | Mode | When | Human role |
56
+ |------|------|-----------|
57
+ | **HITL** | New team, unfamiliar codebase, critical feature | Approve each Unit before next |
58
+ | **OHOTL** | Familiar codebase, trusted patterns | Monitor, intervene if needed |
59
+ | **AHOTL** | Well-defined scope, strong test coverage | Review at end |
60
+
61
+ **Default for mobile:** HITL (present each Unit for approval).
62
+
63
+ ### Step 4 — Present Plan to User
64
+
65
+ Before coding, show:
66
+ ```
67
+ Intent: Auth feature
68
+ Units: 6 (listed above)
69
+ Mode: HITL
70
+ Estimated: [X files new, Y files modified]
71
+ Platform: [detected framework]
72
+
73
+ Proceed? (yes / adjust units / change mode)
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Phase 2: Construction Loop
79
+
80
+ For each Unit, cycle through 4 Hats:
81
+
82
+ ### Hat 1: Architecture
83
+
84
+ **Read:** `shared/architecture-intelligence.md` + platform file
85
+
86
+ - Choose pattern (MVVM, Clean Arch, feature-based)
87
+ - Define file structure for this Unit
88
+ - Check: does this match existing project patterns?
89
+
90
+ ```
91
+ Architecture decision:
92
+ Pattern: [chosen pattern]
93
+ Files to create: [list]
94
+ Files to modify: [list]
95
+ Dependencies: [new packages if any]
96
+ ```
97
+
98
+ ### Hat 2: Builder
99
+
100
+ **Read:** Platform file (`react-native/react-native.md`, `flutter/flutter.md`, etc.)
101
+
102
+ - Write code following platform patterns
103
+ - Apply Feature Scaffold Protocol from SKILL.md
104
+ - Use existing project conventions (naming, imports, structure)
105
+
106
+ **Builder rules:**
107
+ - One Unit at a time — finish before starting next
108
+ - Match existing code style exactly
109
+ - No premature abstraction
110
+ - Handle all 4 states: loading / error / empty / success
111
+
112
+ ### Hat 3: Security
113
+
114
+ **Read:** Security rules in SKILL.md + `shared/anti-patterns.md`
115
+
116
+ Run 7-category scan on the Unit's code:
117
+
118
+ | Category | Check |
119
+ |----------|-------|
120
+ | Secrets | No hardcoded keys, tokens, URLs |
121
+ | Storage | Tokens in SecureStore/Keychain only |
122
+ | Input | User input sanitized before display |
123
+ | Network | HTTPS only, no cleartext |
124
+ | Data | No PII in logs, no sensitive data exposed |
125
+ | Auth | Token refresh, session expiry handled |
126
+ | Platform | iOS ATS, Android ProGuard, exported components |
127
+
128
+ **If any violation found → BLOCK Unit. Fix before proceeding.**
129
+
130
+ ### Hat 4: Reviewer
131
+
132
+ **Read:** `shared/code-review.md` + `shared/common-pitfalls.md`
133
+
134
+ Self-review checklist:
135
+ - [ ] Clean Architecture respected (UI → Domain → Data)
136
+ - [ ] Single responsibility (max 300 lines per file)
137
+ - [ ] No console.log / print in production
138
+ - [ ] Error handling complete (try/catch, error states)
139
+ - [ ] Navigation registered
140
+ - [ ] Types complete (no implicit any)
141
+ - [ ] Platform-specific edge cases handled
142
+ - [ ] Accessibility basics (labels, contrast)
143
+
144
+ **If review fails → return to Builder Hat. Fix, then re-review.**
145
+
146
+ ### Unit Complete
147
+
148
+ ```
149
+ Unit [N]: [name]
150
+ Status: ✅ complete
151
+ Files created: [list]
152
+ Files modified: [list]
153
+ Security: passed
154
+ Review: passed
155
+ → Proceed to Unit [N+1]
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Phase 3: Backpressure Gates
161
+
162
+ Quality gates that **block** progress automatically:
163
+
164
+ ```
165
+ Gate 1: TypeScript / Dart / Kotlin compiler → must pass
166
+ Gate 2: Lint (ESLint / flutter analyze) → must pass
167
+ Gate 3: Security scan (Hat 3) → must pass
168
+ Gate 4: Self-review (Hat 4) → must pass
169
+ Gate 5: Unit test (if test file exists) → must pass
170
+ ```
171
+
172
+ **Backpressure rule:** If any gate fails, the Builder Hat fixes the issue before moving to the next Unit. Max 3 fix attempts per gate — if still failing, ask user.
173
+
174
+ ---
175
+
176
+ ## Phase 4: Completion
177
+
178
+ When all Units are done:
179
+
180
+ ```
181
+ Intent: [name]
182
+ Units: [N] completed
183
+ Files created: [list all]
184
+ Files modified: [list all]
185
+ Security: all Units passed
186
+ Review: all Units passed
187
+
188
+ Remaining:
189
+ - [ ] Run full test suite
190
+ - [ ] Test on both platforms (if cross-platform)
191
+ - [ ] Verify navigation flow end-to-end
192
+ ```
193
+
194
+ ---
195
+
196
+ ## Mobile-Specific Adaptations
197
+
198
+ ### Cross-Platform Units
199
+
200
+ For React Native / Flutter projects, each screen Unit should verify:
201
+ - iOS rendering (safe area, notch, Dynamic Island)
202
+ - Android rendering (back button, status bar, edge-to-edge)
203
+ - Both platform navigation behaviors
204
+
205
+ ### Native Module Units
206
+
207
+ When Unit involves native code (camera, biometric, push):
208
+ 1. Builder Hat writes JS/Dart bridge first
209
+ 2. Builder Hat writes iOS native (Swift/ObjC)
210
+ 3. Builder Hat writes Android native (Kotlin/Java)
211
+ 4. Security Hat checks permissions on both platforms
212
+
213
+ ### State Management Units
214
+
215
+ Architecture Hat decides ONCE, applies to all Units:
216
+ - RN: Redux Toolkit / Zustand / Jotai / TanStack Query
217
+ - Flutter: Riverpod / BLoC / Provider
218
+ - iOS: TCA / Observable / Combine
219
+ - Android: StateFlow / LiveData
220
+
221
+ Never mix state management within one Intent.
222
+
223
+ ---
224
+
225
+ ## Hat ↔ Skill File Mapping
226
+
227
+ | Hat | Primary file | Secondary file |
228
+ |-----|-------------|---------------|
229
+ | Architecture | `shared/architecture-intelligence.md` | Platform file |
230
+ | Builder | Platform file (RN/Flutter/iOS/Android) | `shared/offline-first.md` (if offline) |
231
+ | Security | SKILL.md § Security | `shared/anti-patterns.md` |
232
+ | Reviewer | `shared/code-review.md` | `shared/common-pitfalls.md` |
233
+
234
+ ---
235
+
236
+ > AI-DLC for mobile: Elaborate → Construct (4 Hats per Unit) → Backpressure gates → Complete.
237
+ > Default mode: HITL. Activate when task ≥ 3 units. Skip for bug fixes and small changes.