Swift Best Practices
Swift Best Practices
Priority: P0
Implementation Guidelines
Control Flow
- Guard for Early Exit: Use
guardover nestediffor better readability. - for-where: Use
for item in items where conditioninstead of nestedif. - Switch Exhaustiveness: Always handle all cases; use
@unknown defaultfor enums.
Value Types & Immutability
- Prefer Structs: Use
structby default; classes only for reference semantics or inheritance. - Immutability: Use
letovervarwhenever possible. - Copy-on-Write: Leverage Swift's built-in COW for collections.
Naming & Style
More from hoangnguyen0403/agent-skills-standard
skill creator
Standards for creating new High-Density Agent Skills with optimal token economy.
184caveman
>
2dev-fix
Unified developer workflow for fixing bugs. Analyzes JIRA, cross-checks context, proposes a solution via implementation_plan.md, implements the fix, verifies locally with QE skills, and delivers a PR.
1java-language
Modern Java 21+ standards including Records, Pattern Matching, and Virtual Threads. Use when working with Java records, sealed classes, switch expressions, text blocks, Optional, or upgrading from older Java versions. (triggers: **/*.java, pom.xml, build.gradle, record, sealed, switch, var, Optional, stream, VirtualThread, instanceof, text block)
1verify-bug
Post-merge UAT verification workflow. Walks JIRA reproduce steps, performs comparative audits (Before/After), attaches evidence to JIRA, and transitions status on PASS.
1caveman-commit
>
1