swift-strict

swift-strict is a skill for Claude Code, Codex from 0xMassi/claude-skills. It costs 87 tokens per session (3,218 once invoked), scanned A, original, MIT.

A strict coding standard for Swift and SwiftUI, Apple's languages and tools for building iPhone, iPad, and Mac apps. It emphasizes safe unwrapping, clear access control, concurrency safety, and explicit error handling.

In plain words
What is it for?
Use it when writing, reviewing, or refactoring Swift code in iOS or macOS projects.
Why use it?
It reduces crashes, unsafe data access, concurrency bugs, and inconsistent production code.

Skill for Claude CodeCodex

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

Good fit Use it when writing, reviewing, or refactoring Swift code in iOS or macOS projects.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/0xmassi/claude-skills/swift-strict
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 0xMassi/claude-skills --skill swift-strict
Clone the repo
git clone --depth 1 https://github.com/0xMassi/claude-skills

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/0xmassi/claude-skills/swift-strict/github.svg)](https://agentmods.dev/skills/0xmassi/claude-skills/swift-strict)
Your own site
<a href="https://agentmods.dev/skills/0xmassi/claude-skills/swift-strict"><img src="https://agentmods.dev/badge/skills/0xmassi/claude-skills/swift-strict/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-strict

Your own site · 80×15
<a href="https://agentmods.dev/skills/0xmassi/claude-skills/swift-strict"><img src="https://agentmods.dev/badge/skills/0xmassi/claude-skills/swift-strict.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 87 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,218 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.00087 $0.03218
Opus 5 $0.00044 $0.01609
Sonnet 5 $0.00017 $0.00644
Haiku 4.5 $0.00009 $0.00322

Measured 11d ago against content hash e97746ac47c9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

swift-strict 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 11d 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.

swift-strict/SKILL.md · 474 lines

How it starts

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

Swift Strict Standard

Rules extracted from 3 production SwiftUI iOS apps.

CRITICAL: Unwrapping Rules

SW-01: Never force unwrap in production code

// BAD
let name = user!.name
let url = URL(string: urlString)!
let day = calendar.date(byAdding: .day, value: -1, to: date)!

// GOOD
guard let name = user?.name else { return }
guard let url = URL(string: urlString) else {
    throw AppError.invalidURL(urlString)
}
guard let day = calendar.date(byAdding: .day, value: -1, to: date) else { return }

Exceptions (very rare, must justify):

  • fatalError() in required init?(coder:) for programmatic-only views
  • @IBOutlet connections (but prefer programmatic UI)

SW-02: Use guard let for early returns, if let for scoped binding

// GOOD: guard for early exit (preferred pattern)
func listNotes(in folder: String) -> [Note] {
    guard let root = cloud.stikRoot else { return [] }
    guard let files = try? fm.contentsOfDirectory(at: root) else { return [] }
    return files.filter { ... }
}

// GOOD: if let when value only needed in branch
if let fileName = removed.photoFilename {
    let url = Self.photosDir.appendingPathComponent(fileName)
    try? fm.removeItem(at: url)
}

Default to guard. Use if-let only when the value is needed for one branch.

SW-03: Avoid try? for critical operations

// BAD: silently swallows error
try? FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)

// GOOD: handle or propagate
do {
    try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)
} catch {
    logger.error("Failed to create directory: \(error)")
    throw AppError.fileSystemError(error)
}

// ACCEPTABLE: truly optional operations
try? fm.removeItem(at: tempFile) // Cleanup, failure is OK

CRITICAL: Error Handling

SW-04: Custom error enums with LocalizedError

enum AppError: LocalizedError {
    case invalidFolderName
    case containerUnavailable
    case networkUnavailable
    case unauthorized
    case serverError(Int)

    var errorDescription: String? {
        switch self {
        case .invalidFolderName: String(localized: "error_invalid_folder")
        case .containerUnavailable: String(localized: "error_container")
        case .networkUnavailable: String(localized: "error_network")
        case .unauthorized: String(localized: "error_unauthorized")
        case .serverError(let code): String(localized: "error_server \(code)")
        }
    }
}

Read the full file on GitHub · 474 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. 11d ago First seen · 474 lines · 87 tokens per session scan A e97746ac47c9

Subscribe to this mod's changes

swift-strict is a skill published in the GitHub repository 0xMassi/claude-skills (7 stars, last pushed 4mo ago), licensed MIT. It adds 87 tokens to every session and 3,218 once invoked, about $0.0004 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

coding-best-practices

Reviews Swift/iOS code for adherence to modern Swift idioms, Apple platform best practices, architecture patterns, and code quality standards. Use when user mentions best practices, code review, clean code, refactoring, or wants to improve code quality.

rshankras/claude-code-apple-skills · 55 tokens

spec-implement

Continue an approved Spec-backed workflow when the user says "implement", "go", "start", or "do it". After Codex Plan Mode, persist the next missing design.md or plan.json artifact and stop. When both artifacts exist, execute plan.json with TDD and report between batches.

martinffx/atelier · 63 tokens

kotlin-reviewer

Use when reviewing a Kotlin/Spring Boot pull request, systematic checklist covering architecture, idioms, testing, security, and observability.

pranav8494/team-of-agents · 31 tokens

swift-concurrency-review

Use when reviewing Swift 5.5+ code containing await, actor, Task { }, @MainActor, @unchecked Sendable, cancellable timer/deadline handles, or long-lived for await AsyncStream consumers — especially diffs extending existing actors with new methods. Catches post-await state-overwrite races, TOCTOU around Task spawn…

stuartshields/claude-setup · 112 tokens

kotlin-patterns

Kotlin 2.0+ discipline — null safety (no !! force-unwrap; safe call + Elvis), immutability (val over var; data class + copy), sealed classes for closed hierarchies, scope functions (let/run/apply/also/with) used purposefully, structured concurrency via coroutines (no GlobalScope.launch; supervisor scopes + Job…

Nmor/the-claude-council · 120 tokens

dart-flutter-patterns

Dart 3.x / Flutter discipline — null safety mandatory; force-unwrap (!) banned outside justified narrow cases; const constructors everywhere possible; Riverpod / BLoC for state; freezed for immutable models + sealed unions; gorouter for navigation; structured concurrency via async/await + Stream; Material 3 /…

Nmor/the-claude-council · 95 tokens