chezmoi-source (чистая пересборка, не дамп 1.2 ГБ): - dot_claude: CLAUDE.md лин-роутер, AGENTS.md.tmpl (VPS вычищен), settings.json.tmpl (deny-щит 20 + security-guard hook), rules (structure + ECC 21 язык), 30 generic ECC-агентов, health-check - dot_codex: symlink-паритет; dot_agents: registry 13 скриптов HOME-генерик + методология docs - плагины: plugins.manifest + bootstrap Слой 1b (marketplace+install) - launchd: health.plist (PATH-фикс 127) + session-reaper.example - smoke++: secret-токен guard + канон-проверки (зелёный) - 0 hard личных данных; cut личного (kb/references/gsd/owner) → Ф4
1.5 KiB
1.5 KiB
paths
| paths | ||
|---|---|---|
|
Swift Patterns
This file extends common/patterns.md with Swift specific content.
Protocol-Oriented Design
Define small, focused protocols. Use protocol extensions for shared defaults:
protocol Repository: Sendable {
associatedtype Item: Identifiable & Sendable
func find(by id: Item.ID) async throws -> Item?
func save(_ item: Item) async throws
}
Value Types
- Use structs for data transfer objects and models
- Use enums with associated values to model distinct states:
enum LoadState<T: Sendable>: Sendable {
case idle
case loading
case loaded(T)
case failed(Error)
}
Actor Pattern
Use actors for shared mutable state instead of locks or dispatch queues:
actor Cache<Key: Hashable & Sendable, Value: Sendable> {
private var storage: [Key: Value] = [:]
func get(_ key: Key) -> Value? { storage[key] }
func set(_ key: Key, value: Value) { storage[key] = value }
}
Dependency Injection
Inject protocols with default parameters — production uses defaults, tests inject mocks:
struct UserService {
private let repository: any UserRepository
init(repository: any UserRepository = DefaultUserRepository()) {
self.repository = repository
}
}
References
See skill: swift-actor-persistence for actor-based persistence patterns.
See skill: swift-protocol-di-testing for protocol-based DI and testing.