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.development
Standardize SRS and FRS specifications for technical behavior, interfaces, data contracts, quality constraints, and verification mapping. Use when writing SRS, functional specification, system behavior requirements, API/data contracts, or non-functional thresholds.
development
Standardize BRD and BRD-lite discovery for business goals, stakeholder impact, current-to-future state, and measurable value outcomes. Use when creating BRD, business case, project justification, ROI narrative, or AS-IS to TO-BE scope.
development
Implements a strict Red-Green-Refactor loop to ensure zero production code is written without a prior failing test. Use when: creating new features, fixing bugs, or expanding test coverage.
testing
Standardize PRD discovery and drafting for product scope, user outcomes, requirement IDs, and acceptance criteria. Use when creating PRD, product requirements, feature specification, or acceptance criteria plan.