Swift Expert logo

Swift Expert

Community
Viniciuscarvalho
swift-expert

Swift specialist for iOS/macOS development with Swift 6.0+, SwiftUI, async/await concurrency, and protocol-oriented design. Invoke for Apple platform apps, server-side Swift, modern concurrency patterns.

Overview

PublisherViniciuscarvalho
Repositoryswift-code-reviewer-skill
Skill nameswift-expert
Stars
39
Forks
6
Bundled files
6
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 6 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by Viniciuscarvalho on GitHub. Read the source before you install it.

Installation

Install the Swift Expert AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Viniciuscarvalho/swift-code-reviewer-skill/tree/main/skills/swift-expert
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Viniciuscarvalho/swift-code-reviewer-skill.git /tmp/swift-code-reviewer-skill
mkdir -p .claude/skills
cp -r /tmp/swift-code-reviewer-skill/skills/swift-expert .claude/skills/swift-expert
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Swift Expert in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Swift Expert on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Swift Expert is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Swift Expert

Reference Guide

TopicReferenceLoad when
SwiftUIreferences/swiftui-patterns.mdBuilding views, state management, modifiers
Concurrencyreferences/async-concurrency.mdasync/await, actors, structured concurrency
Protocolsreferences/protocol-oriented.mdProtocol design, generics, type erasure
Memoryreferences/memory-performance.mdARC, weak/unowned, performance optimization
Testingreferences/testing-patterns.mdXCTest, async tests, mocking strategies

Rules

Always:

  • Use async/await; prefer structured concurrency (TaskGroup, child tasks) over Task.detached
  • Annotate @MainActor on types that own UI-bound state; never mutate @Observable storage from a non-main-actor context
  • Conform to Sendable when crossing actor boundaries; document the safety invariant on @unchecked Sendable
  • Default to value types (struct/enum); use class only when reference semantics or identity are required
  • Use guard let / if let / try; never ! or as! without a justified comment explaining why it cannot fail

Never:

  • Create retain cycles — capture [weak self] in escaping closures that outlive their owner
  • Mix DispatchQueue and async/await in the same call path without an explicit isolation boundary
  • Ignore actor isolation warnings; fix the root cause, do not reach for nonisolated(unsafe)
  • Use @preconcurrency without a follow-up to remove it once the dependency is migrated

Code Examples

Swift 6 strict concurrency — actor + Sendable + @MainActor ViewModel

swift
// Value type: Sendable — safe to pass across isolation boundaries
struct Post: Sendable, Identifiable {
    let id: UUID
    let title: String
    let body: String
}

// Service actor: owns mutable cache; callers must await
actor PostRepository {
    private var cache: [UUID: Post] = [:]
    private let client: NetworkClient  // NetworkClient must itself be Sendable

    func post(id: UUID) async throws -> Post {
        if let hit = cache[id] { return hit }
        let post = try await client.fetchPost(id: id)
        cache[id] = post
        return post
    }
}

// ViewModel: @MainActor isolates all state to the main thread
@MainActor
@Observable
final class PostDetailViewModel {
    var post: Post?
    var isLoading = false
    var error: Error?

    private let repository: PostRepository

    init(repository: PostRepository) {
        self.repository = repository
    }

    func load(id: UUID) async {
        isLoading = true
        defer { isLoading = false }
        do {
            post = try await repository.post(id: id)
        } catch {
            self.error = error
        }
    }
}

Key points: Post is a Sendable value type, PostRepository is an actor so its cache is mutation-safe, and the ViewModel is @MainActor so all @Observable storage updates are on the main thread — zero data races under Swift 6 strict concurrency.


SwiftUI @Observable + @Environment dependency injection

swift
// Shared router injected via Environment — avoids prop-drilling through view tree
@Observable
final class AppRouter {
    var path: [Route] = []
    func push(_ route: Route) { path.append(route) }
    func pop() { guard !path.isEmpty else { return }; path.removeLast() }
}

@main
struct MyApp: App {
    @State private var router = AppRouter()

