swift

swift is a skill for Claude Code, Codex from ndisisnd/cook. It costs 56 tokens per session (1,877 once invoked), scanned A, original, MIT.

A set of standards for writing and reviewing Swift 6.x code, Swift being Apple's programming language for apps and other software.

In plain words
What is it for?
Writing or reviewing Swift code, including protocols, generics, actors, Sendable, and MainActor. It does not cover app architecture or platform-specific concerns.
Why use it?
It helps avoid common language errors around optional values, error handling, concurrency, memory, naming, and access control.

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/ndisisnd/cook/swift
Any agent
npx skills add ndisisnd/cook --skill swift
Clone the repo
git clone --depth 1 https://github.com/ndisisnd/cook

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swift

README.md
[![agentmods](https://agentmods.dev/badge/skills/ndisisnd/cook/swift.svg)](https://agentmods.dev/skills/ndisisnd/cook/swift)
Your own site
<a href="https://agentmods.dev/skills/ndisisnd/cook/swift"><img src="https://agentmods.dev/badge/skills/ndisisnd/cook/swift.svg" alt="Measured on agentmods" height="20"></a>
Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,877 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.00056 $0.01877
Opus 5 $0.00028 $0.00938
Sonnet 5 $0.00011 $0.00375
Haiku 4.5 $0.00006 $0.00188

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

Security

Grade A, and why

swift 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 3d 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.

standards/swift/SKILL.md · 127 lines

How it starts

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

Swift Standards

Default load: this file only; pull refs (see References) on demand.

Swift owns language-level correctness only: optionals, errors, concurrency semantics, value/reference types, protocols and generics, ARC, naming, access control. Platform and app-shape concerns — scenes/windows, SwiftUI architecture, sandboxing, distribution, persistence, localization — live in standards/macos/. Universal rules stay in standards/global/.

Scope: these rules apply in full to new targets and modules. In existing code, match established conventions; propose migrations (language mode, ObservableObject@Observable, deployment targets, dependency swaps) as separate explicit tasks — never as a side effect of a feature change.

Priority: P0 — Language Correctness

Language Mode, Isolation & Concurrency

P0 rules → refs/concurrency.md — load for any concurrency, isolation, or language-mode task.

Availability

  • Gate every API newer than the deployment target with if #available / @available and a real fallback path. Annotate declarations rather than sprinkling runtime checks. Never raise the deployment target to dodge a check.

Optionals

  • Never force-unwrap (!) or force-cast (as!) in production paths. If non-nil is a true invariant, use guard let x else { preconditionFailure("why") } so failure carries a message.
  • No implicitly unwrapped optionals (T!) in new pure-Swift code; acceptable only for UI-lifecycle objects (@IBOutlet) and Obj-C bridging.
  • guard let for early-exit preconditions (happy path stays unindented); if let for genuine branching. Use shorthand: if let user, guard let self.
  • Prefer ?? and optional chaining; never if x != nil followed by x!.
  • Return empty collections, not optional collections, unless nil vs empty is semantically meaningful.

Error Handling

  • Untyped throws is the default. Typed throws (throws(E)) only for closed error domains in libraries, generic error propagation (a typed alternative to rethrows), and measured hot paths — error domains grow, and typed errors become breaking changes.
  • Never try! outside tests. try? only when nil is a genuinely acceptable outcome — never to discard an error that matters. Don't return nil to signal failure — throw.
  • Result is for storing an error or crossing a non-throwing boundary — not a general replacement for throws. Convert with Result(catching:) / .get().
  • Domain errors are enums/structs with associated values; user-facing errors conform to LocalizedError, separating user message from debug detail.
  • Use defer for cleanup that must run on every exit path, including thrown errors.

Read the full file on GitHub · 127 lines

Files

What ships with it

8 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. 3d ago First seen · 127 lines · 56 tokens per session scan A b817b37e2517

Subscribe to this mod's changes

swift is a skill published in the GitHub repository ndisisnd/cook (2 stars, last pushed 23d ago), licensed MIT. It adds 56 tokens to every session and 1,877 once invoked, about $0.0003 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-31.

Related

Other skills, from other repositories

kotlin-specialist

Provides idiomatic Kotlin implementation patterns including coroutine concurrency, Flow stream handling, multiplatform architecture, Compose UI construction, Ktor server setup, and type-safe DSL design. Use when building Kotlin applications requiring coroutines, multiplatform development, or Android with Compose.…

Jeffallan/claude-skills · 86 tokens

macos-swiftpm

Build, run, and test SwiftPM macOS packages and executables. Use when the repo is package-first or has no Xcode project.

robinebers/openusage · 35 tokens

kotlin-tooling-java-to-kotlin

Use when converting Java source files to idiomatic Kotlin, when user mentions "java to kotlin", "j2k", "convert java", "migrate java to kotlin", or when working with .java files that need to become .kt files. Handles framework-aware conversion for Spring, Lombok, Hibernate, Jackson, Micronaut, Quarkus, Dagger/Hilt…

Kotlin/kotlin-agent-skills · 100 tokens

swift-mlx

MLX Swift - High-performance ML framework for Apple Silicon with lazy evaluation, automatic differentiation, and unified memory.

kellyvv/PhoneClaw · 25 tokens

signals-migration-6-to-7

Detailed guidelines, patterns, and rules for migrating codebases from signals.dart version 6.x to version 7.x.

rodydavis/signals.dart · 33 tokens

Swift Performance Optimization Skill

Use when investigating measured Swift or Apple-platform regressions in CPU, memory, launch, scrolling, animation hitches, image processing, energy, networking, or concurrency, or when designing performance tests and Instruments experiments. Do not use for speculative micro-optimization, ordinary refactoring, or a…

termio-sh/termio · 68 tokens