app-architecture
MVVM pattern, Clean Architecture, Repository pattern, dependency injection, SOLID principles. Use when designing app architecture.
When & Why to Use This Skill
This Claude skill provides comprehensive guidance and implementation support for modern software architecture patterns, including MVVM, Clean Architecture, and the Repository pattern. It helps developers apply SOLID principles and Dependency Injection to create scalable, maintainable, and testable applications, specifically optimized for mobile and enterprise environments.
Use Cases
- Designing a scalable mobile application architecture using Clean Architecture layers to separate business logic from UI and infrastructure.
- Implementing the MVVM (Model-View-ViewModel) pattern to handle lifecycle-aware data management and improve UI testability.
- Setting up Dependency Injection (DI) frameworks like Hilt or Dagger to decouple components and simplify unit testing.
- Refactoring legacy codebases into a Repository pattern to abstract data sources and provide a clean API for the domain layer.
- Applying SOLID principles to resolve complex class dependencies and ensure long-term code maintainability.
| name | architecture |
|---|---|
| description | MVVM pattern, Clean Architecture, Repository pattern, dependency injection, SOLID principles. |
| version | "2.0.0" |
| sasmp_version | "1.3.0" |
| bonded_agent | 06-architecture |
| bond_type | PRIMARY_BOND |
| atomic | true |
| single_responsibility | App architecture & design patterns |
| type | string |
| enum | [simple, medium, complex] |
| required | false |
| default | medium |
| max_attempts | 2 |
| backoff | exponential |
| on_failure | suggest_simpler_pattern |
| level | info |
| include | [pattern_type, layer, dependencies] |
App Architecture Skill
Quick Start
MVVM Pattern
@HiltViewModel
class UserViewModel @Inject constructor(
private val repository: UserRepository
) : ViewModel() {
private val _state = MutableLiveData<UiState>()
val state: LiveData<UiState> = _state
fun loadUser(id: Int) {
viewModelScope.launch {
_state.value = repository.getUser(id)
}
}
}
Repository Pattern
interface UserRepository {
suspend fun getUser(id: Int): User
}
class UserRepositoryImpl(
private val dao: UserDao,
private val api: UserApi
) : UserRepository {
override suspend fun getUser(id: Int): User {
return dao.getUser(id) ?: api.fetchUser(id)
}
}
Dependency Injection (Hilt)
@Module
@InstallIn(SingletonComponent::class)
object RepositoryModule {
@Provides
fun provideUserRepository(dao: UserDao, api: UserApi): UserRepository {
return UserRepositoryImpl(dao, api)
}
}
Key Concepts
MVVM Benefits
- Lifecycle awareness
- Configuration change handling
- Separation of concerns
- Testability
Clean Architecture Layers
- Domain: Business rules
- Application: Use cases
- Presentation: UI
- Infrastructure: Data sources
SOLID Principles
- S: Single Responsibility
- O: Open/Closed
- L: Liskov Substitution
- I: Interface Segregation
- D: Dependency Inversion
Best Practices
✅ Dependency injection ✅ Interface-based design ✅ Layered architecture ✅ Single responsibility ✅ Testable code