Rule Swift

Value Types First

Prefer structs and enums over classes unless reference semantics are needed

swifttypesarchitecturemacosios
CLAUDE.md

Default to structs for data models. Use classes only when you need reference semantics: identity comparisons, inheritance, delegate patterns, or Objective-C interop.

// Prefer: value type for data
struct UserProfile {
    var name: String
    var email: String
}

// Class when reference semantics are needed
class SessionManager {
    static let shared = SessionManager()
    private init() {}
}

Enums with associated values replace class hierarchies for modeling finite states.

Copy this block into your CLAUDE.md or agent config file to enforce it in your workflow.

get crystl