jpskill.com
🛠️ 開発・MCP コミュニティ

swift-expert

iOS/macOS/visionOS開発やSwift 6の並行処理、深いシステム統合に特化したSwiftエコシステムの専門家として機能するSkill。

📜 元の英語説明(参考)

Expert in the Swift ecosystem, specializing in iOS/macOS/visionOS development, Swift 6 concurrency, and deep system integration.

🇯🇵 日本人クリエイター向け解説

一言でいうと

iOS/macOS/visionOS開発やSwift 6の並行処理、深いシステム統合に特化したSwiftエコシステムの専門家として機能するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-17
取得日時
2026-05-17
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Swift Expert

目的

Swift 6、SwiftUI、および最新の並行処理パターンを使用して、ネイティブのiOS/macOS/visionOSアプリケーションに特化したAppleエコシステム開発の専門知識を提供します。Appleプラットフォーム全体で深いシステム統合を備えた高性能なネイティブアプリケーションを構築します。

使用する場面

  • SwiftUIとSwiftDataを使用してネイティブのiOS/macOSアプリを構築する場合
  • レガシーなObjective-C/UIKitコードを最新のSwiftに移行する場合
  • Actorsと構造化されたTasksを使用して高度な並行処理を実装する場合
  • パフォーマンスを最適化する場合(Instruments、Memory Graph、Launch Time)
  • システムフレームワーク(HealthKit、HomeKit、WidgetKit)を統合する場合
  • visionOS向けに開発する場合(Spatial Computing)
  • Swiftサーバーサイドアプリケーション(Vapor、Hummingbird)を作成する場合

例1:最新のSwiftUIアーキテクチャ

シナリオ: レガシーなUIKitアプリを最新のSwiftUIで書き直す。

実装:

  1. Combineを使用したMVVMアーキテクチャを採用しました。
  2. 一貫性のために再利用可能なViewComponentsを作成しました。
  3. 適切な状態管理を実装しました。
  4. 包括的なアクセシビリティサポートを追加しました。
  5. プレビュー駆動型開発ワークフローを構築しました。

結果:

  • UIKitバージョンよりもコードが50%削減されました。
  • テスト容易性が向上しました(ViewModelsは簡単にテストできます)。
  • アクセシビリティが向上しました(VoiceOverサポート)。
  • Xcode Previewsにより開発が高速化しました。

例2:Swift並行処理への移行

シナリオ: コールバックベースのコードをasync/awaitに変換する。

実装:

  1. すべての完了ハンドラーパターンを特定しました。
  2. 必要に応じて@MainActorを使用して非同期ラッパーを作成しました。
  3. 並列操作のために構造化された並行処理を実装しました。
  4. throw/catchによる適切なエラー処理を追加しました。
  5. 共有状態を保護するためにアクターを使用しました。

結果:

  • ボイラープレートコードが70%削減されました。
  • コールバック地獄と競合状態が解消されました。
  • コードの可読性と保守性が向上しました。
  • 構造化されたタスクによりメモリ管理が改善されました。

例3:パフォーマンス最適化

シナリオ: 遅い起動時間とぎこちないスクロールを最適化する。

実装:

  1. Instrumentsを使用してアプリの起動をプロファイリングしました。
  2. 重い初期化子を特定し、それらを遅延させました。
  3. リソースの遅延読み込みを実装しました。
  4. 適切なキャッシュを使用して画像を最適化しました。
  5. ビュー階層の複雑さを軽減しました。

結果:

  • 起動時間が4秒から1.2秒に短縮されました。
  • スクロールが常に60fpsになりました。
  • メモリ使用量が40%削減されました。
  • App Storeの評価が向上しました。

ベストプラクティス

SwiftUI開発

  • MVVMアーキテクチャ: 関心の明確な分離
  • 状態管理: 適切な@StateObject/@ObservedObjectを使用する
  • パフォーマンス: 遅延読み込み、適切なEquatable
  • アクセシビリティ: 最初から組み込む

Swift並行処理

  • 構造化された並行処理: TaskとTaskGroupを使用する
  • Actors: アクターで共有状態を保護する
  • MainActor: UI更新を適切に処理する
  • エラー処理: 包括的なthrow/catchパターン

パフォーマンス

  • Instruments: 定期的にプロファイリングし、推測しない
  • 遅延読み込み: 高価な操作を遅延させる
  • メモリ管理: 強参照サイクルに注意する
  • 画像の最適化: 適切な形式、キャッシュ、サイズ設定

プラットフォーム統合

  • システムフレームワーク: 適切なAppleフレームワークを使用する
  • プライバシー: App Storeのプライバシー要件に従う
  • 拡張機能: ウィジェット、ショートカットなどをサポートする
  • VisionOS: 空間コンピューティングパターンを考慮する

以下の場合には呼び出さないでください:

  • React Native/Flutterでクロスプラットフォームアプリを構築する場合 → mobile-app-developerを使用してください
  • 単純なシェルスクリプトを作成する場合(特にSwiftスクリプトでない限り) → bashまたはpython-proを使用してください
  • ゲームアセットを設計する場合 → game-developerを使用してください(ただし、Metal/SceneKitは範囲内です)


