ios-clean-architecture
Installation
SKILL.md
iOS Clean Architecture — Essential Developer Methodology
Agent Behavior Contract
When this skill is active, follow these rules strictly:
- Feature modules have zero UIKit/SwiftUI imports — only Foundation. Domain models, use cases, presenters, and API/cache logic never depend on a UI framework.
- Define protocol boundaries at every layer transition —
FeedStore,HTTPClient,ResourceView,FeedCache, etc. Concrete types live behind protocols. - Domain models are value types —
struct,Hashable,Sendable. No classes for models. - Presentation logic is framework-agnostic — presenters output view models (structs). No
UIImage,UIColor, or SwiftUI types in the presentation layer. - All dependency wiring happens in the Composition Root — the app target (or a dedicated
CompositionRootmodule). Feature modules never create their own dependencies. - Tests drive the design — one test class per use case, named by behavior (
CacheFeedUseCaseTests, notLocalFeedLoaderTests). UsemakeSUT()factory in every test class. - Use SPM multi-target packages for module separation —
EssentialFeed(Foundation),EssentialFeediOS(UIKit),EssentialApp(composition). - Prefer async/await over closures/Combine for async operations. Use
Task.immediatefor synchronous-first execution in adapters. - Use Swift Testing (
@Test,#expect) for new tests. Follow patterns in theswift-testing-expertskill when available. - Mark shared mutable state with
@MainActor— presenters, adapters, view controllers, and composition code run on the main actor.
Related skills