mobile-best-practices 1.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.
- package/README.md +64 -0
- package/assets/data/anti-patterns.csv +114 -0
- package/assets/data/architectures.csv +50 -0
- package/assets/data/code-snippets.csv +80 -0
- package/assets/data/gradle-deps.csv +79 -0
- package/assets/data/libraries.csv +102 -0
- package/assets/data/performance.csv +229 -0
- package/assets/data/platforms/android.csv +247 -0
- package/assets/data/platforms/flutter.csv +55 -0
- package/assets/data/platforms/ios.csv +61 -0
- package/assets/data/platforms/react-native.csv +56 -0
- package/assets/data/project-templates.csv +19 -0
- package/assets/data/reasoning-rules.csv +57 -0
- package/assets/data/security.csv +438 -0
- package/assets/data/testing.csv +74 -0
- package/assets/data/ui-patterns.csv +92 -0
- package/assets/references/CHECKLIST.md +49 -0
- package/assets/references/CODE-RULES.md +123 -0
- package/assets/scripts/__pycache__/core.cpython-314.pyc +0 -0
- package/assets/scripts/core.py +432 -0
- package/assets/scripts/search.py +104 -0
- package/assets/skills/all.md +245 -0
- package/assets/skills/android.md +168 -0
- package/assets/skills/flutter.md +153 -0
- package/assets/skills/ios.md +149 -0
- package/assets/skills/react-native.md +154 -0
- package/assets/templates/base/quick-reference.md +41 -0
- package/assets/templates/base/skill-content.md +60 -0
- package/assets/templates/platforms/agent.json +11 -0
- package/assets/templates/platforms/antigravity.json +13 -0
- package/assets/templates/platforms/claude.json +27 -0
- package/assets/templates/platforms/codebuddy.json +11 -0
- package/assets/templates/platforms/codex.json +11 -0
- package/assets/templates/platforms/continue.json +11 -0
- package/assets/templates/platforms/copilot.json +11 -0
- package/assets/templates/platforms/cursor.json +11 -0
- package/assets/templates/platforms/gemini.json +11 -0
- package/assets/templates/platforms/kiro.json +11 -0
- package/assets/templates/platforms/opencode.json +11 -0
- package/assets/templates/platforms/qoder.json +11 -0
- package/assets/templates/platforms/roocode.json +11 -0
- package/assets/templates/platforms/trae.json +11 -0
- package/assets/templates/platforms/windsurf.json +11 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +94 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +28 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/versions.d.ts +2 -0
- package/dist/commands/versions.d.ts.map +1 -0
- package/dist/commands/versions.js +30 -0
- package/dist/commands/versions.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +23 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +24 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +103 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mobile-best-practices
|
|
3
|
+
description: "Mobile development intelligence for Android, iOS, Flutter, and React Native. 1,738 searchable entries: 49 architecture patterns, 91 UI patterns, 113 anti-patterns, 101 libraries, 228 performance rules, 437 security practices, 73 testing patterns, 56 reasoning rules, 18 project templates, 415 platform-specific guidelines, 79 copy-paste code snippets, and 78 Gradle dependency declarations. Use when building, reviewing, fixing, or optimizing mobile apps. Covers MVVM, MVI, VIPER, TCA, BLoC, Clean Architecture, state management, navigation, DI, networking, database, testing, security, performance, accessibility, Material3, Gradle version catalog."
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires Python 3.x for BM25 search. Works with Claude Code and other skills-compatible agents.
|
|
6
|
+
metadata:
|
|
7
|
+
author: tungnk123
|
|
8
|
+
version: "1.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Mobile Best Practices - Development Intelligence
|
|
12
|
+
|
|
13
|
+
Searchable database of **1,738 mobile development best practices** covering architecture patterns, UI components, anti-patterns, libraries, performance rules, security practices, testing patterns, code snippets, Gradle dependencies, and platform-specific guidelines for Android, iOS, Flutter, and React Native.
|
|
14
|
+
|
|
15
|
+
**Android-first**: Optimized for Android/Jetpack Compose with full copy-paste code snippets and ready-to-use Gradle declarations.
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
Check if Python is installed:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
python3 --version || python --version
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
If Python is not installed, install it based on user's OS:
|
|
26
|
+
|
|
27
|
+
**macOS:**
|
|
28
|
+
```bash
|
|
29
|
+
brew install python3
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Ubuntu/Debian:**
|
|
33
|
+
```bash
|
|
34
|
+
sudo apt update && sudo apt install python3
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Windows:**
|
|
38
|
+
```powershell
|
|
39
|
+
winget install Python.Python.3.12
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## How to Use This Skill
|
|
45
|
+
|
|
46
|
+
When user requests mobile development work (build, create, architect, review, fix, optimize), follow this workflow:
|
|
47
|
+
|
|
48
|
+
### Step 1: Detect Platform (Default: Android)
|
|
49
|
+
|
|
50
|
+
If user doesn't specify a platform, **default to Android with Jetpack Compose**. Extract:
|
|
51
|
+
- **Platform**: Android (default), iOS, Flutter, React Native
|
|
52
|
+
- **Product type**: E-commerce, Banking, Social Media, Healthcare, Delivery, Fitness, Education, Chat
|
|
53
|
+
- **Scope**: New project, new feature, code review, refactor, fix bug, optimize
|
|
54
|
+
|
|
55
|
+
### Step 2: Search the Database
|
|
56
|
+
|
|
57
|
+
Use `search.py` to gather comprehensive information. Run multiple searches across domains.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Basic domain search
|
|
61
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "<keyword>" --domain <domain> [-n <max_results>]
|
|
62
|
+
|
|
63
|
+
# Platform-specific guidelines
|
|
64
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "<keyword>" --platform android
|
|
65
|
+
|
|
66
|
+
# Filter any domain by platform
|
|
67
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "<keyword>" --domain library --filter-platform android
|
|
68
|
+
|
|
69
|
+
# Get code snippets (Android copy-paste templates)
|
|
70
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "viewmodel hilt" --domain snippet
|
|
71
|
+
|
|
72
|
+
# Get Gradle dependencies
|
|
73
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "compose room hilt" --domain gradle
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Step 3: Android-First Workflow (Recommended Order)
|
|
77
|
+
|
|
78
|
+
For Android projects, search in this order:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# 1. Get code snippet for what you're building
|
|
82
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "viewmodel repository" --domain snippet -n 3
|
|
83
|
+
|
|
84
|
+
# 2. Get Gradle dependencies needed
|
|
85
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "hilt room retrofit" --domain gradle -n 5
|
|
86
|
+
|
|
87
|
+
# 3. Get Android-specific best practices
|
|
88
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "compose state hilt" --platform android -n 5
|
|
89
|
+
|
|
90
|
+
# 4. Check anti-patterns to avoid
|
|
91
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "android compose" --domain antipattern
|
|
92
|
+
|
|
93
|
+
# 5. Get architecture guidance
|
|
94
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "mvvm clean architecture" --domain architecture
|
|
95
|
+
|
|
96
|
+
# 6. Check performance rules
|
|
97
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "compose recomposition lazy" --domain performance
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Step 4: Generate Code
|
|
101
|
+
|
|
102
|
+
Use snippet results as starting templates. Customize for user's specific needs. Always follow the code generation rules below.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Search Reference
|
|
107
|
+
|
|
108
|
+
### Available Domains (11 total)
|
|
109
|
+
|
|
110
|
+
| Domain | Use For | Example Keywords |
|
|
111
|
+
|--------|---------|------------------|
|
|
112
|
+
| `snippet` | **Copy-paste code templates (Android)** | viewmodel, repository, room setup, hilt module, compose screen, navigation, paging, datastore |
|
|
113
|
+
| `gradle` | **Ready-to-paste Gradle dependencies** | compose bom, hilt, room, retrofit, coil, navigation, testing, paging |
|
|
114
|
+
| `reasoning` | Product type recommendations | e-commerce, banking, social media, healthcare, delivery |
|
|
115
|
+
| `architecture` | Architecture patterns | mvvm, clean architecture, bloc, viper, redux, mvi |
|
|
116
|
+
| `library` | Libraries & dependencies | retrofit, hilt, coil, kingfisher, dio, bloc, redux |
|
|
117
|
+
| `ui` | UI patterns & components | bottom navigation, list, bottom sheet, pull refresh |
|
|
118
|
+
| `antipattern` | Common mistakes | god activity, memory leak, prop drilling, setState |
|
|
119
|
+
| `performance` | Performance optimization | startup, recomposition, memory, battery, list, image |
|
|
120
|
+
| `security` | Security best practices | encryption, keychain, ssl pinning, token, biometric |
|
|
121
|
+
| `testing` | Testing patterns | unit test, ui test, bloc test, snapshot, mocking |
|
|
122
|
+
| `template` | Project templates/starters | e-commerce android, banking ios, delivery flutter |
|
|
123
|
+
|
|
124
|
+
### Available Platforms
|
|
125
|
+
|
|
126
|
+
| Platform | Guidelines | Focus |
|
|
127
|
+
|----------|-----------|-------|
|
|
128
|
+
| `android` | 246 | Jetpack Compose, Material3, Coroutines, Hilt, Room, Navigation, Gradle |
|
|
129
|
+
| `ios` | 60 | SwiftUI, Combine, async/await, Actors, NavigationStack, SwiftData |
|
|
130
|
+
| `flutter` | 54 | Widgets, BLoC/Riverpod, Dart 3, GoRouter, Slivers, Freezed |
|
|
131
|
+
| `react-native` | 55 | Hooks, React Navigation, Reanimated, FlatList, Zustand, Expo |
|
|
132
|
+
|
|
133
|
+
### Flags
|
|
134
|
+
|
|
135
|
+
| Flag | Description | Example |
|
|
136
|
+
|------|-------------|---------|
|
|
137
|
+
| `--domain` / `-d` | Search a specific domain | `--domain snippet` |
|
|
138
|
+
| `--platform` / `-p` | Search platform guidelines | `--platform android` |
|
|
139
|
+
| `--filter-platform` / `-fp` | Filter any domain by platform | `--domain library --filter-platform android` |
|
|
140
|
+
| `--max-results` / `-n` | Number of results (default: 3) | `-n 5` |
|
|
141
|
+
| `--json` | Output as JSON | `--json` |
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Example Workflows
|
|
146
|
+
|
|
147
|
+
### New Android Feature: "Add a product list screen"
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# 1. Get ViewModel + Screen code templates
|
|
151
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "viewmodel compose screen" --domain snippet -n 3
|
|
152
|
+
|
|
153
|
+
# 2. Get Gradle deps for image loading and paging
|
|
154
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "coil paging compose" --domain gradle -n 5
|
|
155
|
+
|
|
156
|
+
# 3. Get LazyColumn and image best practices
|
|
157
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "lazy list image performance" --platform android -n 3
|
|
158
|
+
|
|
159
|
+
# 4. Get UI patterns for product list
|
|
160
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "product list card" --domain ui
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### New Android Project: "Build an e-commerce app"
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# 1. Get full product-type recommendation
|
|
167
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "e-commerce" --domain reasoning
|
|
168
|
+
|
|
169
|
+
# 2. Get architecture details
|
|
170
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "mvvm clean architecture android" --domain architecture
|
|
171
|
+
|
|
172
|
+
# 3. Get ALL code templates
|
|
173
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "viewmodel repository hilt" --domain snippet -n 5
|
|
174
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "room navigation theme" --domain snippet -n 5
|
|
175
|
+
|
|
176
|
+
# 4. Get ALL Gradle dependencies
|
|
177
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "compose hilt room retrofit" --domain gradle -n 10
|
|
178
|
+
|
|
179
|
+
# 5. Get anti-patterns and performance
|
|
180
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "android architecture" --domain antipattern
|
|
181
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "compose startup image" --domain performance
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Code Review: "Review my Android code"
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# 1. Check for anti-patterns
|
|
188
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "android compose viewmodel" --domain antipattern -n 5
|
|
189
|
+
|
|
190
|
+
# 2. Check Compose best practices
|
|
191
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "state recomposition lifecycle" --platform android -n 5
|
|
192
|
+
|
|
193
|
+
# 3. Check performance
|
|
194
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "compose lazy image startup" --domain performance
|
|
195
|
+
|
|
196
|
+
# 4. Check security
|
|
197
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "android storage encryption api key" --domain security
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Gradle Setup: "What dependencies do I need?"
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# Get all core Android dependencies
|
|
204
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "compose material3 bom" --domain gradle -n 5
|
|
205
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "hilt room retrofit" --domain gradle -n 5
|
|
206
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "navigation coil paging" --domain gradle -n 5
|
|
207
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "testing junit mockk turbine" --domain gradle -n 5
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Cross-Platform: "Compare architectures for banking iOS app"
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
# 1. Get reasoning-based recommendation
|
|
214
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "banking" --domain reasoning
|
|
215
|
+
|
|
216
|
+
# 2. Compare architectures
|
|
217
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "viper tca mvvm ios" --domain architecture
|
|
218
|
+
|
|
219
|
+
# 3. Get security for banking
|
|
220
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "banking encryption biometric" --domain security
|
|
221
|
+
|
|
222
|
+
# 4. iOS-specific practices
|
|
223
|
+
python3 .claude/skills/mobile-best-practices/scripts/search.py "keychain security architecture" --platform ios
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Tips for Better Results
|
|
229
|
+
|
|
230
|
+
1. **Start with snippets** - For Android, search `snippet` domain first for ready-to-use code templates
|
|
231
|
+
2. **Get Gradle deps early** - Search `gradle` domain to know exact dependency declarations
|
|
232
|
+
3. **Be specific with keywords** - "android mvvm compose hilt" > "architecture"
|
|
233
|
+
4. **Search multiple domains** - Snippet + Gradle + Platform + Anti-pattern = Complete picture
|
|
234
|
+
5. **Use --filter-platform** - Filter library/antipattern/performance results for your platform
|
|
235
|
+
6. **Always check anti-patterns** - Prevent common mistakes before they happen
|
|
236
|
+
7. **Check platform guidelines** - Platform-specific practices catch issues generic advice misses
|
|
237
|
+
8. **Use -n 5 for more results** - Default is 3, increase for broader coverage
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Code Generation & Quality
|
|
242
|
+
|
|
243
|
+
Before generating code, read the [code generation rules](references/CODE-RULES.md) for platform-specific conventions, required patterns, and anti-patterns to avoid.
|
|
244
|
+
|
|
245
|
+
Before delivering code, verify against the [pre-delivery checklist](references/CHECKLIST.md) covering architecture, Compose, Gradle, performance, security, testing, and accessibility.
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mobile-best-practices
|
|
3
|
+
description: "Android development intelligence with Jetpack Compose. 1,738 searchable entries including 79 code snippets, 78 Gradle declarations, 246 Android-specific guidelines. Default stack: MVVM + Hilt + Room + Retrofit + Coil + Navigation Compose + Material3. Use when building, reviewing, fixing, or optimizing Android apps. Covers architecture patterns, UI components, anti-patterns, performance, security, and testing."
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires Python 3.x for BM25 search. Works with Claude Code and other skills-compatible agents.
|
|
6
|
+
metadata:
|
|
7
|
+
author: tungnk123
|
|
8
|
+
version: "1.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Android Best Practices - Jetpack Compose Development Intelligence
|
|
12
|
+
|
|
13
|
+
Searchable database of **1,738 mobile best practices**, **optimized for Android with Jetpack Compose**. All searches default to Android platform. Includes copy-paste code snippets and ready-to-use Gradle dependency declarations.
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
python3 --version || python --version
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
If not installed: `brew install python3` (macOS) | `sudo apt install python3` (Linux) | `winget install Python.Python.3.12` (Windows)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## How to Use This Skill
|
|
26
|
+
|
|
27
|
+
When user requests Android development work (build, create, architect, review, fix, optimize), follow this workflow:
|
|
28
|
+
|
|
29
|
+
### Step 1: Extract Requirements
|
|
30
|
+
|
|
31
|
+
No need to detect platform - **always Android with Jetpack Compose**. Extract:
|
|
32
|
+
- **Product type**: E-commerce, Banking, Social Media, Healthcare, Delivery, Fitness, Education, Chat
|
|
33
|
+
- **Scope**: New project, new feature, code review, refactor, fix bug, optimize
|
|
34
|
+
|
|
35
|
+
### Step 2: Search the Database
|
|
36
|
+
|
|
37
|
+
Use `search.py` with `--platform android` or `--stack compose` for focused results.
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Android platform guidelines (ALWAYS search this first)
|
|
41
|
+
python3 {SKILL_PATH}/scripts/search.py "<keyword>" --platform android -n 5
|
|
42
|
+
|
|
43
|
+
# Code snippets (copy-paste Kotlin/Compose templates)
|
|
44
|
+
python3 {SKILL_PATH}/scripts/search.py "<keyword>" --domain snippet -n 3
|
|
45
|
+
|
|
46
|
+
# Gradle dependencies (ready-to-paste declarations)
|
|
47
|
+
python3 {SKILL_PATH}/scripts/search.py "<keyword>" --domain gradle -n 5
|
|
48
|
+
|
|
49
|
+
# Architecture patterns
|
|
50
|
+
python3 {SKILL_PATH}/scripts/search.py "<keyword>" --domain architecture
|
|
51
|
+
|
|
52
|
+
# Anti-patterns filtered for Android
|
|
53
|
+
python3 {SKILL_PATH}/scripts/search.py "<keyword>" --domain antipattern --filter-platform android
|
|
54
|
+
|
|
55
|
+
# Performance rules filtered for Android
|
|
56
|
+
python3 {SKILL_PATH}/scripts/search.py "<keyword>" --domain performance --filter-platform android
|
|
57
|
+
|
|
58
|
+
# Stack-specific search
|
|
59
|
+
python3 {SKILL_PATH}/scripts/search.py "<keyword>" --stack compose
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Step 3: Recommended Search Order for Android
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# 1. Get code snippet for what you're building
|
|
66
|
+
python3 {SKILL_PATH}/scripts/search.py "viewmodel repository" --domain snippet -n 3
|
|
67
|
+
|
|
68
|
+
# 2. Get Gradle dependencies needed
|
|
69
|
+
python3 {SKILL_PATH}/scripts/search.py "hilt room retrofit" --domain gradle -n 5
|
|
70
|
+
|
|
71
|
+
# 3. Get Android-specific best practices
|
|
72
|
+
python3 {SKILL_PATH}/scripts/search.py "compose state hilt" --platform android -n 5
|
|
73
|
+
|
|
74
|
+
# 4. Check anti-patterns to avoid
|
|
75
|
+
python3 {SKILL_PATH}/scripts/search.py "android compose" --domain antipattern --filter-platform android
|
|
76
|
+
|
|
77
|
+
# 5. Get architecture guidance
|
|
78
|
+
python3 {SKILL_PATH}/scripts/search.py "mvvm clean architecture" --domain architecture
|
|
79
|
+
|
|
80
|
+
# 6. Check performance rules
|
|
81
|
+
python3 {SKILL_PATH}/scripts/search.py "compose recomposition lazy" --domain performance --filter-platform android
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Step 4: Generate Code
|
|
85
|
+
|
|
86
|
+
Use snippet results as starting templates. Customize for user's needs. Follow the code generation rules below.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Search Reference
|
|
91
|
+
|
|
92
|
+
### Available Domains (11 total)
|
|
93
|
+
|
|
94
|
+
| Domain | Use For | Example Keywords |
|
|
95
|
+
|--------|---------|------------------|
|
|
96
|
+
| `snippet` | **Copy-paste Kotlin/Compose templates** | viewmodel, repository, room setup, hilt module, compose screen, navigation, paging, datastore |
|
|
97
|
+
| `gradle` | **Ready-to-paste Gradle dependencies** | compose bom, hilt, room, retrofit, coil, navigation, testing, paging |
|
|
98
|
+
| `reasoning` | Product type recommendations | e-commerce, banking, social media, healthcare, delivery |
|
|
99
|
+
| `architecture` | Architecture patterns | mvvm, clean architecture, mvi |
|
|
100
|
+
| `library` | Libraries & dependencies | retrofit, hilt, coil, room, okhttp, moshi |
|
|
101
|
+
| `ui` | UI patterns & components | bottom navigation, list, bottom sheet, pull refresh |
|
|
102
|
+
| `antipattern` | Common mistakes | god activity, memory leak, recomposition |
|
|
103
|
+
| `performance` | Performance optimization | startup, recomposition, memory, battery, image |
|
|
104
|
+
| `security` | Security best practices | encryption, keystore, ssl pinning, biometric |
|
|
105
|
+
| `testing` | Testing patterns | unit test, compose test, mockk, turbine |
|
|
106
|
+
| `template` | Project templates/starters | e-commerce android, banking android |
|
|
107
|
+
|
|
108
|
+
### Flags
|
|
109
|
+
|
|
110
|
+
| Flag | Description | Example |
|
|
111
|
+
|------|-------------|---------|
|
|
112
|
+
| `--domain` / `-d` | Search a specific domain | `--domain snippet` |
|
|
113
|
+
| `--platform` / `-p` | Platform guidelines | `--platform android` |
|
|
114
|
+
| `--filter-platform` / `-fp` | Filter results by platform | `--domain library --filter-platform android` |
|
|
115
|
+
| `--stack` / `-s` | Stack-specific search | `--stack compose` |
|
|
116
|
+
| `--max-results` / `-n` | Number of results (default: 3) | `-n 5` |
|
|
117
|
+
| `--json` | Output as JSON | `--json` |
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Example Workflows
|
|
122
|
+
|
|
123
|
+
### New Feature: "Add a product list screen"
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
python3 {SKILL_PATH}/scripts/search.py "viewmodel compose screen" --domain snippet -n 3
|
|
127
|
+
python3 {SKILL_PATH}/scripts/search.py "coil paging compose" --domain gradle -n 5
|
|
128
|
+
python3 {SKILL_PATH}/scripts/search.py "lazy list image performance" --platform android -n 3
|
|
129
|
+
python3 {SKILL_PATH}/scripts/search.py "product list card" --domain ui --filter-platform android
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### New Project: "Build an e-commerce app"
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
python3 {SKILL_PATH}/scripts/search.py "e-commerce" --domain reasoning
|
|
136
|
+
python3 {SKILL_PATH}/scripts/search.py "mvvm clean architecture android" --domain architecture
|
|
137
|
+
python3 {SKILL_PATH}/scripts/search.py "viewmodel repository hilt" --domain snippet -n 5
|
|
138
|
+
python3 {SKILL_PATH}/scripts/search.py "room navigation theme" --domain snippet -n 5
|
|
139
|
+
python3 {SKILL_PATH}/scripts/search.py "compose hilt room retrofit" --domain gradle -n 10
|
|
140
|
+
python3 {SKILL_PATH}/scripts/search.py "android architecture" --domain antipattern --filter-platform android
|
|
141
|
+
python3 {SKILL_PATH}/scripts/search.py "compose startup image" --domain performance --filter-platform android
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Code Review: "Review my Android code"
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
python3 {SKILL_PATH}/scripts/search.py "android compose viewmodel" --domain antipattern -n 5
|
|
148
|
+
python3 {SKILL_PATH}/scripts/search.py "state recomposition lifecycle" --platform android -n 5
|
|
149
|
+
python3 {SKILL_PATH}/scripts/search.py "compose lazy image startup" --domain performance --filter-platform android
|
|
150
|
+
python3 {SKILL_PATH}/scripts/search.py "android storage encryption api key" --domain security --filter-platform android
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Gradle Setup: "What dependencies do I need?"
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
python3 {SKILL_PATH}/scripts/search.py "compose material3 bom" --domain gradle -n 5
|
|
157
|
+
python3 {SKILL_PATH}/scripts/search.py "hilt room retrofit" --domain gradle -n 5
|
|
158
|
+
python3 {SKILL_PATH}/scripts/search.py "navigation coil paging" --domain gradle -n 5
|
|
159
|
+
python3 {SKILL_PATH}/scripts/search.py "testing junit mockk turbine" --domain gradle -n 5
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Code Generation & Quality
|
|
165
|
+
|
|
166
|
+
Before generating code, read the [code generation rules](references/CODE-RULES.md) for Android-specific conventions, required patterns (sealed UiState, @HiltViewModel, collectAsStateWithLifecycle), and anti-patterns to avoid.
|
|
167
|
+
|
|
168
|
+
Before delivering code, verify against the [pre-delivery checklist](references/CHECKLIST.md) covering architecture, Compose, Gradle, performance, security, testing, and accessibility.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mobile-best-practices
|
|
3
|
+
description: "Flutter development intelligence with Dart. 1,738 searchable entries including 54 Flutter-specific guidelines. Default stack: BLoC/Riverpod + Dio + GoRouter + Drift + CachedNetworkImage. Use when building, reviewing, fixing, or optimizing Flutter apps. Covers architecture patterns, UI components, anti-patterns, performance, security, and testing."
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: Requires Python 3.x for BM25 search. Works with Claude Code and other skills-compatible agents.
|
|
6
|
+
metadata:
|
|
7
|
+
author: tungnk123
|
|
8
|
+
version: "1.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Flutter Best Practices - Dart Development Intelligence
|
|
12
|
+
|
|
13
|
+
Searchable database of **1,738 mobile best practices**, **optimized for Flutter with Dart**. All searches default to Flutter platform. Covers architecture, widgets, state management, performance, and testing for cross-platform Flutter apps.
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
python3 --version || python --version
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
If not installed: `brew install python3` (macOS) | `sudo apt install python3` (Linux) | `winget install Python.Python.3.12` (Windows)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## How to Use This Skill
|
|
26
|
+
|
|
27
|
+
When user requests Flutter development work (build, create, architect, review, fix, optimize), follow this workflow:
|
|
28
|
+
|
|
29
|
+
### Step 1: Extract Requirements
|
|
30
|
+
|
|
31
|
+
No need to detect platform - **always Flutter with Dart**. Extract:
|
|
32
|
+
- **Product type**: E-commerce, Banking, Social Media, Healthcare, Delivery, Fitness, Education, Chat
|
|
33
|
+
- **State management**: BLoC (default), Riverpod, Provider, GetX
|
|
34
|
+
- **Scope**: New project, new feature, code review, refactor, fix bug, optimize
|
|
35
|
+
|
|
36
|
+
### Step 2: Search the Database
|
|
37
|
+
|
|
38
|
+
Use `search.py` with `--platform flutter` or `--stack flutter` for focused results.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Flutter platform guidelines (ALWAYS search this first)
|
|
42
|
+
python3 {SKILL_PATH}/scripts/search.py "<keyword>" --platform flutter -n 5
|
|
43
|
+
|
|
44
|
+
# Stack-specific search
|
|
45
|
+
python3 {SKILL_PATH}/scripts/search.py "<keyword>" --stack bloc
|
|
46
|
+
python3 {SKILL_PATH}/scripts/search.py "<keyword>" --stack riverpod
|
|
47
|
+
|
|
48
|
+
# Architecture patterns
|
|
49
|
+
python3 {SKILL_PATH}/scripts/search.py "<keyword>" --domain architecture
|
|
50
|
+
|
|
51
|
+
# Anti-patterns filtered for Flutter
|
|
52
|
+
python3 {SKILL_PATH}/scripts/search.py "<keyword>" --domain antipattern --filter-platform flutter
|
|
53
|
+
|
|
54
|
+
# Performance rules filtered for Flutter
|
|
55
|
+
python3 {SKILL_PATH}/scripts/search.py "<keyword>" --domain performance --filter-platform flutter
|
|
56
|
+
|
|
57
|
+
# Libraries for Flutter
|
|
58
|
+
python3 {SKILL_PATH}/scripts/search.py "<keyword>" --domain library --filter-platform flutter
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Step 3: Recommended Search Order for Flutter
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# 1. Get Flutter-specific best practices
|
|
65
|
+
python3 {SKILL_PATH}/scripts/search.py "bloc state widget" --platform flutter -n 5
|
|
66
|
+
|
|
67
|
+
# 2. Get architecture guidance
|
|
68
|
+
python3 {SKILL_PATH}/scripts/search.py "bloc clean architecture flutter" --domain architecture
|
|
69
|
+
|
|
70
|
+
# 3. Get Flutter libraries
|
|
71
|
+
python3 {SKILL_PATH}/scripts/search.py "networking image state" --domain library --filter-platform flutter
|
|
72
|
+
|
|
73
|
+
# 4. Check anti-patterns to avoid
|
|
74
|
+
python3 {SKILL_PATH}/scripts/search.py "flutter widget setState" --domain antipattern --filter-platform flutter
|
|
75
|
+
|
|
76
|
+
# 5. Check performance rules
|
|
77
|
+
python3 {SKILL_PATH}/scripts/search.py "flutter widget rebuild list" --domain performance --filter-platform flutter
|
|
78
|
+
|
|
79
|
+
# 6. Check security
|
|
80
|
+
python3 {SKILL_PATH}/scripts/search.py "flutter storage encryption api" --domain security --filter-platform flutter
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Search Reference
|
|
86
|
+
|
|
87
|
+
### Available Domains (11 total)
|
|
88
|
+
|
|
89
|
+
| Domain | Use For | Example Keywords |
|
|
90
|
+
|--------|---------|------------------|
|
|
91
|
+
| `reasoning` | Product type recommendations | e-commerce, banking, social media, healthcare |
|
|
92
|
+
| `architecture` | Architecture patterns | bloc, clean architecture, riverpod, provider |
|
|
93
|
+
| `library` | Libraries & dependencies | dio, riverpod, go_router, drift, hive, freezed |
|
|
94
|
+
| `ui` | UI patterns & components | bottom navigation, list, sheet, sliver, drawer |
|
|
95
|
+
| `antipattern` | Common mistakes | setState, build method, no dispose, no const |
|
|
96
|
+
| `performance` | Performance optimization | widget rebuild, list, image, shader, startup |
|
|
97
|
+
| `security` | Security best practices | flutter_secure_storage, encryption, ssl pinning |
|
|
98
|
+
| `testing` | Testing patterns | bloc_test, widget test, integration test, mockito |
|
|
99
|
+
| `template` | Project templates/starters | e-commerce flutter, delivery flutter |
|
|
100
|
+
| `snippet` | Code templates | (cross-platform patterns available) |
|
|
101
|
+
| `gradle` | Gradle dependencies | (Android-specific, use for Android module config) |
|
|
102
|
+
|
|
103
|
+
### Flags
|
|
104
|
+
|
|
105
|
+
| Flag | Description | Example |
|
|
106
|
+
|------|-------------|---------|
|
|
107
|
+
| `--platform` / `-p` | Platform guidelines | `--platform flutter` |
|
|
108
|
+
| `--stack` / `-s` | Stack-specific search | `--stack bloc` or `--stack riverpod` |
|
|
109
|
+
| `--domain` / `-d` | Search a specific domain | `--domain architecture` |
|
|
110
|
+
| `--filter-platform` / `-fp` | Filter results by platform | `--domain library --filter-platform flutter` |
|
|
111
|
+
| `--max-results` / `-n` | Number of results (default: 3) | `-n 5` |
|
|
112
|
+
| `--json` | Output as JSON | `--json` |
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Example Workflows
|
|
117
|
+
|
|
118
|
+
### New Feature: "Add a product list screen"
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
python3 {SKILL_PATH}/scripts/search.py "list widget bloc state" --platform flutter -n 5
|
|
122
|
+
python3 {SKILL_PATH}/scripts/search.py "list card image" --domain ui --filter-platform flutter
|
|
123
|
+
python3 {SKILL_PATH}/scripts/search.py "dio cached_network_image" --domain library --filter-platform flutter
|
|
124
|
+
python3 {SKILL_PATH}/scripts/search.py "flutter list rebuild" --domain performance --filter-platform flutter
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### New Project: "Build an e-commerce app"
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
python3 {SKILL_PATH}/scripts/search.py "e-commerce" --domain reasoning
|
|
131
|
+
python3 {SKILL_PATH}/scripts/search.py "bloc clean architecture flutter" --domain architecture
|
|
132
|
+
python3 {SKILL_PATH}/scripts/search.py "dio go_router drift riverpod" --domain library --filter-platform flutter
|
|
133
|
+
python3 {SKILL_PATH}/scripts/search.py "flutter widget setState" --domain antipattern --filter-platform flutter
|
|
134
|
+
python3 {SKILL_PATH}/scripts/search.py "flutter startup image list" --domain performance --filter-platform flutter
|
|
135
|
+
python3 {SKILL_PATH}/scripts/search.py "flutter encryption storage" --domain security --filter-platform flutter
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Code Review: "Review my Flutter code"
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
python3 {SKILL_PATH}/scripts/search.py "flutter setState dispose const" --domain antipattern --filter-platform flutter -n 5
|
|
142
|
+
python3 {SKILL_PATH}/scripts/search.py "widget state lifecycle" --platform flutter -n 5
|
|
143
|
+
python3 {SKILL_PATH}/scripts/search.py "flutter rebuild image memory" --domain performance --filter-platform flutter
|
|
144
|
+
python3 {SKILL_PATH}/scripts/search.py "flutter storage encryption key" --domain security --filter-platform flutter
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Code Generation & Quality
|
|
150
|
+
|
|
151
|
+
Before generating code, read the [code generation rules](references/CODE-RULES.md) for platform-specific conventions, required patterns, and anti-patterns to avoid.
|
|
152
|
+
|
|
153
|
+
Before delivering code, verify against the [pre-delivery checklist](references/CHECKLIST.md) covering architecture, widgets, performance, security, testing, and accessibility.
|