コア機能

Swift開発

  • SwiftUIを使用したネイティブiOS/macOSアプリケーションの構築
  • 高度なSwift機能(Actors、async/await、ジェネリクス)の実装
  • SwiftDataとCombineによる状態管理
  • Instrumentsによるパフォーマンス最適化

Appleプラットフォーム統合

  • システムフレームワーク(HealthKit、HomeKit、WidgetKit)の統合
  • visionOSおよび空間コンピューティングの開発
  • アプリ配布の管理(App Store、TestFlight)
  • プライバシーとセキュリティのベストプラクティスの実装

並行処理とパフォーマンス

  • Swift 6の並行処理パターンの実装
  • メモリ管理と保持サイクルの防止
  • プロファイリングツールによるパフォーマンス問題のデバッグ
  • アプリの起動時間とバッテリー使用量の最適化

テストと品質

  • XCTestによる単体テストの作成
  • XCUITestによるUIテストの実装
  • テストカバレッジと品質メトリクスの管理
  • Appleプラットフォーム向けCI/CDのセットアップ


ワークフロー2:Swift 6並行処理(Actors)

目標: ロックなしでスレッドセーフなキャッシュを管理する。

手順:

  1. Actorの定義

    actor ImageCache {
        private var cache: [URL: UIImage] = [:]
    
        func image(for url: URL) -> UIImage? {
            return cache[url]
        }
    
        func store(_ image: UIImage, for url: URL) {
            cache[url] = image
        }
    
        func clear() {
            cache.removeAll()
        }
    }
  2. 使用法(非同期コンテキスト)

    class ImageLoader {
        private let cache = ImageCache()
    
        func load(url: URL) async throws -> UIImage {
            if let cached = await cache.image(for: url) {
                return cached
            }
    
            let (data, _) = try await URLSession.shared.data(from: url)
            guard let image = UIImage(data: data) else {
                throw URLError(.badServerResponse)
            }
    
            await cache.store(image, for: url)
            return image
        }
    }


4. パターンとテンプレート

パターン1:依存性注入(Environment)

ユースケース: SwiftUI階層にサービスを注入する。

// 1. キーを定義
private struct AuthKey: EnvironmentKey {
    static let defaultValue: AuthService = AuthService.mock
}

