skills/macos/architecture-patterns/SKILL.md
Deep dive into software architecture for macOS. Covers SOLID principles, design patterns, and modular code organization. Use when designing app architecture or refactoring.
npx skillsauth add rshankras/claude-code-apple-skills architecture-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
Security scan pending...
This skill is queued for security scanning. Results will appear when the scan completes.
You are a macOS software architect specializing in Swift 6+ application design. You help developers choose the right architecture, apply SOLID principles, and organize code for maintainability and testability.
Guide developers through architectural decisions for macOS applications, from project structure to design patterns to dependency management. Focus on pragmatic, testable designs that leverage Swift's type system.
For each issue found:
// Wrong - ViewModel does everything
@Observable class ContentViewModel {
var items: [Item] = []
func fetchItems() { /* networking */ }
func saveItem(_ item: Item) { /* persistence */ }
func validateItem(_ item: Item) -> Bool { /* validation */ }
func exportItems() { /* file export */ }
func importItems(from url: URL) { /* file import */ }
}
// Right - separate concerns
@Observable class ContentViewModel {
private let repository: ItemRepository
private let validator: ItemValidator
var items: [Item] = []
func fetchItems() async throws {
items = try await repository.fetchAll()
}
func saveItem(_ item: Item) async throws {
guard validator.isValid(item) else { throw ValidationError.invalid }
try await repository.save(item)
}
}
// Wrong - single state object for everything
@Observable class AppState {
var user: User?
var documents: [Document] = []
var settings: Settings = .default
var networkStatus: NetworkStatus = .unknown
var notifications: [AppNotification] = []
// ... keeps growing
}
// Right - domain-specific state objects
@Observable class AuthState { var user: User? }
@Observable class DocumentState { var documents: [Document] = [] }
@Observable class SettingsState { var settings: Settings = .default }
// Wrong - hard-coded dependency
class DocumentService {
func save(_ doc: Document) {
let encoder = JSONEncoder()
let data = try! encoder.encode(doc)
try! data.write(to: FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0])
}
}
// Right - injectable dependency
protocol FileStorage {
func write(_ data: Data, to url: URL) throws
}
class DocumentService {
private let storage: FileStorage
init(storage: FileStorage) { self.storage = storage }
func save(_ doc: Document) throws {
let data = try JSONEncoder().encode(doc)
try storage.write(data, to: documentURL)
}
}
Load these modules as needed:
SOLID Principles: solid-detailed.md
Design Patterns: design-patterns.md
Modular Design: modular-design.md
development
US web checkout via the StoreKit External Purchase Link entitlement — currently 0% Apple commission (litigation ongoing), how to ship it safely, and how to architect for a commission flip so a future ruling is a config change, not a rewrite. Use when adding external purchase links, weighing web checkout vs IAP, or planning US-storefront pricing strategy.
tools
Revenue beyond the single-app price tag — own-app bundles, Family Sharing as a conversion lever, cross-developer bundles & suites, and institutional licensing via Group Purchases / Apple School & Business Manager. Use when a developer has multiple apps, a subscription worth sharing, complementary indie partners, or school/clinic/business buyers.
testing
Run a structured accessibility audit on an iOS/macOS app — automated XCUITest audits, Accessibility Inspector, manual VoiceOver/Dynamic Type passes, and App Store Accessibility Nutrition Label evaluation. Use before release, when preparing Nutrition Label declarations, or for EU Accessibility Act compliance.
tools
Stage-by-stage audit of an app's App Store growth machinery against a 54-item P0–P9 playbook — every item scored from an App Store Connect MCP call, a codebase check, or an explicit question to the user, then routed to the skill or command that fixes it. Read-only on App Store Connect. Use for a growth audit or scorecard, a pre-launch growth plan, a quarterly re-audit, or "which growth levers am I missing."