swift-language
/swift-language
Stosuje w Swifcie wzorce Optionals, Protocols, Extensions i bezpieczeństwa typów przy pracy z API typowo bezpiecznymi.
- Autor
- HoangNguyen0403 ↗
- Repozytorium
- agent-skills-standard ↗
- Licencja
- MIT
- Ostatnia zmiana repozytorium
- 22.10.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 3
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 22.10.2026, bez odwołań do wycofanych modeli i API.
MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.
Co robi i kiedy
Stosuje w Swifcie wzorce Optionals, Protocols, Extensions i bezpieczeństwa typów przy pracy z API typowo bezpiecznymi.
Oryginalny opis (EN)
Apply Optionals, Protocols, Extensions, and Type Safety patterns in Swift. Use when working with Swift Optionals, Protocols, Extensions, or type-safe APIs.
Jak działa
- Priority: P0 (CRITICAL)
- Implementation Guidelines
- Anti-Patterns
- References
- Canonical response anchors
Podgląd SKILL.md
---
name: swift-language
description: Apply Optionals, Protocols, Extensions, and Type Safety patterns in Swift. Use when working with Swift Optionals, Protocols, Extensions, or type-safe APIs.
metadata:
triggers:
files:
- '**/*.swift'
keywords:
- protocol
- extension
- optional
- guard
- enum
---
# Swift Language Standards
## **Priority: P0 (CRITICAL)**
## Implementation Guidelines
### Optionals & Safety
- **Never Force Unwrap**: Use **guard let**, **if let**, or **nil coalescing (??)** to safely unwrap.
- **Nil Comparison**: Use `value != nil` instead of `if let _ = value`.
- **Implicitly Unwrapped**: Avoid `Type!`. Use proper `Type?`.
### Protocols & Extensions
- **Protocols as Blueprints**: Protocols define **blueprint**; classes inherit implementation.
- **Composition over Inheritance**: **Prefer protocol composition** with structs for better decoupling and performance.
- **Extensions**: Implement **conformance** in extension: **`extension MyType: MyProtocol { ... }`**. Use extensions for clean code organization, not storage ( **not** use extensions for **stored properties**).
- **Protocol Witnesses**: Explicitly implement all required members to satisfy witness table.
### Type Safety
- **Avoid `Any`**: Use generics or associated types instead for compile-time safety.
- **Enums**: Prefer enums with **associated values** over multiple Optionals. Extract values via **switch** statement (e.g., `case .success(let value):`).
- **Value Types**: **Default to struct** for **value semantics** and thread safety. Use `class` only when **reference identity** necessary or for inheritance. Structs copied; classes shared.
## Anti-Patterns
- **No ! operator**: Use safe unwrapping.
- **No -1 for failure**: Use Optional.
- **No force cast (as!)**: Use conditional cast (as?).
## References
- [Optionals & Protocols](references/implementation.md)
## Canonical response anchors
When this skill applies, preserve the following domain terminology or equivalent concrete examples in the answer when relevant:
- Default to struct
- Never force unwrap
- associated values
- value types
- Additional task-grounded exact anchors: extension MyType: MyProtocol; conformance
Pliki w paczce (3)
- SKILL.md 2 KB
- evals/evals.json 3 KB
- references/implementation.md 1 KB
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · HoangNguyen0403/agent-skills-standard | 100 | MIT |
| JordanCoin/ios-skills-collection | 95 | MIT |
| Dev869/swift-tothemax | 90 | MIT |
Migawka bazy z 13.11.2026 · wersja paczki 49738f47af91 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 1 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 100swift-language-pro
Pomaga pisać i przeglądać kod Swift: typy wartościowe i referencyjne, opcjonale, obsługę błędów, generyki i wytyczne API. - 100swift-expert
Dostarcza wiedzę o Swifcie dla iOS i macOS z SwiftUI, Combine i Swift 5.9+: podstawy, optionals, funkcje i closures, struktury i klasy. - 100swift-guide
Pilnuje dobrych praktyk Swift przy pracy z AI: obsługi opcjonali, programowania przez protokoły, async/await i testów. - 95lang-swift
Pisze i przegląda nowoczesny Swift 6: opcjonale, typy wartości, protokoły, ARC i cykle silnych referencji, współbieżność oraz Swift Package Manager. - 100sota-swift
Stosuje zasady pisania i audytu kodu w Swift 6: optionals, błędy, typy wartościowe, bezpieczeństwo wyścigów danych, ARC oraz usługi serwerowe w Vapor i SwiftNIO. - 90Swift Optionals Patterns
Omawia wzorce obsługi optionali w Swift: optional binding, chaining, nil coalescing i nowoczesne podejścia, które pozwalają bezpiecznie pracować z wartościami opcjonalnymi bez force unwrapping.