Swift Language
This skill contains shell command directives (!`command`) that may execute system commands. Review carefully before installing.
Swift Language Standards
Priority: P0
Implementation Guidelines
Optionals & Safety
- Never Force Unwrap: Use
guard let,if let, or nil coalescing (??). - Nil Comparison: Use
value != nilinstead ofif let _ = value. - Implicitly Unwrapped: Avoid
Type!. Use properType?.
Protocols & Extensions
- Protocol Composition: Prefer
struct+ protocols over class inheritance. - Extensions: Use for conformance (
extension MyType: Codable), not storage. - Protocol Witnesses: Explicitly implement all required members.
Type Safety
- Avoid
Any: Use generics or associated types instead. - Enums: Prefer enums with associated values over multiple Optionals.
- Value Types: Default to
structunless reference semantics needed.
Anti-Patterns
- Force Unwrapping:
**No ! operator**: Use safe unwrapping. - Sentinel Values:
**No -1 for failure**: Use Optional. - as! Casting:
**No Force Cast**: Use conditional cast (as?).
References
More from hoangnguyen0403/agent-skills-standard
skill creator
Standards for creating new High-Density Agent Skills with optimal token economy.
181java-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)
1swift swiftui
Standards for State Management, View Lifecycle, and Property Wrappers
1swift tooling
Standards for SPM, Build Configs, and Code Quality
1swift testing
Standards for XCTest, Async Tests, and Test Organization
1java-concurrency
Implement modern concurrency with Virtual Threads and Structured Concurrency in Java. Use when implementing Java Virtual Threads (Java 21), Structured Concurrency with StructuredTaskScope, CompletableFuture pipelines, or debugging race conditions. (triggers: **/*.java, Thread, Executor, synchronized, lock, CompletableFuture, StructuredTaskScope, VirtualThread, AtomicInteger, async, race condition)
1