swift-conventions

swift-conventions is a skill for Claude Code, Codex from tmj-90/gaffer. It costs 133 tokens per session (1,998 once invoked), scanned A, original, Apache-2.0.

A set of conventions for writing Swift code, the programming language used for Apple apps and also some server software. It covers common Swift patterns, safe handling of missing values, concurrency, and the project’s lint rules.

In plain words
What is it for?
Use it when adding or changing Swift, SwiftUI, UIKit, or server-side Swift code, including work involving async operations, app architecture, and SwiftLint.
Why use it?
Swift code can crash or behave incorrectly when missing values and concurrent work are handled carelessly. Following the repository’s existing style also keeps new code consistent.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when adding or changing Swift, SwiftUI, UIKit, or server-side Swift code, including work involving async operations, app architecture, and SwiftLint.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tmj-90/gaffer/swift-conventions
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.

Any agent
npx skills add tmj-90/gaffer --skill swift-conventions
Clone the repo
git clone --depth 1 https://github.com/tmj-90/gaffer

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-conventions

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmj-90/gaffer/swift-conventions/github.svg)](https://agentmods.dev/skills/tmj-90/gaffer/swift-conventions)
Your own site
<a href="https://agentmods.dev/skills/tmj-90/gaffer/swift-conventions"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/swift-conventions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for swift-conventions

Your own site · 80×15
<a href="https://agentmods.dev/skills/tmj-90/gaffer/swift-conventions"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/swift-conventions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 133 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,998 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00133 $0.01998
Opus 5.5 $0.00053 $0.00799
Sonnet 5.5 $0.00027 $0.00400
Haiku 4.5 $0.00013 $0.00200

Measured 16d ago against content hash 2cc95fc96aad, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

swift-conventions 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 16d 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.

runner/skills/swift-conventions/SKILL.md · 121 lines

How it starts

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

Write idiomatic Swift

Swift is safest when values are structs, absence is an optional you handle, and concurrency is checked by the compiler through actors and Sendable. For the builder and the reviewer of a Swift diff; the target's settings and existing code win over it.

Procedure

  1. Discover the target's conventions first. Call search_lore for Swift conventions. Read Package.swift (swift-tools-version, swiftLanguageModes, swiftSettings such as upcoming features or defaultIsolation(MainActor.self)), or the Xcode build settings (SWIFT_VERSION, SWIFT_STRICT_CONCURRENCY, SWIFT_DEFAULT_ACTOR_ISOLATION, approachable-concurrency flags), project.yml (XcodeGen/Tuist), .swiftlint.yml, .swift-format, and the minimum OS. The language mode decides the rules: in Swift 6 mode data-race diagnostics are errors; with default MainActor isolation (6.2) code is main-actor unless marked otherwise. Identify SwiftUI vs UIKit, the architecture (@Observable MVVM, TCA), and XCTest vs Swift Testing. Copy a sibling feature and test.
  2. Pin the exact commands from CI, Makefile or fastlane (the run-tests and run-lint skills), including the scheme and simulator destination. Use the defaults below only when the repo defines none.
  3. Write the change with the idioms below, then walk the concurrency section for every task, actor, closure, file and shared object you touched.
  4. Test each acceptance criterion's own behaviour. One test per AC that fails without your change, plus its error path (@Test(arguments:) for tables). If the AC involves shared state or persistence, add a test that runs N concurrent calls in a withTaskGroup and asserts the invariant.
  5. Verify, then stop. Done when: the build has no new warnings in the configured language mode, SwiftLint/swift-format are clean, tests are green on the repo's destination, and every AC has a test. Record the output with the record-evidence skill; the runner submits the work.

Read the full file on GitHub · 121 lines

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. 16d ago Changed · +46 lines · +25 tokens per session 2cc95fc96aad
  2. 19d ago First seen · 75 lines · 108 tokens per session scan A b6cfeb4d6ffc

Subscribe to this mod's changes

swift-conventions is a skill published in the GitHub repository tmj-90/gaffer (2 stars, last pushed 17d ago), licensed Apache-2.0. It adds 133 tokens to every session and 1,998 once invoked, about $0.0005 per session on Opus 5.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-09-28.