mobile-patterns
Use when the user asks about mobile architecture patterns, MVVM vs MVI, Clean Architecture, Coordinator, repository and use case layers, dependency injection…
от j4flmao★ 47 звёзд на GitHub
Установить mobile-patterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Mobile Architecture Patterns
Purpose
Select and implement cross-platform mobile architecture patterns including MVVM, MVI, Clean Architecture, Coordinator, and Repository patterns.
Agent Protocol
Trigger
User request includes: mobile pattern, mobile architecture, mvvm, mvi, clean architecture mobile, coordinator, navigator pattern, mobile project structure, mobile folder structure, mobile di.
Input Context
- Platform (iOS, Android, Flutter, React Native)
- Architecture approach (MVVM, MVI, Clean, TCA)
- DI framework (Hilt, Swinject, GetIt, manual)
Output Artifact
A markdown document containing:
- Architecture pattern selection guide
- Folder structure matching the pattern
- Data flow diagram (text)
- Key code snippets for the chosen pattern
Response Format
No preamble. No postamble. No explanations.
Max Response Length
4096 tokens
Decision Trees
Architecture Pattern Selection
App complexity?
├── Simple CRUD, list/detail, <10 screens
│ └── MVVM + Repository (minimal abstraction, well-known)
├── Complex state (real-time, multi-step, concurrent updates)
│ └── MVI (unidirectional, predictable, sealed intents/state)
├── Large codebase, 5+ teams, shared domain logic
│ └── Clean Architecture (strict boundaries, modular)
└── Swift-only, complex state, composable
└── TCA (The Composable Architecture, SwiftUI-native)
DI Framework Selection
Platform?
├── Android
│ ├── Hilt (standard, Dagger wrapper, @HiltViewModel)
│ └── Koin (lightweight, Kotlin DSL, no annotation processing)
├── iOS
│ ├── Swinject (runtime DI, container, assembly)
│ └── Factory (Swift macros, compile-time safe)
├── Flutter
│ ├── GetIt (service locator, simple, fast)
│ └── Riverpod (declarative, auto-dispose, testable)
└── React Native
├── Module-level factories or a small container (decorator DI such as InversifyJS is rare in RN)
└── Manual context-based DI (React Context + hooks)
Navigation Pattern Selection
Navigation complexity?
├── Simple linear flow (login → home → detail)
│ └── Built-in navigation (NavigationStack, NavHost, Stack)
├── Deep linking, conditional flows, auth state
│ └── Coordinator pattern (navigation extracted from views)
├── Tab-based with nested stacks
│ └── ShellRoute (Flutter), Tab Navigator (RN)
└── Complex onboarding/wizard with branching
└── Coordinator with child coordinators
Workflow
Step 1: Identify Architecture Requirements
Assess team size, app complexity, testing requirements, and platform constraints.
Step 2: Select Core Pattern
Choose MVVM for standard apps, MVI for complex state, Clean Architecture for large multi-team codebases.
Step 3: Define Layer Boundaries
Establish dependency rules: presentation depends on domain, domain is pure business logic, data implements domain interfaces.
Step 4: Separate Navigation
Extract navigation logic into Coordinator/Navigator — views know nothing about other screens.
Step 5: Set Up Dependency Injection
Configure DI framework with explicit scopes and clear module organization per layer.
Cross-Platform Pattern Mapping
| Pattern | iOS | Android | Flutter | React Native |
|---|---|---|---|---|
| MVVM | ObservableObject + @Published | ViewModel + StateFlow | ChangeNotifier + Riverpod | useState + Zustand |
| MVI | Combine + enum Intent | MVI + StateFlow + sealed class | BLoC (Event → Bloc → State) | useReducer + dispatch |
| Clean Arch | SPM modules per layer | Gradle modules | Dart packages | Workspace packages |
| Coordinator | Coordinator protocol + child | NavHost + sealed route | GoRouter ShellRoute | React Navigation nesting |
Rules
- Domain layer must have zero framework dependencies — pure business logic only
- Data layer depends on domain layer — never the reverse
- MVVM: View observes ViewModel state; ViewModel never holds View reference
- MVI: sealed class for intents, single sealed state class, reducer function
- Clean Architecture: outer layers depend on inner layers, never inward
- Coordinator owns navigation — views call coordinator callbacks
- Repository is the single source of truth
- Choose architecture based on app complexity, not trends
MVVM Implementation
Android — Jetpack Compose
// ViewModel
@HiltViewModel
class OrderViewModel @Inject constructor(
private val getOrdersUseCase: GetOrdersUseCase
) : ViewModel() {
private val _state = MutableStateFlow(OrderUiState())
val state: StateFlow<OrderUiState> = _state.asStateFlow()
init { loadOrders() }
fun onAction(action: OrderAction) {
when (action) {
is OrderAction.Refresh -> loadOrders()
is OrderAction.SelectOrder -> selectOrder(action.id)
}
}
private fun loadOrders() {
viewModelScope.launch {
_state.update { it.copy(isLoading = true) }
getOrdersUseCase().fold(
onSuccess = { orders ->
_state.update { it.copy(orders = orders, isLoading = false) }
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/clean-arch.md
- references/coordinator.md
- references/design-patterns.md
- references/mobile-architecture-patterns.md
- references/mvvm-mvi.md
- references/offline-first-architecture.md
- references/state-management-mobile.md
FAQ
Что делает скилл mobile-patterns?
Use when the user asks about mobile architecture patterns, MVVM vs MVI, Clean Architecture, Coordinator, repository and use case layers, dependency injection in mobile apps or choosing a cross-platform framework. Produces layer boundaries and module structure. Not for platform-specific code (use ios, android or flutter-expertise).
Как установить скилл mobile-patterns?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл mobile-patterns запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…