skills/swift/swift-best-practices/SKILL.md
Apply Guard, Value Types, Immutability, and Naming conventions in Swift. Use when writing idiomatic Swift using guard, value types, immutability, or naming conventions.
npx skillsauth add hoangnguyen0403/agent-skills-standard swift-best-practicesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
guard let over nested if statements for better readability and to unwrap optionals early.guard for precondition checks at top of function to reduce nested depth.@unknown default for freezing enums (enums from frameworks).if case .success(let value) = result for simple enum pattern matching.class only when reference identity or inheritance required.var only when change required.final for all classes that not intended to subclassed to improve performance (static dispatch).final classes.is, has, or can. Example: isValid, hasErrors, canEdit. Makes boolean state clear.camelCase for clear names and PascalCase for types.-able, -ible, or -ing suffixes (e.g., Codable, Identifiable).some View or some Collection for return types where underlying type internal.compactMap, filter, and reduce instead of explicit for-where loops for data transformations..lazy for large sequences when result consumed partially.default values in dictionary access to avoid double optional unwrapping.guard for early exits.! on optionals. Use ?? (nil-coalescing) or if let.static let shared) or DI.testing
Infer the requesting operator's technical fluency from message content (never ask directly) and adapt register — business, hybrid, or technical — across SDLC workflow output. Use when starting sdlc, brainstorm-feature, plan-feature, verify-work, publish-notes, or session-report, or whenever a request's phrasing signals a non-technical or cross-stack operator.
documentation
Define transaction boundaries, locking, and consistency guarantees for multi-step writes. Use when designing atomic operations, retries, idempotency, or concurrent write behavior.
development
Design relational or document schemas from access patterns, cardinality, and lifecycle. Use when modeling entities, choosing embed vs normalize, or shaping schema boundaries before implementation.
data-ai
Diagnose database latency with explain plans, index ownership, and query-shape review. Use when a query is slow, an index is missing, or scans and N+1 patterns appear.