@buivietphi/skill-mobile-mt 2.0.1 → 2.2.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 +96 -40
- package/README.md +77 -40
- package/SKILL.md +762 -54
- package/package.json +1 -1
- package/shared/bug-detection.md +411 -27
- package/shared/code-generation-templates.md +656 -0
- package/shared/code-review.md +899 -37
- package/shared/complex-ui-patterns.md +526 -0
- package/shared/data-flow-patterns.md +422 -0
- package/shared/debugging-intelligence.md +787 -0
- package/shared/error-handling.md +394 -0
- package/shared/i18n-localization.md +426 -0
- package/shared/intent-analysis.md +473 -0
- package/shared/navigation-patterns.md +375 -0
- package/shared/prompt-engineering.md +176 -20
- package/shared/spec-to-code.md +293 -0
- package/shared/storage-patterns.md +312 -0
- package/shared/testing-patterns.md +428 -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.2.0"
|
|
5
5
|
author: buivietphi
|
|
6
6
|
priority: high
|
|
7
7
|
user-invocable: true
|
|
@@ -50,25 +50,30 @@ RULE 7: ASK AFTER 3 FAILS — 3 failed attempts at same error → STOP → prese
|
|
|
50
50
|
|
|
51
51
|
1. [Cardinal Rules](#cardinal-rules-inviolable)
|
|
52
52
|
2. [Task Router](#task-router)
|
|
53
|
-
3. [
|
|
54
|
-
4. [Execution
|
|
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. [
|
|
53
|
+
3. [Intent Analysis Detector](#intent-analysis-detector-auto-load-sharedintent-analysismd) *(routes to shared/intent-analysis.md)*
|
|
54
|
+
4. [Multi-Fix Execution Protocol](#multi-fix-execution-protocol)
|
|
55
|
+
5. [UI Fix Protocol](#ui-fix-protocol)
|
|
56
|
+
6. [Communication Protocol](#communication-protocol)
|
|
57
|
+
7. [Decision Matrix Protocol](#decision-matrix-protocol)
|
|
58
|
+
8. [Execution Modes](#execution-modes)
|
|
59
|
+
9. [Mandatory Checkpoint](#mandatory-checkpoint)
|
|
60
|
+
10. [Auto-Detect](#auto-detect)
|
|
61
|
+
11. [Mobile Context](#mobile-context)
|
|
62
|
+
12. [Mode Selection](#mode-selection)
|
|
63
|
+
13. [Feature Scaffold Protocol](#feature-scaffold-protocol-project-mode)
|
|
64
|
+
14. [Error Recovery Protocol](#error-recovery-protocol)
|
|
65
|
+
15. [Quality Gate](#quality-gate) *(includes Completion Re-check)*
|
|
66
|
+
16. [Build & Deploy Gates](#build--deploy-gates)
|
|
67
|
+
17. [Codebase Scan Strategy](#codebase-scan-strategy)
|
|
68
|
+
18. [Smart Loading](#smart-loading)
|
|
69
|
+
19. [Grounding Protocol (Anti-Hallucination)](#grounding-protocol-anti-hallucination)
|
|
70
|
+
20. [Docs-First Protocol (Always Use Latest)](#docs-first-protocol-always-use-latest)
|
|
71
|
+
21. [Security Protocol](#security-protocol)
|
|
72
|
+
22. [Hard Bans](#hard-bans)
|
|
73
|
+
23. [Mobile Anti-Patterns](#mobile-anti-patterns)
|
|
74
|
+
24. [Leverage Pyramid](#leverage-pyramid-where-to-invest-review-time)
|
|
75
|
+
25. [Session State Tracking](#session-state-tracking-for-long-tasks)
|
|
76
|
+
26. [Reference Files](#reference-files)
|
|
72
77
|
|
|
73
78
|
---
|
|
74
79
|
|
|
@@ -82,11 +87,18 @@ RULE 7: ASK AFTER 3 FAILS — 3 failed attempts at same error → STOP → prese
|
|
|
82
87
|
```
|
|
83
88
|
USER REQUEST → ACTION (Read tool required)
|
|
84
89
|
─────────────────────────────────────────────────────────────────
|
|
85
|
-
"Create/build X feature" →
|
|
90
|
+
"Create/build X feature" → Check: is the spec clear or vague?
|
|
91
|
+
CLEAR → Feature Scaffold Protocol (no extra file needed)
|
|
92
|
+
VAGUE → Spec Analysis Protocol FIRST → confirm → then scaffold
|
|
86
93
|
screen + hook + service + store + types
|
|
87
94
|
|
|
88
|
-
"Create/add X screen/page" →
|
|
89
|
-
|
|
95
|
+
"Create/add X screen/page" → Check: is the spec clear or vague?
|
|
96
|
+
CLEAR → Feature Scaffold Protocol — MINIMAL (screen + hook)
|
|
97
|
+
VAGUE → Spec Analysis Protocol FIRST → confirm → then scaffold
|
|
98
|
+
|
|
99
|
+
"Build something like X app / → Read: shared/intent-analysis.md (Spec Analysis Protocol)
|
|
100
|
+
similar to / standard / usual / Parse → classify → present structured spec → wait confirm
|
|
101
|
+
you know what I mean" ⛔ NEVER start coding without confirmed spec
|
|
90
102
|
|
|
91
103
|
"Add X to existing Y" → MODIFY existing files, don't create new structure
|
|
92
104
|
|
|
@@ -94,12 +106,88 @@ USER REQUEST → ACTION (Read tool required)
|
|
|
94
106
|
then: Read platform file (see Smart Loading below)
|
|
95
107
|
then: suggest structure based on project size + stack
|
|
96
108
|
|
|
97
|
-
"Fix / debug X" →
|
|
98
|
-
|
|
109
|
+
"Fix / debug X" → ⛔ STOP — DO NOT suggest anything yet
|
|
110
|
+
Step 1: CLASSIFY error type (crash/build/type/network/render/state/native)
|
|
111
|
+
Step 2: SEARCH PROJECT FIRST (mandatory before ANY suggestion)
|
|
112
|
+
→ Grep error keywords in src/ (class name, function name, error message)
|
|
113
|
+
→ Glob for related files (*.ts, *.tsx, *.dart, *.swift, *.kt)
|
|
114
|
+
→ Read the TOP 3-5 matched files — understand actual code
|
|
115
|
+
Step 3: Find root cause IN PROJECT CODE (cite file:line)
|
|
116
|
+
Step 4: Fix → verify → cite source
|
|
117
|
+
⛔ NEVER skip Step 1-2 — even if you "think" you know the answer
|
|
118
|
+
If complex/unfamiliar bug → also Read: shared/debugging-intelligence.md
|
|
119
|
+
|
|
120
|
+
"Check issue / investigate X" → ⛔ DO NOT FIX YET — investigate first
|
|
121
|
+
Step 1: Read issue description fully
|
|
122
|
+
Step 2: Extract affected feature + expected vs actual behavior
|
|
123
|
+
Step 3: Search project for affected code area (Grep/Glob src/)
|
|
124
|
+
Step 4: Read code → trace data flow → find root cause
|
|
125
|
+
Step 5: REPORT findings — ask user if they want a fix
|
|
126
|
+
⛔ NEVER jump straight to fixing without reporting first
|
|
127
|
+
|
|
128
|
+
"Paste error log / stack trace" → Step 1: FILTER noise (skip node_modules, engine frames)
|
|
129
|
+
Step 2: Extract signal lines (YOUR file paths, Error:, Caused by:)
|
|
130
|
+
Step 3: Parse stack trace by platform (RN/Flutter/iOS/Android)
|
|
131
|
+
Step 4: Search project src/ for extracted keywords
|
|
132
|
+
Step 5: Root cause → fix → cite
|
|
133
|
+
If long/complex trace → also Read: shared/debugging-intelligence.md
|
|
134
|
+
|
|
135
|
+
"Take a look / something's off / → ⛔ USER DOESN'T KNOW THE CAUSE — run Diagnostic Scan:
|
|
136
|
+
not sure why / describe symptoms Step 1: EXTRACT AREA from what user said or showed:
|
|
137
|
+
why / take a look / describe → Screen name? Feature name? Module name? File name?
|
|
138
|
+
symptoms without error" → If user paste code → that IS the area
|
|
139
|
+
→ If user describe behavior → extract the feature/screen name
|
|
140
|
+
Step 2: SEARCH project for that area (mandatory):
|
|
141
|
+
→ Grep "[feature/screen name]" src/
|
|
142
|
+
→ Glob "**/*[name]*" to find all related files
|
|
143
|
+
→ Read ALL matched files (not just 1 — scan broadly)
|
|
144
|
+
Step 3: RUN SCAN CHECKLIST on the code you just read:
|
|
145
|
+
→ Walk through bug-detection.md Step 5 checklist
|
|
146
|
+
→ Check: crash risks, memory leaks, race conditions,
|
|
147
|
+
security, performance, UX — against ACTUAL code
|
|
148
|
+
Step 4: REPORT what you found (structured):
|
|
149
|
+
→ "I scanned [N files] in [area]."
|
|
150
|
+
→ "Found [N] potential issues:" (list with severity + file:line)
|
|
151
|
+
→ "No critical issues found." (if clean)
|
|
152
|
+
→ "Suspicious: [describe what looks off based on code]"
|
|
153
|
+
Step 5: ASK what user wants to do:
|
|
154
|
+
→ "Want me to fix [specific issue]?"
|
|
155
|
+
→ "Want me to investigate [suspicious area] deeper?"
|
|
156
|
+
⛔ NEVER say "I don't see any issues" without having searched
|
|
157
|
+
⛔ NEVER suggest fixes before completing the scan report
|
|
158
|
+
|
|
159
|
+
"Review" (generic, no scope) → Read: shared/code-review.md → detect Review Mode:
|
|
160
|
+
→ Check git status → if changes exist → MODE: CHANGES
|
|
161
|
+
→ If no changes → ASK user: "Review full codebase or specific file?"
|
|
162
|
+
|
|
163
|
+
"Review full code / audit" → Read: shared/code-review.md → MODE: FULL
|
|
164
|
+
Read ALL src/ files → 12-category checklist → full report
|
|
165
|
+
|
|
166
|
+
"Review changes / review diff" → Read: shared/code-review.md → MODE: CHANGES
|
|
167
|
+
git diff → review only changed lines + context
|
|
168
|
+
|
|
169
|
+
"Review file X / this file" → Read: shared/code-review.md → MODE: FILE
|
|
170
|
+
Read specified file → 12-category checklist on that file
|
|
171
|
+
|
|
172
|
+
"Review function X / this func" → Read: shared/code-review.md → MODE: FUNCTION
|
|
173
|
+
Find function → trace callers → deep review
|
|
174
|
+
|
|
175
|
+
"Review PR / pull request" → Read: shared/code-review.md → MODE: PR
|
|
176
|
+
Read: shared/anti-patterns.md
|
|
177
|
+
Step 0 PR-Level → git diff base..HEAD → 12-category → verdict
|
|
178
|
+
|
|
179
|
+
"Review modified files" → Read: shared/code-review.md → MODE: MODIFIED
|
|
180
|
+
git status → read modified files → review
|
|
181
|
+
|
|
182
|
+
"Review commits" → Read: shared/code-review.md → MODE: COMMITS
|
|
183
|
+
git log → git show each commit → review diffs
|
|
99
184
|
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
|
|
185
|
+
"Check PR" → Read: shared/code-review.md → MODE: PR-CHECK
|
|
186
|
+
Step 0 ONLY (size, scope, tests, commits) → quick ✅/🔴
|
|
187
|
+
|
|
188
|
+
"Review accessibility / a11y" → Read: shared/code-review.md (§ Accessibility)
|
|
189
|
+
then: WCAG 2.1 mobile checklist — labels, touch targets,
|
|
190
|
+
contrast, screen reader, font scaling, color, focus, motion
|
|
103
191
|
|
|
104
192
|
"Optimize / performance X" → Read: shared/bug-detection.md (§ Performance section)
|
|
105
193
|
then: profile → identify bottleneck → fix
|
|
@@ -145,6 +233,17 @@ USER REQUEST → ACTION (Read tool required)
|
|
|
145
233
|
"Offline / cache / sync" → Read: shared/offline-first.md
|
|
146
234
|
then: implement local-first architecture
|
|
147
235
|
|
|
236
|
+
"Storage / lưu data / AsyncStorage / MMKV / SecureStore / Keychain /
|
|
237
|
+
SQLite / WatermelonDB / Realm / token storage / local database /
|
|
238
|
+
save to device / persist data" → Read: shared/storage-patterns.md
|
|
239
|
+
then: pick storage type from matrix → implement → security check
|
|
240
|
+
|
|
241
|
+
"i18n / multi-language / translation / localization / đa ngôn ngữ /
|
|
242
|
+
multilang / RTL / Arabic / locale / language switcher / date format /
|
|
243
|
+
number format / plural / slang / i18next / l10n" →
|
|
244
|
+
Read: shared/i18n-localization.md
|
|
245
|
+
then: pick library per platform → scaffold translations → RTL check
|
|
246
|
+
|
|
148
247
|
"Write/run E2E tests" → Read: shared/testing-strategy.md
|
|
149
248
|
then: Detox (RN) or Maestro (cross-platform) or XCUITest/Espresso
|
|
150
249
|
|
|
@@ -160,6 +259,74 @@ USER REQUEST → ACTION (Read tool required)
|
|
|
160
259
|
"Big feature / multi-screen" → Read: shared/ai-dlc-workflow.md
|
|
161
260
|
then: Elaborate → Construct (4 Hats) → Backpressure → Complete
|
|
162
261
|
|
|
262
|
+
"Which is better / compare / → Decision Matrix Protocol (in this file — no extra read)
|
|
263
|
+
nên dùng gì / best approach / Present 2-3 options in matrix format → recommend → wait
|
|
264
|
+
options / trade-offs / ⛔ NEVER just pick one without showing comparison
|
|
265
|
+
upgrade or not / migrate"
|
|
266
|
+
|
|
267
|
+
"How much work / big change? / → Estimation Protocol (in Decision Matrix Protocol section)
|
|
268
|
+
scope / effort / risk" Scan → classify XS/S/M/L/XL → risk → present
|
|
269
|
+
|
|
270
|
+
"Fix UI / match design / → UI Fix Protocol (in this file)
|
|
271
|
+
adjust layout / UI broken / Step 1: Identify what → Step 2: Read component tree
|
|
272
|
+
UI mismatch / layout wrong" Step 3: Trace style chain → Step 4: Fix → Step 5: Verify
|
|
273
|
+
|
|
274
|
+
"Fix multiple / fix A then B / → Read: shared/intent-analysis.md (Task Extraction Protocol)
|
|
275
|
+
multiple files / fix + fix + Extract ALL tasks → classify → order → track → verify ALL
|
|
276
|
+
fix UI + fix bug + add X" ⛔ NEVER start until ALL tasks are listed
|
|
277
|
+
|
|
278
|
+
"Update UI to match design / → UI Fix Protocol (in this file)
|
|
279
|
+
Figma / screenshot / mockup" Read component tree → trace style → fix → verify both themes
|
|
280
|
+
|
|
281
|
+
"Make it better / improve this / → Read: shared/intent-analysis.md (Scope Clarification Protocol)
|
|
282
|
+
fix everything / clean up / Detect vague → clarify scope → set completion criteria
|
|
283
|
+
something is wrong / not right" ⛔ NEVER start coding until scope is clear
|
|
284
|
+
|
|
285
|
+
"It's slow / doesn't work / → Read: shared/intent-analysis.md (Intent Understanding Protocol)
|
|
286
|
+
button doesn't work / blank / Map non-technical → technical → search code → fix
|
|
287
|
+
freezes / flickers / keeps Confirm interpretation before acting
|
|
288
|
+
crashing / shows old data"
|
|
289
|
+
|
|
290
|
+
"Fix that / same for this one / → Read: shared/intent-analysis.md (Context Tracking)
|
|
291
|
+
the other screen / do it again / Resolve pronoun → confirm reference → proceed
|
|
292
|
+
like before / undo that" ⛔ NEVER guess when reference is ambiguous
|
|
293
|
+
|
|
294
|
+
"URGENT / production down / → Read: shared/intent-analysis.md (Priority Detection)
|
|
295
|
+
before release / deadline / Adjust depth: CRITICAL=fix only, HIGH=fix+verify
|
|
296
|
+
blocker / ASAP" Skip nice-to-haves, communicate progress
|
|
297
|
+
|
|
298
|
+
"Build feature from spec / → Read: shared/spec-to-code.md
|
|
299
|
+
implement from requirements / Parse → dependency graph → file plan → types-first → implement
|
|
300
|
+
convert spec to code" ⛔ NEVER skip type definitions
|
|
301
|
+
|
|
302
|
+
"Setup state management / → Read: shared/code-generation-templates.md
|
|
303
|
+
add Zustand / Redux / Riverpod / Production templates with persist, middleware, selectors
|
|
304
|
+
setup API client / setup forms / API client with retry + token refresh + error normalization
|
|
305
|
+
form validation" Forms with Zod, multi-step, file upload
|
|
306
|
+
|
|
307
|
+
"Add navigation / auth flow / → Read: shared/navigation-patterns.md
|
|
308
|
+
deep links / modal / tabs / Auth stack, deep link config, modal groups, tab persistence
|
|
309
|
+
push notifications / Push notification setup + deep link from notification
|
|
310
|
+
permissions" Permission request + denied handling + settings redirect
|
|
311
|
+
|
|
312
|
+
"Carousel / swipe / gestures / → Read: shared/complex-ui-patterns.md
|
|
313
|
+
responsive / tablet / keyboard / Image carousel, swipe cards, gesture handling
|
|
314
|
+
dark mode / skeleton / Responsive layout, keyboard avoidance, dark mode theme
|
|
315
|
+
accessibility / a11y" Skeleton loading, accessibility implementation per platform
|
|
316
|
+
|
|
317
|
+
"Pagination / infinite scroll / → Read: shared/data-flow-patterns.md
|
|
318
|
+
optimistic update / cache / Cursor + offset pagination, prefetching
|
|
319
|
+
real-time / WebSocket / Optimistic updates with rollback, cache invalidation
|
|
320
|
+
offline queue" WebSocket manager, offline request queue
|
|
321
|
+
|
|
322
|
+
"Error handling / retry / → Read: shared/error-handling.md
|
|
323
|
+
error boundary / toast / Error type hierarchy, user-facing messages
|
|
324
|
+
global error handler" Error boundary, retry with backoff, toast notifications
|
|
325
|
+
|
|
326
|
+
"Write unit tests / component → Read: shared/testing-patterns.md
|
|
327
|
+
tests / mock / factory / Component tests (4 states), hook tests, service tests
|
|
328
|
+
test setup / test helpers" Test factories, provider wrapper, snapshot strategy
|
|
329
|
+
|
|
163
330
|
```
|
|
164
331
|
|
|
165
332
|
**⛔ NEVER start coding without identifying the task type first.**
|
|
@@ -167,6 +334,185 @@ USER REQUEST → ACTION (Read tool required)
|
|
|
167
334
|
|
|
168
335
|
---
|
|
169
336
|
|
|
337
|
+
## Intent Analysis Detector (auto-load shared/intent-analysis.md)
|
|
338
|
+
|
|
339
|
+
**BEFORE coding: detect if input needs deep analysis. If yes → Read shared/intent-analysis.md.**
|
|
340
|
+
|
|
341
|
+
```
|
|
342
|
+
═══ COMPLEXITY SIGNALS — auto-trigger Read: shared/intent-analysis.md ═══
|
|
343
|
+
|
|
344
|
+
MULTI-PART → Task Extraction Protocol:
|
|
345
|
+
- Multiple sentences with different requests
|
|
346
|
+
- Comma-separated requests ("fix A, fix B, add C")
|
|
347
|
+
- References to multiple files/screens/components
|
|
348
|
+
⛔ NEVER start coding after reading only the first sentence
|
|
349
|
+
|
|
350
|
+
VAGUE INPUT → Scope Clarification Protocol:
|
|
351
|
+
- "Make it better / fix the UI / improve this / fix everything"
|
|
352
|
+
- No specific screen, component, or symptom mentioned
|
|
353
|
+
⛔ NEVER guess what "better" means — clarify first
|
|
354
|
+
|
|
355
|
+
NON-TECHNICAL → Intent Understanding Protocol:
|
|
356
|
+
- "Button doesn't work / screen is blank / it freezes / takes forever"
|
|
357
|
+
- Map everyday language → technical cause → search code → fix
|
|
358
|
+
⛔ NEVER ask user for error message if they clearly don't have one
|
|
359
|
+
|
|
360
|
+
CONTEXT REFERENCE → Intent Understanding Protocol — Context Tracking:
|
|
361
|
+
- "Fix that / same for this one / the other screen / like before"
|
|
362
|
+
- Resolve pronoun → confirm reference → proceed
|
|
363
|
+
⛔ NEVER guess when reference is ambiguous
|
|
364
|
+
|
|
365
|
+
URGENCY → Intent Understanding Protocol — Priority Detection:
|
|
366
|
+
- CRITICAL: "URGENT / production down / users affected"
|
|
367
|
+
- HIGH: "before release / deadline / blocker"
|
|
368
|
+
- LOW: "when you get a chance / not urgent / nice to have"
|
|
369
|
+
|
|
370
|
+
VAGUE FEATURE → Spec Analysis Protocol:
|
|
371
|
+
- "Build X like other apps / something similar to Y / you know what I mean"
|
|
372
|
+
- Present ✅/❓/⚠️ structured spec → wait confirm → then build
|
|
373
|
+
⛔ NEVER start building from a vague description
|
|
374
|
+
|
|
375
|
+
CLEAR INPUT (skip — proceed to Task Router directly):
|
|
376
|
+
- "Fix the login button — it doesn't respond to tap"
|
|
377
|
+
- "Add loading spinner to ProfileScreen"
|
|
378
|
+
- Single task with specific target + action
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## Multi-Fix Execution Protocol
|
|
384
|
+
|
|
385
|
+
**When fixing multiple issues across multiple files:**
|
|
386
|
+
|
|
387
|
+
```
|
|
388
|
+
⛔ DO NOT edit 5 files then check if it works.
|
|
389
|
+
✅ Fix → Verify → Fix → Verify → Fix → Verify (incremental)
|
|
390
|
+
|
|
391
|
+
═══ EXECUTION FLOW ═══
|
|
392
|
+
|
|
393
|
+
PHASE 1: MAP (before any edit)
|
|
394
|
+
→ Read ALL affected files first (parallel reads)
|
|
395
|
+
→ Map dependencies: "File A imports from File B"
|
|
396
|
+
→ Identify shared code: "Both Screen X and Screen Y use useAuth"
|
|
397
|
+
→ Decide order: edit shared/base code FIRST, then consumers
|
|
398
|
+
|
|
399
|
+
PHASE 2: EXECUTE (one fix at a time)
|
|
400
|
+
For each task (in dependency order):
|
|
401
|
+
1. STATE what you're fixing: "Fixing TASK 2: crash on back press"
|
|
402
|
+
2. READ the target file(s) — even if read before (Context Staleness Rule)
|
|
403
|
+
3. EDIT — make the change
|
|
404
|
+
4. VERIFY — check imports resolve, types pass, no new errors
|
|
405
|
+
5. MARK complete: "✅ TASK 2 done"
|
|
406
|
+
6. CHECK SIDE EFFECTS: did this change break anything else?
|
|
407
|
+
→ If yes → fix the side effect BEFORE moving to next task
|
|
408
|
+
|
|
409
|
+
PHASE 3: FINAL VERIFICATION
|
|
410
|
+
→ Re-read ALL modified files
|
|
411
|
+
→ Run Quality Gate on each
|
|
412
|
+
→ Verify no circular breakage (File A fix didn't break File B fix)
|
|
413
|
+
→ List all changes: "Modified: FileA.tsx (line 45), FileB.tsx (line 12, 89)"
|
|
414
|
+
|
|
415
|
+
═══ SIDE EFFECTS MAP ═══
|
|
416
|
+
|
|
417
|
+
When editing a file, CHECK these for side effects:
|
|
418
|
+
SHARED HOOK changed? → Re-check ALL screens that use it
|
|
419
|
+
NAVIGATION changed? → Re-check ALL screens that navigate to/from it
|
|
420
|
+
TYPE/INTERFACE changed? → Re-check ALL files that import it
|
|
421
|
+
API SERVICE changed? → Re-check ALL hooks/screens that call it
|
|
422
|
+
STYLE/THEME changed? → Re-check ALL components using that style
|
|
423
|
+
STATE SHAPE changed? → Re-check ALL selectors/consumers
|
|
424
|
+
|
|
425
|
+
═══ CONFLICT DETECTION ═══
|
|
426
|
+
|
|
427
|
+
Before editing a file that was already edited in this session:
|
|
428
|
+
→ RE-READ the file (your earlier edit is already applied)
|
|
429
|
+
→ Verify your new edit doesn't revert the previous fix
|
|
430
|
+
→ If conflict: merge both fixes into one coherent edit
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## UI Fix Protocol
|
|
436
|
+
|
|
437
|
+
**When user asks to fix UI / match design / adjust layout:**
|
|
438
|
+
|
|
439
|
+
```
|
|
440
|
+
⛔ DO NOT guess what the UI should look like.
|
|
441
|
+
✅ READ the actual component code first.
|
|
442
|
+
✅ TRACE the style chain: component → stylesheet → theme → platform.
|
|
443
|
+
|
|
444
|
+
═══ UI FIX WORKFLOW ═══
|
|
445
|
+
|
|
446
|
+
STEP 1: IDENTIFY what needs fixing
|
|
447
|
+
→ User says "fix UI" → ASK: "Which screen/component? What's wrong specifically?"
|
|
448
|
+
→ User shows screenshot → Compare with code structure
|
|
449
|
+
→ User references design → Read the design spec/figma description
|
|
450
|
+
|
|
451
|
+
STEP 2: READ the component tree (top-down)
|
|
452
|
+
→ Screen file (the container)
|
|
453
|
+
→ Child components used in that screen
|
|
454
|
+
→ Shared components (Button, Input, Card, etc.)
|
|
455
|
+
→ Style files / theme files
|
|
456
|
+
→ DO NOT skip any layer — UI bugs often come from parent, not child
|
|
457
|
+
|
|
458
|
+
STEP 3: TRACE the style chain
|
|
459
|
+
For each UI element to fix:
|
|
460
|
+
→ Inline style? → check the style object
|
|
461
|
+
→ StyleSheet? → find the stylesheet, check the exact rule
|
|
462
|
+
→ Theme? → check if theme variable is correct
|
|
463
|
+
→ Platform-specific? → check Platform.OS / platform files
|
|
464
|
+
→ Responsive? → check Dimensions / useWindowDimensions
|
|
465
|
+
→ Dark mode? → check if both light/dark have the value
|
|
466
|
+
|
|
467
|
+
STEP 4: FIX with precision
|
|
468
|
+
→ Edit ONLY the specific style/layout property
|
|
469
|
+
→ DO NOT refactor the entire component "while you're at it"
|
|
470
|
+
→ Preserve existing patterns (if project uses StyleSheet, don't switch to inline)
|
|
471
|
+
|
|
472
|
+
STEP 5: VERIFY the fix
|
|
473
|
+
→ Re-read the component → does the fix make visual sense?
|
|
474
|
+
→ Check sibling components → are they still consistent?
|
|
475
|
+
→ Check platform: if RN → both iOS and Android affected?
|
|
476
|
+
→ Check theme: if dark mode exists → fix applies to both themes?
|
|
477
|
+
|
|
478
|
+
═══ COMMON UI FIX PATTERNS ═══
|
|
479
|
+
|
|
480
|
+
SPACING/ALIGNMENT:
|
|
481
|
+
→ Check: padding, margin, flex, alignItems, justifyContent
|
|
482
|
+
→ Common mistake: mixing padding on parent AND child → double spacing
|
|
483
|
+
→ Fix: adjust ONE layer, not both
|
|
484
|
+
|
|
485
|
+
TEXT NOT SHOWING / CUT OFF:
|
|
486
|
+
→ Check: numberOfLines, flex: 1, width, overflow
|
|
487
|
+
→ Common mistake: parent has fixed height → child text truncated
|
|
488
|
+
→ Fix: use flexShrink/flexGrow or remove fixed height
|
|
489
|
+
|
|
490
|
+
IMAGE WRONG SIZE:
|
|
491
|
+
→ Check: resizeMode, width/height, aspectRatio
|
|
492
|
+
→ Common mistake: no explicit dimensions → image takes natural size
|
|
493
|
+
→ Fix: set explicit width + aspectRatio (not width + height)
|
|
494
|
+
|
|
495
|
+
LIST PERFORMANCE:
|
|
496
|
+
→ Check: FlatList vs ScrollView, keyExtractor, getItemLayout
|
|
497
|
+
→ Common mistake: ScrollView with 100+ items → jank
|
|
498
|
+
→ Fix: switch to FlatList + add keyExtractor + getItemLayout if fixed height
|
|
499
|
+
|
|
500
|
+
KEYBOARD OVERLAP:
|
|
501
|
+
→ Check: KeyboardAvoidingView, behavior (iOS=padding, Android=height)
|
|
502
|
+
→ Common mistake: no KeyboardAvoidingView → input hidden behind keyboard
|
|
503
|
+
→ Fix: wrap in KeyboardAvoidingView with correct behavior per platform
|
|
504
|
+
|
|
505
|
+
═══ MULTI-SCREEN UI FIX ═══
|
|
506
|
+
|
|
507
|
+
When fixing UI across multiple screens:
|
|
508
|
+
→ FIX shared components FIRST (Button, Header, Input, etc.)
|
|
509
|
+
→ Then fix individual screens (they inherit from shared)
|
|
510
|
+
→ Verify consistency: same Button should look same on all screens
|
|
511
|
+
→ Check navigation transitions: screen A → screen B still smooth?
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
---
|
|
515
|
+
|
|
170
516
|
## Communication Protocol
|
|
171
517
|
|
|
172
518
|
**Show progress, not monologues. Brief status updates before each tool use.**
|
|
@@ -219,6 +565,130 @@ BAD:
|
|
|
219
565
|
|
|
220
566
|
---
|
|
221
567
|
|
|
568
|
+
## Decision Matrix Protocol
|
|
569
|
+
|
|
570
|
+
**When multiple valid approaches exist, ALWAYS present a structured comparison — NEVER just pick one.**
|
|
571
|
+
|
|
572
|
+
### When This Triggers
|
|
573
|
+
|
|
574
|
+
```
|
|
575
|
+
TRIGGERS:
|
|
576
|
+
- User asks "how should I..." / "what's the best way to..."
|
|
577
|
+
- Multiple libraries/tools can solve the same problem
|
|
578
|
+
- Architecture decisions (monolith vs modular, REST vs GraphQL, etc.)
|
|
579
|
+
- Migration/upgrade questions ("should I upgrade to X?")
|
|
580
|
+
- Trade-off situations (performance vs simplicity, native vs cross-platform)
|
|
581
|
+
- User says "give me options" / "what are my choices"
|
|
582
|
+
|
|
583
|
+
⛔ DO NOT just pick one approach and implement it
|
|
584
|
+
✅ Present comparison → let user decide → then implement
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
### Decision Matrix Format
|
|
588
|
+
|
|
589
|
+
```
|
|
590
|
+
STEP 1: RESEARCH (before presenting options)
|
|
591
|
+
→ Read project code to understand constraints
|
|
592
|
+
→ Check existing patterns (what does the project already use?)
|
|
593
|
+
→ WebSearch for latest recommendations + benchmarks
|
|
594
|
+
→ Identify 2-3 viable options (no more — too many = analysis paralysis)
|
|
595
|
+
|
|
596
|
+
STEP 2: PRESENT MATRIX
|
|
597
|
+
|
|
598
|
+
┌────────────────────────────────────────────────────────────┐
|
|
599
|
+
│ DECISION: [What we're deciding] │
|
|
600
|
+
│ CONTEXT: [Project constraints — framework, SDK, team size] │
|
|
601
|
+
├──────────────┬──────────────┬──────────────┬───────────────┤
|
|
602
|
+
│ │ Option A │ Option B │ Option C │
|
|
603
|
+
├──────────────┼──────────────┼──────────────┼───────────────┤
|
|
604
|
+
│ What │ [1 sentence] │ [1 sentence] │ [1 sentence] │
|
|
605
|
+
│ Pros │ • fast │ • simple │ • scalable │
|
|
606
|
+
│ │ • typed │ • small │ • official │
|
|
607
|
+
│ Cons │ • complex │ • no types │ • heavy │
|
|
608
|
+
│ Performance │ [fast/med/slow]│ [fast/med/slow]│ [fast/med/slow]│
|
|
609
|
+
│ Bundle Size │ [small/med/large]│ [small/med/large]│ [small/med/large]│
|
|
610
|
+
│ Learning │ [easy/med/hard]│ [easy/med/hard]│ [easy/med/hard]│
|
|
611
|
+
│ Maintenance │ [low/med/high]│ [low/med/high]│ [low/med/high]│
|
|
612
|
+
│ Community │ [stars/npm weekly]│ [stars/npm weekly]│ [stars/npm weekly]│
|
|
613
|
+
│ Fits Project │ ✅/⚠️/❌ │ ✅/⚠️/❌ │ ✅/⚠️/❌ │
|
|
614
|
+
└──────────────┴──────────────┴──────────────┴───────────────┘
|
|
615
|
+
|
|
616
|
+
STEP 3: RECOMMENDATION (with reasoning)
|
|
617
|
+
→ "I recommend Option [X] because:
|
|
618
|
+
1. [reason based on project code — cite file]
|
|
619
|
+
2. [reason based on constraints]
|
|
620
|
+
3. [reason based on trade-offs]"
|
|
621
|
+
→ "However, Option [Y] is better if [condition]."
|
|
622
|
+
|
|
623
|
+
STEP 4: WAIT FOR USER DECISION
|
|
624
|
+
→ ⛔ DO NOT implement until user picks
|
|
625
|
+
→ If user says "just pick one" → implement your recommendation
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
### Estimation Protocol (for scope/effort questions)
|
|
629
|
+
|
|
630
|
+
```
|
|
631
|
+
When user asks "how much work is this?" / "is this a big change?" / "should we do X?":
|
|
632
|
+
|
|
633
|
+
STEP 1: SCAN SCOPE
|
|
634
|
+
→ Glob + Grep to count affected files
|
|
635
|
+
→ Identify: how many files change? how many new files?
|
|
636
|
+
→ Check: any breaking changes to existing features?
|
|
637
|
+
|
|
638
|
+
STEP 2: CLASSIFY EFFORT
|
|
639
|
+
┌──────────────────────────────────────────────────┐
|
|
640
|
+
│ XS │ 1-2 files │ Simple change, no side effects │
|
|
641
|
+
│ S │ 3-5 files │ Contained change, few deps │
|
|
642
|
+
│ M │ 6-15 files│ Cross-feature, some testing │
|
|
643
|
+
│ L │ 16+ files │ Architectural, needs planning │
|
|
644
|
+
│ XL │ 30+ files │ Major refactor, phased approach │
|
|
645
|
+
└──────────────────────────────────────────────────┘
|
|
646
|
+
|
|
647
|
+
STEP 3: RISK ASSESSMENT
|
|
648
|
+
→ Breaking changes: [none / minor / major]
|
|
649
|
+
→ Test coverage: [good / partial / none — need to add]
|
|
650
|
+
→ Rollback difficulty: [easy / medium / hard]
|
|
651
|
+
→ Dependencies affected: [list them]
|
|
652
|
+
|
|
653
|
+
STEP 4: PRESENT
|
|
654
|
+
"This is a [S/M/L] change:
|
|
655
|
+
→ [N] files to modify, [N] new files
|
|
656
|
+
→ Risk: [low/medium/high] — [why]
|
|
657
|
+
→ Suggestion: [do it now / plan first / phase it]"
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
### Migration/Upgrade Decision Protocol
|
|
661
|
+
|
|
662
|
+
```
|
|
663
|
+
When user asks "should I upgrade to X?" / "migrate from A to B?":
|
|
664
|
+
|
|
665
|
+
STEP 1: CHECK CURRENT STATE
|
|
666
|
+
→ Read package.json / pubspec.yaml → exact current versions
|
|
667
|
+
→ Grep for deprecated APIs currently used in src/
|
|
668
|
+
→ Count how many files use the library/API being upgraded
|
|
669
|
+
|
|
670
|
+
STEP 2: CHECK TARGET STATE
|
|
671
|
+
→ WebSearch "[library] migration guide [current version] to [target version]"
|
|
672
|
+
→ WebSearch "[library] breaking changes [target version]"
|
|
673
|
+
→ List ALL breaking changes that affect THIS project
|
|
674
|
+
|
|
675
|
+
STEP 3: IMPACT ANALYSIS
|
|
676
|
+
→ For each breaking change → Grep in src/ → count affected files
|
|
677
|
+
→ Classify: auto-fixable (codemod) vs manual fix
|
|
678
|
+
|
|
679
|
+
STEP 4: PRESENT DECISION
|
|
680
|
+
"Upgrading [X] from [v1] to [v2]:
|
|
681
|
+
→ Breaking changes: [N] that affect your project
|
|
682
|
+
→ Files to update: [N]
|
|
683
|
+
→ Auto-fixable: [N] (via codemod)
|
|
684
|
+
→ Manual fixes: [N]
|
|
685
|
+
→ Risk: [low/medium/high]
|
|
686
|
+
→ Recommendation: [upgrade now / wait / partial upgrade]
|
|
687
|
+
→ If upgrading: [suggest phased plan]"
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
---
|
|
691
|
+
|
|
222
692
|
## Execution Modes
|
|
223
693
|
|
|
224
694
|
**Switch modes based on task phase. Each mode has different behavior.**
|
|
@@ -568,28 +1038,47 @@ file upload / camera →
|
|
|
568
1038
|
```
|
|
569
1039
|
ERROR ENCOUNTERED → RECOVERY FLOW:
|
|
570
1040
|
|
|
571
|
-
ATTEMPT
|
|
572
|
-
|
|
573
|
-
|
|
1041
|
+
⛔ BEFORE ANY ATTEMPT: Search project source code first
|
|
1042
|
+
→ Grep error keywords in src/ (file name, function name, class name)
|
|
1043
|
+
→ Read matched files to understand actual code context
|
|
1044
|
+
→ ONLY THEN proceed to fix attempts
|
|
1045
|
+
|
|
1046
|
+
ATTEMPT 1: Fix based on project code analysis
|
|
1047
|
+
- You already searched src/ → you know WHERE the issue is
|
|
1048
|
+
- Missing imports? → Check what the file actually imports → add correct one
|
|
1049
|
+
- Type errors? → Read the actual types/interfaces in project → fix to match
|
|
574
1050
|
- Linter errors? → Auto-format
|
|
575
1051
|
- Run verification → success? DONE : next attempt
|
|
576
1052
|
|
|
577
|
-
ATTEMPT 2:
|
|
578
|
-
-
|
|
579
|
-
-
|
|
1053
|
+
ATTEMPT 2: Widen search — read related files
|
|
1054
|
+
- Grep for the function/class across entire project (not just src/)
|
|
1055
|
+
- Read files that CALL or IMPORT the broken code
|
|
1056
|
+
- Check dependencies installed (package.json / pubspec.yaml)
|
|
580
1057
|
- Verify native module linked (mobile)
|
|
581
1058
|
- Run verification → success? DONE : next attempt
|
|
582
1059
|
|
|
583
|
-
ATTEMPT 3: Alternative approach
|
|
584
|
-
-
|
|
585
|
-
-
|
|
586
|
-
- Simplify implementation
|
|
1060
|
+
ATTEMPT 3: Alternative approach (still based on project context)
|
|
1061
|
+
- Look at how SIMILAR features are implemented in the project
|
|
1062
|
+
- Clone working pattern → adapt for this case
|
|
1063
|
+
- Simplify implementation if needed
|
|
587
1064
|
- Run verification → success? DONE : next attempt
|
|
588
1065
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
-
|
|
592
|
-
-
|
|
1066
|
+
⚠️ 3 FAILS = QUESTION ARCHITECTURE (mandatory checkpoint):
|
|
1067
|
+
If 3 attempts failed on the SAME error → STOP fixing and ask:
|
|
1068
|
+
- "Is this the right approach entirely?"
|
|
1069
|
+
- "Is the underlying pattern/architecture wrong?"
|
|
1070
|
+
- "Should I be solving a DIFFERENT problem?"
|
|
1071
|
+
Search project for working alternatives:
|
|
1072
|
+
→ Grep for similar feature that WORKS → compare the patterns
|
|
1073
|
+
→ The bug may not be a bug — it may be a wrong approach
|
|
1074
|
+
|
|
1075
|
+
ATTEMPT 4: STOP & ASK USER (with evidence)
|
|
1076
|
+
- Show what you searched and found in project
|
|
1077
|
+
- Show EACH attempt: what you tried + what happened + why it failed
|
|
1078
|
+
- ⛔ NEVER say "I tried everything" — show EXACTLY what you tried
|
|
1079
|
+
- If 3+ fails: "This suggests the issue may be architectural.
|
|
1080
|
+
I found [working_pattern] in [file] that solves this differently."
|
|
1081
|
+
- Present 2-3 options with trade-offs
|
|
593
1082
|
- Wait for user decision
|
|
594
1083
|
```
|
|
595
1084
|
|
|
@@ -656,9 +1145,41 @@ STEP 2: REVIEW — Re-read your own code with fresh eyes:
|
|
|
656
1145
|
- Would a senior dev approve this in code review?
|
|
657
1146
|
- Am I importing anything that doesn't exist in the project?
|
|
658
1147
|
STEP 3: REFINE — Fix issues found in review
|
|
659
|
-
STEP 4: VERIFY — Run Quality Gate above → all pass?
|
|
1148
|
+
STEP 4: VERIFY — Run Quality Gate above → all pass?
|
|
1149
|
+
STEP 5: COMPLETION RE-CHECK (MANDATORY — never skip)
|
|
1150
|
+
→ Re-read the user's ORIGINAL message (scroll up if needed)
|
|
1151
|
+
→ List every task/request the user made
|
|
1152
|
+
→ For EACH task, verify:
|
|
1153
|
+
□ Was it actually done? (not just planned, actually EDITED)
|
|
1154
|
+
□ Which file:line was changed?
|
|
1155
|
+
□ Does the change match what user asked?
|
|
1156
|
+
→ If ANY task was missed → DO IT NOW before saying "done"
|
|
1157
|
+
→ Report:
|
|
1158
|
+
"✅ Done. Changes:"
|
|
1159
|
+
"1. [task] → [file:line] — [what changed]"
|
|
1160
|
+
"2. [task] → [file:line] — [what changed]"
|
|
660
1161
|
|
|
661
1162
|
If STEP 2 finds issues → loop back to STEP 3 (max 2 loops)
|
|
1163
|
+
If STEP 5 finds missed tasks → loop back to STEP 1 for those tasks
|
|
1164
|
+
```
|
|
1165
|
+
|
|
1166
|
+
### Common "Forgot to Complete" Patterns
|
|
1167
|
+
|
|
1168
|
+
```
|
|
1169
|
+
⛔ PATTERN 1: "I'll do that next" → then never does it
|
|
1170
|
+
→ FIX: Track with Task Extraction Protocol, check off each task
|
|
1171
|
+
|
|
1172
|
+
⛔ PATTERN 2: Read the file, understand the issue, but forgot to EDIT
|
|
1173
|
+
→ FIX: After each task, verify you actually USED the Edit/Write tool
|
|
1174
|
+
|
|
1175
|
+
⛔ PATTERN 3: Fixed file A, but file B also needed the same fix
|
|
1176
|
+
→ FIX: After fixing, Grep for same pattern in other files
|
|
1177
|
+
|
|
1178
|
+
⛔ PATTERN 4: Fixed the logic but forgot to update the UI/types/tests
|
|
1179
|
+
→ FIX: Side Effects Map (see Multi-Fix Execution Protocol)
|
|
1180
|
+
|
|
1181
|
+
⛔ PATTERN 5: User said "fix multiple places" but AI fixed only the first one
|
|
1182
|
+
→ FIX: Task Extraction Protocol → extract ALL → track ALL → verify ALL
|
|
662
1183
|
```
|
|
663
1184
|
|
|
664
1185
|
### Context Staleness Rule
|
|
@@ -795,6 +1316,118 @@ FOR UI CHANGES:
|
|
|
795
1316
|
|
|
796
1317
|
---
|
|
797
1318
|
|
|
1319
|
+
## Codebase Scan Strategy
|
|
1320
|
+
|
|
1321
|
+
**Protocol for large projects, monorepos, and multi-module codebases. Choose the right scan depth.**
|
|
1322
|
+
|
|
1323
|
+
### When This Triggers
|
|
1324
|
+
|
|
1325
|
+
```
|
|
1326
|
+
TRIGGERS:
|
|
1327
|
+
- Project has > 50 files in src/
|
|
1328
|
+
- Monorepo with multiple apps/packages
|
|
1329
|
+
- Multi-module project (app/ + packages/ + shared/)
|
|
1330
|
+
- User says "new project" / "first time seeing this code"
|
|
1331
|
+
- User says "check the whole codebase" / "audit"
|
|
1332
|
+
- You don't know where to start
|
|
1333
|
+
|
|
1334
|
+
⛔ DO NOT Read every file — token waste
|
|
1335
|
+
⛔ DO NOT guess structure from folder names alone
|
|
1336
|
+
✅ Scan strategically: breadth first, depth on demand
|
|
1337
|
+
```
|
|
1338
|
+
|
|
1339
|
+
### Scan Levels
|
|
1340
|
+
|
|
1341
|
+
```
|
|
1342
|
+
LEVEL 1: QUICK SCAN (~5 reads) — for focused tasks
|
|
1343
|
+
┌─────────────────────────────────────────────────────────┐
|
|
1344
|
+
│ 1. ls src/ (or app/ or lib/) → map top-level folders │
|
|
1345
|
+
│ 2. Read package.json / pubspec.yaml → deps + scripts │
|
|
1346
|
+
│ 3. Read 1 config file (tsconfig / eslint / analysis) │
|
|
1347
|
+
│ 4. Read CLAUDE.md / README.md (if exists) │
|
|
1348
|
+
│ 5. Glob "**/*[feature_name]*" → find target files │
|
|
1349
|
+
│ │
|
|
1350
|
+
│ USE WHEN: Task is focused (fix bug, add to existing) │
|
|
1351
|
+
└─────────────────────────────────────────────────────────┘
|
|
1352
|
+
|
|
1353
|
+
LEVEL 2: STANDARD SCAN (~15 reads) — for new features
|
|
1354
|
+
┌─────────────────────────────────────────────────────────┐
|
|
1355
|
+
│ Everything in Level 1 PLUS: │
|
|
1356
|
+
│ 6. ls each top-level src/ subfolder → map full tree │
|
|
1357
|
+
│ 7. Read 1 screen file (UI pattern) │
|
|
1358
|
+
│ 8. Read 1 service/api file (data pattern) │
|
|
1359
|
+
│ 9. Read 1 hook/viewmodel file (state pattern) │
|
|
1360
|
+
│ 10. Read 1 store/slice file (state management) │
|
|
1361
|
+
│ 11. Read navigation/router config │
|
|
1362
|
+
│ 12. Read .env.example (if exists) → API endpoints │
|
|
1363
|
+
│ 13. Grep "TODO\|FIXME\|HACK" src/ → known issues │
|
|
1364
|
+
│ 14. Read types/models directory → data shapes │
|
|
1365
|
+
│ 15. Read test file (if exists) → testing patterns │
|
|
1366
|
+
│ │
|
|
1367
|
+
│ USE WHEN: Building new feature, need full context │
|
|
1368
|
+
└─────────────────────────────────────────────────────────┘
|
|
1369
|
+
|
|
1370
|
+
LEVEL 3: DEEP SCAN (~30+ reads) — for audits & architecture
|
|
1371
|
+
┌─────────────────────────────────────────────────────────┐
|
|
1372
|
+
│ Everything in Level 2 PLUS: │
|
|
1373
|
+
│ 16. Read ALL screen/page files (list them all) │
|
|
1374
|
+
│ 17. Read ALL service/api files │
|
|
1375
|
+
│ 18. Read ALL store/state files │
|
|
1376
|
+
│ 19. Map dependency graph: who imports whom │
|
|
1377
|
+
│ 20. Check circular imports │
|
|
1378
|
+
│ 21. Read native config (ios/Info.plist, AndroidManifest)│
|
|
1379
|
+
│ 22. Read CI/CD config (if exists) │
|
|
1380
|
+
│ 23. Read ALL test files │
|
|
1381
|
+
│ 24. Grep for security issues (hardcoded keys, tokens) │
|
|
1382
|
+
│ 25+. Read shared/common components │
|
|
1383
|
+
│ │
|
|
1384
|
+
│ USE WHEN: Full audit, architecture review, migration │
|
|
1385
|
+
└─────────────────────────────────────────────────────────┘
|
|
1386
|
+
```
|
|
1387
|
+
|
|
1388
|
+
### Monorepo Strategy
|
|
1389
|
+
|
|
1390
|
+
```
|
|
1391
|
+
MONOREPO DETECTED WHEN:
|
|
1392
|
+
→ Root has packages/ or apps/ or modules/ or workspaces in package.json
|
|
1393
|
+
→ Multiple package.json files at different levels
|
|
1394
|
+
→ lerna.json / nx.json / turbo.json exists
|
|
1395
|
+
|
|
1396
|
+
SCAN PROTOCOL FOR MONOREPOS:
|
|
1397
|
+
1. READ ROOT: package.json → workspaces field → list all packages
|
|
1398
|
+
2. MAP PACKAGES: ls packages/ (or apps/) → list each package
|
|
1399
|
+
3. IDENTIFY TARGET: Which package does the user's task affect?
|
|
1400
|
+
4. FOCUS: Scan ONLY the target package at Level 2
|
|
1401
|
+
5. SHARED: Also scan shared packages that target imports
|
|
1402
|
+
→ Grep "from ['\"](../../packages|@monorepo)" in target package
|
|
1403
|
+
6. IGNORE: Other packages unless explicitly asked
|
|
1404
|
+
|
|
1405
|
+
⛔ NEVER scan the entire monorepo — scan the target package
|
|
1406
|
+
✅ Treat each package as its own project with its own scan
|
|
1407
|
+
```
|
|
1408
|
+
|
|
1409
|
+
### Multi-Module Strategy (React Native + Native)
|
|
1410
|
+
|
|
1411
|
+
```
|
|
1412
|
+
MULTI-MODULE DETECTED WHEN:
|
|
1413
|
+
→ Project has src/ (JS/TS) + ios/ + android/ folders
|
|
1414
|
+
→ Native modules exist (react-native.config.js or manual linking)
|
|
1415
|
+
→ Custom native code beyond standard template
|
|
1416
|
+
|
|
1417
|
+
SCAN PROTOCOL:
|
|
1418
|
+
1. IDENTIFY LAYER: Is the task JS/TS-only or involves native?
|
|
1419
|
+
2. JS/TS TASK → Scan src/ only (Level 1 or 2)
|
|
1420
|
+
3. NATIVE TASK → Also scan:
|
|
1421
|
+
→ ios/[AppName]/ → Swift/ObjC source files
|
|
1422
|
+
→ android/app/src/main/java/ → Kotlin/Java source files
|
|
1423
|
+
→ Check bridging: ios/[AppName]-Bridging-Header.h
|
|
1424
|
+
→ Check native modules: Grep "RCT_EXPORT_MODULE" or "@ReactMethod"
|
|
1425
|
+
4. CROSS-LAYER TASK (JS calls native) → Scan both layers
|
|
1426
|
+
→ Find the bridge: NativeModules.X in JS → X module in native
|
|
1427
|
+
```
|
|
1428
|
+
|
|
1429
|
+
---
|
|
1430
|
+
|
|
798
1431
|
## Smart Loading
|
|
799
1432
|
|
|
800
1433
|
**After auto-detect, use the Read tool to open ONLY relevant files.**
|
|
@@ -818,6 +1451,17 @@ FOR UI CHANGES:
|
|
|
818
1451
|
| All platforms | `shared/platform-excellence.md` | 🟡 Task Router says so |
|
|
819
1452
|
| All platforms | `shared/version-management.md` | 🟡 Task Router says so |
|
|
820
1453
|
| All platforms | `shared/observability.md` | 🟡 Task Router says so |
|
|
1454
|
+
| All platforms | `shared/storage-patterns.md` | 🟡 Task Router says so |
|
|
1455
|
+
| All platforms | `shared/i18n-localization.md` | 🟡 Task Router says so |
|
|
1456
|
+
| All platforms | `shared/debugging-intelligence.md` | 🟡 Complex bugs / stack traces / issue investigation |
|
|
1457
|
+
| All platforms | `shared/intent-analysis.md` | 🟡 Multi-part, vague, non-technical, or ambiguous input |
|
|
1458
|
+
| All platforms | `shared/code-generation-templates.md` | 🟡 State management, API client, forms setup |
|
|
1459
|
+
| All platforms | `shared/spec-to-code.md` | 🟡 Building feature from spec/requirements |
|
|
1460
|
+
| All platforms | `shared/navigation-patterns.md` | 🟡 Auth flow, deep links, modals, tabs, permissions |
|
|
1461
|
+
| All platforms | `shared/complex-ui-patterns.md` | 🟡 Carousel, gestures, responsive, dark mode, a11y |
|
|
1462
|
+
| All platforms | `shared/data-flow-patterns.md` | 🟡 Pagination, optimistic updates, cache, WebSocket |
|
|
1463
|
+
| All platforms | `shared/error-handling.md` | 🟡 Error hierarchy, retry, error boundary, toast |
|
|
1464
|
+
| All platforms | `shared/testing-patterns.md` | 🟡 Component tests, hook tests, factories, snapshots |
|
|
821
1465
|
|
|
822
1466
|
**Cross-platform:** Flutter/RN projects also Read `ios/ios-native.md` + `android/android-native.md` for native modules.
|
|
823
1467
|
|
|
@@ -899,19 +1543,80 @@ RULE 6: NO PHANTOM PACKAGES
|
|
|
899
1543
|
### When Fixing Bugs
|
|
900
1544
|
|
|
901
1545
|
```
|
|
902
|
-
GROUNDED BUG FIX PROTOCOL:
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
1546
|
+
GROUNDED BUG FIX PROTOCOL (NON-NEGOTIABLE):
|
|
1547
|
+
|
|
1548
|
+
⛔ BEFORE YOU SAY ANYTHING — SEARCH THE PROJECT FIRST:
|
|
1549
|
+
|
|
1550
|
+
STEP 0: EXTRACT KEYWORDS + CHECK GIT (mandatory)
|
|
1551
|
+
→ Parse error message for: file name, function name, class name, module name, line number
|
|
1552
|
+
→ If error says "Cannot find X" → Grep for "X" in src/
|
|
1553
|
+
→ If error says "TypeError in Y" → Grep for "Y" in src/
|
|
1554
|
+
→ If error says "Module not found: Z" → Grep for "Z" in package.json AND src/
|
|
1555
|
+
→ CHECK RECENT CHANGES (if git project):
|
|
1556
|
+
→ First: git rev-parse --is-inside-work-tree 2>/dev/null
|
|
1557
|
+
→ If NOT git / no commits → skip git check → go to Step 1
|
|
1558
|
+
→ If git: git log --oneline -5 + git diff HEAD~3 --name-only
|
|
1559
|
+
→ If broken file was recently changed → read that diff FIRST
|
|
1560
|
+
→ 80%+ of bugs are caused by recent changes
|
|
1561
|
+
|
|
1562
|
+
STEP 1: SEARCH PROJECT SOURCE (mandatory — NEVER skip)
|
|
1563
|
+
→ Grep: search error keywords in src/ directory FIRST
|
|
1564
|
+
→ Glob: find related files by pattern (*.ts, *.tsx, *.dart, *.swift, *.kt)
|
|
1565
|
+
→ Read: open the TOP 3-5 most relevant matched files
|
|
1566
|
+
→ If no match in src/ → search in lib/, app/, packages/, modules/
|
|
1567
|
+
→ If STILL no match → expand to project root
|
|
1568
|
+
|
|
1569
|
+
STEP 2: READ & UNDERSTAND actual code
|
|
1570
|
+
→ Read the file(s) found in Step 1
|
|
1571
|
+
→ Trace the data flow: what calls this? what does it return?
|
|
1572
|
+
→ Check imports, types, interfaces IN THE PROJECT
|
|
1573
|
+
→ Check package.json / pubspec.yaml for dependency versions
|
|
1574
|
+
|
|
1575
|
+
STEP 3: FIND ROOT CAUSE in project code
|
|
1576
|
+
→ Cite exact file:line where the bug originates
|
|
1577
|
+
→ Explain WHY it fails based on the actual code you just read
|
|
1578
|
+
|
|
1579
|
+
STEP 4: FIND WORKING EXAMPLE (before fixing)
|
|
1580
|
+
→ Search SAME project for similar code that WORKS
|
|
1581
|
+
→ Compare broken code vs working code → list differences
|
|
1582
|
+
→ The fix should make broken code match the working pattern
|
|
1583
|
+
→ If no working example → proceed to Step 5
|
|
1584
|
+
|
|
1585
|
+
STEP 5: SINGLE HYPOTHESIS FIX
|
|
1586
|
+
→ Form ONE hypothesis from root cause
|
|
1587
|
+
→ Make the SMALLEST possible change
|
|
1588
|
+
→ ⛔ NEVER stack multiple fixes at once
|
|
1589
|
+
→ ⛔ NEVER "fix it and also refactor nearby code"
|
|
1590
|
+
→ Verify: does this fix ALL symptoms?
|
|
1591
|
+
→ If no → REVERT → new hypothesis (don't carry failed fixes forward)
|
|
1592
|
+
|
|
1593
|
+
STEP 6: DEFENSE IN DEPTH (after fix verified)
|
|
1594
|
+
→ Add validation at every layer data passes through
|
|
1595
|
+
→ Make the bug structurally impossible to recur
|
|
1596
|
+
→ Grep for side effects (other files using this function)
|
|
1597
|
+
|
|
1598
|
+
STEP 7: CITE source with evidence
|
|
1599
|
+
→ "Root cause: [file]:[line] — [what's wrong] — [traced from Step 2-3]"
|
|
1600
|
+
→ "Working example: [file]:[line] — [how it works correctly]"
|
|
1601
|
+
→ "Fix: [change] — [why it works] — [defense added at layers X, Y]"
|
|
1602
|
+
|
|
1603
|
+
⛔ HARD VIOLATIONS (auto-fail):
|
|
1604
|
+
- Suggesting a fix WITHOUT first running Grep/Glob on the project
|
|
912
1605
|
- "The error is probably because..." (guess without reading code)
|
|
913
1606
|
- "Try changing X to Y" (without reading the file first)
|
|
914
1607
|
- "This should fix it" (without verifying types match)
|
|
1608
|
+
- Suggesting generic Stack Overflow solutions without checking project context
|
|
1609
|
+
- Jumping to package.json/config fixes before checking src/ code
|
|
1610
|
+
- Stacking 3+ changes at once (1 hypothesis → 1 change → verify)
|
|
1611
|
+
- Claiming "done" without fresh verification evidence
|
|
1612
|
+
- "Should work now" / "I'm confident" without running/reading output
|
|
1613
|
+
|
|
1614
|
+
🚩 ANTI-RATIONALIZATION (catch yourself):
|
|
1615
|
+
"Should work now" → You didn't verify. RUN IT.
|
|
1616
|
+
"I'm confident this fixes" → Confidence ≠ evidence. PROVE IT.
|
|
1617
|
+
"Probably a race condition" → Buzzword. TRACE the async flow.
|
|
1618
|
+
"Let me also clean up..." → STOP. Fix the bug only.
|
|
1619
|
+
Same fix 3+ times → Architecture problem. STOP & rethink.
|
|
915
1620
|
```
|
|
916
1621
|
|
|
917
1622
|
### Anti-Hallucination Checklist (run before EVERY response)
|
|
@@ -1527,6 +2232,9 @@ skill-mobile-mt/
|
|
|
1527
2232
|
├── platform-excellence.md ← 🟡 iOS 18+ vs Android 15+ guidelines
|
|
1528
2233
|
├── version-management.md ← 🟡 SDK compatibility matrix
|
|
1529
2234
|
├── observability.md ← 🟡 Sessions as 4th pillar
|
|
2235
|
+
├── offline-first.md ← 🟢 Local-first + sync patterns
|
|
2236
|
+
├── storage-patterns.md ← 🟡 MMKV / SecureStore / SQLite / WatermelonDB / Keychain
|
|
2237
|
+
├── i18n-localization.md ← 🟡 i18next / slang / .xcstrings / strings.xml / RTL
|
|
1530
2238
|
│
|
|
1531
|
-
└──
|
|
2239
|
+
└── debugging-intelligence.md ← 🟡 30+ error patterns + search strategies + issue investigation
|
|
1532
2240
|
```
|