swiftWrite safe Swift code avoiding memory leaks, optional traps, and concurrency bugs.
Install via ClawdBot CLI:
clawdbot install ivangdavila/swiftRequires:
| Topic | File |
|-------|------|
| Optionals, nil safety, force unwrap | optionals.md |
| Retain cycles, weak refs, closures | memory.md |
| async/await, actors, Sendable, value types | concurrency.md |
| JSON encoding/decoding traps | codable.md |
| Protocols, collections, strings, errors, build | types.md |
| SwiftUI state (@State, @Binding, Combine) | swiftui.md |
| Property wrappers, actors, result builders, macros | advanced.md |
| XCTest pitfalls, SPM gotchas | testing.md |
! crashes on nil — use guard let or if let insteadself strongly create retain cycles — use [weak self] in escaping closuresweak — strong delegate = object never deallocatestry! crashes on any error — never use in production pathsremoveFirst() crashes on empty — use popFirst() for safetyasync let starts immediately — not when you awaitawait — state may change between suspension points@MainActor doesn't guarantee immediate main thread — it's queuedSendable conformance violations crash at runtime — compiler warnings are errorsarray[0].mutate() doesn't workString.Index from one string invalid on another — even if contents match@StateObject owns, @ObservedObject borrows — recreating view loses ObservedObject state@EnvironmentObject crashes if not injected — no compile-time check@State — changing ID loses stateprint() builds strings even in release — remove or use os_logGenerated Mar 1, 2026
Developers building mobile applications for Apple platforms can use this skill to avoid common pitfalls like memory leaks from retain cycles in closures and crashes from force-unwrapping optionals, ensuring stable and performant apps. It also helps manage SwiftUI state correctly to prevent unexpected UI behavior.
Teams using Swift on Linux for backend services can leverage this skill to handle concurrency safely with async/await and actors, avoiding data races and ensuring Sendable compliance. It also addresses JSON encoding/decoding traps for robust API responses.
Developers creating macOS or Linux desktop apps can apply this skill to manage memory efficiently with weak references and avoid crashes from collection mutations, leading to more reliable software. It includes tips for optimizing build sizes to reduce binary bloat.
Instructors and learners in coding bootcamps or online courses can use this skill as a reference to teach safe Swift practices, focusing on avoiding optional traps and understanding protocol extensions. It helps build foundational knowledge for beginners transitioning to real-world projects.
Large organizations maintaining legacy Swift codebases can utilize this skill to refactor and modernize applications, addressing issues like delegate retain cycles and concurrency bugs to improve scalability and reduce runtime crashes in production environments.
Offer this skill as part of a subscription-based platform providing code analysis and best practices, generating revenue through monthly or annual licenses. It can integrate with IDEs to offer real-time suggestions, appealing to teams seeking to reduce bugs and improve code quality.
Provide expert consulting services to companies adopting Swift, using this skill to conduct workshops and code reviews for a fee. Revenue comes from hourly rates or project-based contracts, helping clients optimize their Swift projects for safety and performance.
Host this skill on a website with free access to basic guidelines, monetizing through premium content like in-depth tutorials or advanced modules. Revenue is generated via ads, sponsorships, and paid memberships, targeting individual developers and small teams.
💬 Integration Tip
Integrate this skill into CI/CD pipelines to automatically check for violations like force unwraps or Sendable issues, ensuring code quality before deployment. Use it as a reference during code reviews to standardize best practices across teams.
Full Windows desktop control. Mouse, keyboard, screenshots - interact with any Windows application like a human.
Control Android devices via ADB with support for UI layout analysis (uiautomator) and visual feedback (screencap). Use when you need to interact with Android apps, perform UI automation, take screenshots, or run complex ADB command sequences.
Build, test, and ship iOS apps with Swift, Xcode, and App Store best practices.
Control macOS GUI apps visually — take screenshots, click, scroll, type. Use when the user asks to interact with any Mac desktop application's graphical interface.
Swift Concurrency review and remediation for Swift 6.2+. Use when asked to review Swift Concurrency usage, improve concurrency compliance, or fix Swift concurrency compiler errors in a feature or file.
Best practices and example-driven guidance for building SwiftUI views and components. Use when creating or refactoring SwiftUI UI, designing tab architecture with TabView, composing screens, or needing component-specific patterns and examples.