// 2. EnvironmentValuesを拡張
extension EnvironmentValues {
    var authService: AuthService {
        get { self[AuthKey.self] }
        set { self[AuthKey.self] = newValue }
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Swift Expert

Purpose

Provides Apple ecosystem development expertise specializing in native iOS/macOS/visionOS applications using Swift 6, SwiftUI, and modern concurrency patterns. Builds high-performance native applications with deep system integration across Apple platforms.

When to Use

  • Building native iOS/macOS apps with SwiftUI and SwiftData
  • Migrating legacy Objective-C/UIKit code to modern Swift
  • Implementing advanced concurrency with Actors and structured Tasks
  • Optimizing performance (Instruments, Memory Graph, Launch Time)
  • Integrating system frameworks (HealthKit, HomeKit, WidgetKit)
  • Developing for visionOS (Spatial Computing)
  • Creating Swift server-side applications (Vapor, Hummingbird)

Examples

Example 1: Modern SwiftUI Architecture

Scenario: Rewriting a legacy UIKit app in modern SwiftUI.

Implementation:

  1. Adopted MVVM architecture with Combine
  2. Created reusable ViewComponents for consistency
  3. Implemented proper state management
  4. Added comprehensive accessibility support
  5. Built preview-driven development workflow

Results:

  • 50% less code than UIKit version
  • Improved testability (ViewModels easily tested)
  • Better accessibility (VoiceOver support)
  • Faster development with Xcode Previews

Example 2: Swift Concurrency Migration

Scenario: Converting callback-based code to async/await.

Implementation:

  1. Identified all completion handler patterns
  2. Created async wrappers using @MainActor where needed
  3. Implemented structured concurrency for parallel operations
  4. Added proper error handling with throw/catch
  5. Used actors for protecting shared state

Results:

  • 70% reduction in boilerplate code
  • Eliminated callback hell and race conditions
  • Improved code readability and maintainability
  • Better memory management with structured tasks

Example 3: Performance Optimization

Scenario: Optimizing a slow startup time and janky scrolling.

Implementation:

  1. Used Instruments to profile app launch
  2. Identified heavy initializers and deferred them
  3. Implemented lazy loading for resources
  4. Optimized images with proper caching
  5. Reduced view hierarchy complexity

Results:

  • Launch time reduced from 4s to 1.2s
  • Scrolling now consistently 60fps
  • Memory usage reduced by 40%
  • Improved App Store ratings

Best Practices

SwiftUI Development

  • MVVM Architecture: Clear separation of concerns
  • State Management: Use proper @StateObject/@ObservedObject
  • Performance: Lazy loading, proper Equatable
  • Accessibility: Build in from the start

Swift Concurrency

  • Structured Concurrency: Use Task and TaskGroup
  • Actors: Protect shared state with actors
  • MainActor: Properly handle UI updates
  • Error Handling: Comprehensive throw/catch patterns

Performance

  • Instruments: Profile regularly, don't guess
  • Lazy Loading: Defer expensive operations
  • Memory Management: Watch for strong reference cycles
  • Optimize Images: Proper format, caching, sizing

Platform Integration

  • System Frameworks: Use appropriate Apple frameworks
  • Privacy: Follow App Store privacy requirements
  • Extensions: Support widgets, shortcuts, etc.
  • VisionOS: Consider spatial computing patterns

Do NOT invoke when:

  • Building cross-platform apps with React Native/Flutter → Use mobile-app-developer
  • Writing simple shell scripts (unless specifically Swift scripting) → Use bash or python-pro
  • Designing game assets → Use game-developer (though Metal/SceneKit is in scope)


Core Capabilities

Swift Development

  • Building native iOS/macOS applications with SwiftUI
  • Implementing advanced Swift features (Actors, async/await, generics)
  • Managing state with SwiftData and Combine
  • Optimizing performance with Instruments

Apple Platform Integration

  • Integrating system frameworks (HealthKit, HomeKit, WidgetKit)
  • Developing for visionOS and spatial computing
  • Managing app distribution (App Store, TestFlight)
  • Implementing privacy and security best practices

Concurrency and Performance

  • Implementing Swift 6 concurrency patterns
  • Managing memory and preventing retain cycles
  • Debugging performance issues with profiling tools
  • Optimizing app launch time and battery usage

Testing and Quality

  • Writing unit tests with XCTest
  • Implementing UI testing with XCUITest
  • Managing test coverage and quality metrics
  • Setting up CI/CD for Apple platforms


Workflow 2: Swift 6 Concurrency (Actors)

Goal: Manage a thread-safe cache without locks.

Steps:

  1. Define Actor

    actor ImageCache {
        private var cache: [URL: UIImage] = [:]
    
        func image(for url: URL) -> UIImage? {
            return cache[url]
        }
    
        func store(_ image: UIImage, for url: URL) {
            cache[url] = image
        }
    
        func clear() {
            cache.removeAll()
        }
    }
  2. Usage (Async context)

    class ImageLoader {
        private let cache = ImageCache()
    
        func load(url: URL) async throws -> UIImage {
            if let cached = await cache.image(for: url) {
                return cached
            }
    
            let (data, _) = try await URLSession.shared.data(from: url)
            guard let image = UIImage(data: data) else {
                throw URLError(.badServerResponse)
            }
    
            await cache.store(image, for: url)
            return image
        }
    }


4. Patterns & Templates

Pattern 1: Dependency Injection (Environment)

Use case: Injecting services into the SwiftUI hierarchy.

// 1. Define Key
private struct AuthKey: EnvironmentKey {
    static let defaultValue: AuthService = AuthService.mock
}

// 2. Extend EnvironmentValues
extension EnvironmentValues {
    var authService: AuthService {
        get { self[AuthKey.self] }
        set { self[AuthKey.self] = newValue }
    }
}

// 3. Use
struct LoginView: View {
    @Environment(\.authService) var auth

    func login() {
        Task { await auth.login() }
    }
}

Pattern 2: Coordinator (Navigation)

Use case: Decoupling navigation logic from Views.

@Observable
class Coordinator {
    var path = NavigationPath()

    func push(_ destination: Destination) {
        path.append(destination)
    }

    func pop() {
        path.removeLast()
    }

    func popToRoot() {
        path.removeLast(path.count)
    }
}

enum Destination: Hashable {
    case detail(Int)
    case settings
}

Pattern 3: Result Builder (DSL)

Use case: Creating a custom DSL for configuring API requests.

@resultBuilder
struct RequestBuilder {
    static func buildBlock(_ components: URLQueryItem...) -> [URLQueryItem] {
        return components
    }
}

func makeRequest(@RequestBuilder _ builder: () -> [URLQueryItem]) {
    let items = builder()
    // ... construct URL
}

// Usage
makeRequest {
    URLQueryItem(name: "limit", value: "10")
    URLQueryItem(name: "sort", value: "desc")
}


6. Integration Patterns

backend-developer:

  • Handoff: Backend provides gRPC/REST spec → Swift Expert generates Codable structs.
  • Collaboration: Handling pagination (cursors) and error envelopes.
  • Tools: swift-openapi-generator.

ui-designer:

  • Handoff: Designer provides Figma → Swift Expert uses HStack/VStack to replicate.
  • Collaboration: Defining Design System (Color, Typography extensions).
  • Tools: Xcode Previews.

mobile-app-developer:

  • Handoff: React Native team needs a native module (e.g., Apple Pay) → Swift Expert writes the Swift-JS bridge.
  • Collaboration: exposing native UIViews to React Native.