swift-development

A set of practices for developing Swift 6 and newer applications on recent Apple operating systems, with emphasis on safe concurrent code and clear APIs.

In plain words
What is it for?
It guides writing and reviewing Swift code, designing public interfaces, using async code, and migrating older Swift code.
Why use it?
It helps prevent concurrency errors and keeps Swift code easier to understand, document, and maintain.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/sammcj/agentic-coding/swift-development
Any agent
npx skills add sammcj/agentic-coding --skill swift-development
Clone the repo
git clone --depth 1 https://github.com/sammcj/agentic-coding

Made for: Claude Code, Codex.

Per session 13 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,162 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00013 $0.02162
Opus 5 $0.00006 $0.01081
Sonnet 5 $0.00003 $0.00432
Haiku 4.5 $0.00001 $0.00216

Measured 2d ago against content hash 8287054a0174, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

swift-development scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Skills/swift-development/SKILL.md · 257 lines

How it starts

The opening of the file, as written. The whole thing — 257 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Swift Best Practices Skill

Overview

Apply modern Swift development best practices focusing on Swift 6+ features, concurrency safety, API design principles, and code quality guidelines for iOS and macOS projects targeting macOS 15.7+.

When to Use This Skill

Use this skill when:

  • Writing new Swift code for iOS or macOS applications
  • Reviewing Swift code for correctness, safety, and style
  • Implementing Swift concurrency features (async/await, actors, MainActor)
  • Designing Swift APIs and public interfaces
  • Migrating code from Swift 5 to Swift 6
  • Addressing concurrency warnings, data race issues, or compiler errors related to Sendable/isolation
  • Working with modern Swift language features introduced in Swift 6 and 6.2

Core Guidelines

Fundamental Principles

  1. Clarity at point of use is paramount - evaluate designs by examining use cases, not just declarations
  2. Clarity over brevity - compact code comes from the type system, not minimal characters
  3. Write documentation for every public declaration - if you can't describe functionality simply, the API may be poorly designed
  4. Name by role, not type - var greeting = "Hello" not var string = "Hello"
  5. Favour elegance through simplicity - avoid over-engineering unless complexity genuinely warrants it

Swift 6 Concurrency Model

Swift 6 enables complete concurrency checking by default with region-based isolation (SE-0414). The compiler now proves code safety, eliminating many false positives whilst catching real concurrency issues at compile time.

Critical understanding:

  • Async ≠ background - async functions can suspend but don't automatically run on background threads
  • Actors protect mutable shared state through automatic synchronisation
  • @MainActor ensures UI-related code executes on the main thread
  • Global actor-isolated types are automatically Sendable

Essential Patterns

Async/Await
// Parallel execution with async let
func fetchData() async -> (String, Int) {
    async let stringData = fetchString()
    async let intData = fetchInt()
    return await (stringData, intData)
}

// Always check cancellation in long-running operations
func process(_ items: [Item]) async throws -> [Result] {
    var results: [Result] = []
    for item in items {
        try Task.checkCancellation()
        results.append(await process(item))
    }
    return results
}

Read the full file on GitHub · 257 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 257 lines · 13 tokens per session scan A 8287054a0174

Subscribe to this mod's changes

swift-development is a skill published in the GitHub repository sammcj/agentic-coding (158 stars, last pushed 8d ago), licensed Apache-2.0. It adds 13 tokens to every session and 2,162 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.