About neo-swift
neo-swift is a skill for writing, debugging, refactoring, and reviewing Swift code. It adapts guidance to the target Swift version and platform, with attention to modern language features, concurrency safety, and memory management.
Key features
- 01Identify Swift version, platform, and dependencies
- 02Apply modern Swift syntax and concurrency
- 03Check memory lifetimes and concurrency safety
- 04Optimize code and migration guidance by target version
Use cases
- 01Modernize code with structured concurrency
- 02Check Swift 6 concurrency safety and data races
- 03Write code for SwiftUI, UIKit, or server-side Swift
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ benknightdark/ neo-skills --skill neo-swiftAfter installing, type/neo-swiftin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
reference/anti-patterns.mdcoding-style.mdpatterns.mdDetails
From the project READMEModern Swift (5.0+) Expert Skill
Trigger On
- The user asks to write, debug, refactor, or review Swift code.
- The project directory contains
*.swift,Package.swift, or*.xcodeproj. - Development involves iOS (SwiftUI/UIKit), macOS, or Server-side Swift (Vapor).
- Code modernization is needed (e.g., migrating to Structured Concurrency or Swift 6 language mode).
Workflow
- Perceive (Version Awareness):
- Identify the Swift version (e.g., check
Package.swiftor build settings). - Determine the platform (SwiftUI vs UIKit, Server vs App).
- Assess dependency management (Swift Package Manager, CocoaPods).
- Identify the Swift version (e.g., check
- Reason (Planning Phase):
- Evaluate the use of modern syntax (e.g.,
async/await,Result,@propertyWrapper). - Decide on memory management strategies (ARC,
weak/unowned). - For UI tasks, prioritize SwiftUI for modern apps or UIKit for legacy support.
- Evaluate the use of modern syntax (e.g.,
- Act (Execution Phase):
- Write swifty, concise code following Apple's API Design Guidelines.
- Implement type-safe and protocol-oriented solutions.
- Leverage Structured Concurrency (
Task,async let) for asynchronous operations.
- Validate (Standard Validation):
- Check for memory leaks (retain cycles) using capture lists.
- Verify Swift 6 concurrency safety (data race detection).
- Ensure naming conventions follow the standard
lowercamelCasefor members andPascalCasefor types.
Feature Roadmap (Swift 5.0 - 6+)
Swift 5.0 - 5.4 (Foundation)
- Result Type: Standardized error handling.
- Property Wrappers: Encapsulating property logic (e.g.,
@Published). - Opaque Types: Hiding implementation details (
some View). - Result Builders: DSL support for SwiftUI.
Swift 5.5 - 5.10 (Modern Concurrency)
- Async/Await: Linear asynchronous code.
- Actors: Thread-safe state isolation.
- Distributed Actors: Communicating across processes.
- Non-copyable Types: Explicit control over object ownership.
Swift 6+ (Safety & Performance)
- Full Data Isolation: Compile-time data race prevention.
- Typed Throws: Explicitly defining error types.
- Embedded Swift: Running Swift on restricted environments.
Coding Standards
- Conciseness: Use trailing closures and shorthand argument names where appropriate.
- Safety: Prefer
if letorguard letover force unwrapping (!). - Purity: Prefer
struct(Value Types) overclass(Reference Types) for data models. - Concurrency: Avoid
Thread.sleepor legacy completion handlers; use structured concurrency.
Deliver
- Version-Optimized Code: Provide code using the best features of the target Swift version.
- SwiftUI/UIKit Insights: Recommend patterns based on the UI framework used.
- Concurrency Migration: Provide strategies for moving to Swift 6 strict concurrency checks.
Validate
- Ensure code compiles without warnings in the target Swift version.
- Validate that closure capture lists correctly handle object lifecycles.
- Confirm that error handling uses the
do-catchorthrowspatterns correctly.
Documentation
Official References
Internal References
Comments
Markdown supported