    var body: some Scene {
        WindowGroup {
            RootView()
                .environment(router)
        }
    }
}

// Any descendant reads the router without an explicit init parameter
struct FeedView: View {
    @Environment(AppRouter.self) private var router
    let posts: [Post]

    var body: some View {
        List(posts) { post in
            PostRow(post: post)
                .onTapGesture { router.push(.postDetail(post.id)) }
        }
    }
}

Use @Environment for cross-cutting shared objects (router, theme, auth state). Use @State in the root scene — not as a global — so the object lifetime is tied to the window.


Protocol-oriented design with primary associated types

swift
// Primary associated type enables `some` / `any` at call sites
protocol DataStore<Value>: Sendable {
    associatedtype Value: Sendable & Identifiable
    func fetch(id: Value.ID) async throws -> Value
    func save(_ value: Value) async throws
}

// Concrete implementation is an actor for thread-safe storage
actor UserStore: DataStore {
    typealias Value = User
    private var db: [User.ID: User] = [:]

    func fetch(id: User.ID) async throws -> User {
        guard let user = db[id] else { throw StoreError.notFound(id) }
        return user
    }
    func save(_ value: User) async throws { db[value.id] = value }
}

// Generic function: no `any` boxing, full type-checking, parallel prefetch
func prefetch<Store: DataStore>(
    ids: [Store.Value.ID],
    from store: Store
) async throws -> [Store.Value] {
    try await withThrowingTaskGroup(of: Store.Value.self) { group in
        for id in ids { group.addTask { try await store.fetch(id: id) } }
        return try await group.reduce(into: []) { $0.append($1) }
    }
}

// Opaque return: caller gets full type-checking, implementation stays hidden
func makeUserStore() -> some DataStore<User> { UserStore() }

Prefer some DataStore<User> over any DataStore<User> when the concrete type is fixed at the call site — no heap allocation for the existential box.

Project Structure

Feature-slice layout scales better than layer-slice beyond three features:

Sources/
  App/            ← entry point, root scene, environment wiring only
  Features/
    Feed/         ← FeedView, FeedViewModel, FeedRepository (co-located)
    Profile/
    Settings/
  Core/
    Models/       ← Sendable value types, no UIKit/SwiftUI imports
    Network/      ← NetworkClient protocol + actor implementation
    Storage/      ← persistence actors
  DesignSystem/   ← colors, fonts, reusable views — zero business logic
Tests/
  FeedTests/
  CoreTests/

Extract a Swift Package target when:

  • A feature or layer needs to be mocked in tests without importing the concrete dependency
  • A module is shared by an app extension (widget, share extension, Watch app)
  • A build-time regression is traced to a specific module boundary

Minimum viable Package.swift for a modular app:

swift
// swift-tools-version: 6.0
let package = Package(
    name: "MyApp",
    platforms: [.iOS(.v17), .macOS(.v14)],
    targets: [
        .target(
            name: "Core",
            dependencies: [],
            swiftSettings: [.enableExperimentalFeature("StrictConcurrency")]
        ),
        .target(
            name: "DesignSystem",
            dependencies: []
        ),
        .target(
            name: "Features",
            dependencies: ["Core", "DesignSystem"]
        ),
        .testTarget(
            name: "FeaturesTests",
            dependencies: ["Features"]
        ),
    ]
)

Core has no upward dependencies. Features imports Core and DesignSystem. Tests import only the target under test.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Swift Expert AI skill do?

Swift specialist for iOS/macOS development with Swift 6.0+, SwiftUI, async/await concurrency, and protocol-oriented design. Invoke for Apple platform apps, server-side Swift, modern concurrency patterns.

Why use Swift Expert on TypingMind?

Because you install it once and use it with any model. Swift Expert is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Swift Expert in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Viniciuscarvalho/swift-code-reviewer-skill/tree/main/skills/swift-expert. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Swift Expert?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Swift Expert?

As many as you like. As long as a model supports skills, you can use Swift Expert with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Swift Expert AI skill free?

Yes. It is published on GitHub by Viniciuscarvalho under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