Enforces opinionated SwiftUI modular MVVM-C architecture for iOS apps. Guides DependencyContainer, coordinators, route shells, and repository protocol enforcement.
How this skill is triggered — by the user, by Claude, or both
Slash command
/pproenca-dot-skills-1:swift-ui-architectThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Opinionated architecture enforcement for SwiftUI clinic-style apps. This skill aligns to the iOS 26 / Swift 6.2 clinic architecture: modular MVVM-C in local SPM packages, concrete coordinators and route shells in the App target, pure Domain protocols, and Data as the only I/O layer.
Opinionated architecture enforcement for SwiftUI clinic-style apps. This skill aligns to the iOS 26 / Swift 6.2 clinic architecture: modular MVVM-C in local SPM packages, concrete coordinators and route shells in the App target, pure Domain protocols, and Data as the only I/O layer.
┌───────────────────────────────────────────────────────────────┐
│ App target: DependencyContainer, Coordinators, Route Shells │
├───────────────┬───────────────┬───────────────┬──────────────┤
│ Feature* SPM │ Feature* SPM │ Feature* SPM │ Feature* SPM │
│ View + VM │ View + VM │ View + VM │ View + VM │
├───────────────────────────────────────────────────────────────┤
│ Data SPM: repository impls, remote/local, retry, sync queue │
├───────────────────────────────────────────────────────────────┤
│ Domain SPM: models, repository protocols, coordinator protocols│
│ and ErrorRouting/AppError │
├───────────────────────────────────────────────────────────────┤
│ Shared SPMs: DesignSystem, SharedKit │
└───────────────────────────────────────────────────────────────┘
Dependency Rule: Feature modules import Domain + DesignSystem only. Features never import Data or other features. App target is the only convergence point.
All guidance in this skill assumes the clinic modular MVVM-C architecture:
Domain + DesignSystem only (never Data, never sibling features)DependencyContainer, concrete coordinators, and Route Shell wiringDomain stays pure Swift and defines models plus repository, *Coordinating, ErrorRouting, and AppError contractsData owns SwiftData/network/sync/retry/background I/O and implements Domain protocolsReference these guidelines when:
@Observable for ViewModels/coordinators, ObservableObject / @Published neverNavigationPath in App target.navigationDestination mappingAppError + ErrorRouting drive presentation policy; ViewModels do not hardcode global error UI| Priority | Category | Impact | Prefix | Rules |
|---|---|---|---|---|
| 1 | View Identity & Diffing | CRITICAL | diff- | 6 |
| 2 | State Architecture | CRITICAL | state- | 7 |
| 3 | View Composition | HIGH | view- | 6 |
| 4 | Navigation & Coordination | HIGH | nav- | 5 |
| 5 | Layer Architecture | HIGH | layer- | 6 |
| 6 | Dependency Injection | MEDIUM-HIGH | di- | 4 |
| 7 | List & Collection Performance | MEDIUM | list- | 4 |
| 8 | Async & Data Flow | MEDIUM | data- | 5 |
diff-equatable-views - Apply @Equatable macro to every SwiftUI viewdiff-closure-skip - Use @SkipEquatable for closure/handler propertiesdiff-reference-types - Never store reference types without Equatable conformancediff-identity-stability - Use stable O(1) identifiers in ForEachdiff-avoid-anyview - Never use AnyView — use @ViewBuilder or genericsdiff-printchanges-debug - Use _printChanges() to diagnose unnecessary re-rendersstate-observable-class - Use @Observable classes for all ViewModelsstate-ownership - @State for owned data, plain property for injected datastate-single-source - One source of truth per piece of statestate-scoped-observation - Leverage @Observable property-level trackingstate-binding-minimal - Pass @Binding only for two-way data flowstate-environment-global - Use @Environment for app-wide shared dependenciesstate-no-published - Never use @Published or ObservableObjectview-body-complexity - Maximum 10 nodes in view bodyview-extract-subviews - Extract computed properties/helpers into separate View structsview-no-logic-in-body - Zero business logic in bodyview-minimal-dependencies - Pass only needed properties, not entire modelsview-viewbuilder-composition - Use @ViewBuilder for conditional compositionview-no-init-sideeffects - Never perform work in View initnav-coordinator-pattern - Every feature has a coordinator owning NavigationStacknav-routes-enum - Define all routes as a Hashable enumnav-deeplink-support - Coordinators must support URL-based deep linkingnav-modal-sheets - Present modals via coordinator, not inlinenav-no-navigationlink - Never use NavigationLink(destination:) — use navigationDestination(for:)layer-dependency-rule - Domain layer has zero framework importslayer-usecase-protocol - Do not add a use-case layer; keep orchestration in ViewModel + repository protocolslayer-repository-protocol - Repository protocols in Domain, implementations in Datalayer-model-value-types - Domain models are structs, never classeslayer-no-view-repository - Views never access repositories directly; ViewModel calls repository protocolslayer-viewmodel-boundary - ViewModels expose display-ready state onlydi-environment-injection - Inject container-managed protocol dependencies via @Environmentdi-protocol-abstraction - All injected dependencies are protocol typesdi-container-composition - Compose DependencyContainer in App target and expose VM factoriesdi-mock-testing - Every protocol dependency has a mock for testinglist-constant-viewcount - ForEach must produce constant view count per elementlist-filter-in-model - Filter/sort in ViewModel, never inside ForEachlist-lazy-stacks - Use LazyVStack/LazyHStack for unbounded contentlist-id-keypath - Provide explicit id keyPath — never rely on implicit identitydata-task-modifier - Use .task(id:) as the primary feature data-loading triggerdata-async-init - Never perform async work in initdata-error-loadable - Model loading states as enum, not booleansdata-combine-avoid - Prefer async/await over Combine for new codedata-cancellation - Use .task automatic cancellation — never manage Tasks manuallyRead individual reference files for detailed explanations and code examples:
| File | Description |
|---|---|
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and reference information |
npx claudepluginhub joshuarweaver/cascade-code-general-misc-1 --plugin pproenca-dot-skills-1Refactors Swift/SwiftUI code into a modular MVVM-C architecture with @Observable ViewModels, coordinator pattern, and Domain/Data/Feature/App package boundaries. Use when migrating to iOS 26 / Swift 6.2 clinic architecture.
Guides pure SwiftUI architecture: state management with @State/@Observable/@Environment, shared services, navigation, UI components, async patterns without ViewModels.
Provides architecture playbooks for Swift iOS codebases (MVVM, MVI, TCA, Clean Architecture, VIPER, MVP, Coordinator, Reactive). Guides architecture selection, implementation, refactoring, and review for SwiftUI or UIKit features.