swift-language-pro

swift-language-pro is a skill for Claude Code from laxrajpurohit/swift-skills-pro. It costs 37 tokens per session (811 once invoked), scanned A, original, MIT.

A guide to writing and reviewing core Swift code, including data types, optionals, errors, generics, protocols, naming, and API design. It focuses on non-interface code such as models, services, and utilities.

In plain words
What is it for?
Use it when designing Swift APIs, choosing between structs and classes, modeling valid states, handling errors, reviewing generics or protocols, and improving names.
Why use it?
It helps prevent unsafe optional handling, unclear interfaces, accidental shared changes, and error handling that hides failures.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the swift-language-pro plugin — 1 skill shipped together

Good fit Use it when designing Swift APIs, choosing between structs and classes, modeling valid states, handling errors, reviewing generics or protocols, and improving names.

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

Made for: Claude Code.

Or install swift-language-pro, the plugin that ships this one along with the rest of its 1 skill.

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-language-pro

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/laxrajpurohit/swift-skills-pro/swift-language-pro"><img src="https://agentmods.dev/badge/skills/laxrajpurohit/swift-skills-pro/swift-language-pro.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 811 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.00037 $0.00811
Opus 5 $0.00018 $0.00405
Sonnet 5 $0.00007 $0.00162
Haiku 4.5 $0.00004 $0.00081

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

Security

Grade A, and why

swift-language-pro 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 12d 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-language-pro/skills/swift-language-pro/SKILL.md · 122 lines

How it starts

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

Swift Language Pro

Write idiomatic, safe, modern Swift. Follow Apple's API Design Guidelines.

When to use

  • Writing or reviewing non-UI Swift (models, services, utilities).
  • Designing public APIs, naming, and type choices.
  • Cleaning up optional handling, error handling, or generics.

Trigger: /swift-language-pro.

Core principles

  • Prefer value types (struct/enum) by default; use class only for identity or reference semantics.
  • Make illegal states unrepresentable with enums and non-optional types.
  • Throw typed errors; don't return sentinel values or booleans for failure.
  • Name for clarity at the call site, not the definition.

Value vs reference

class Point { var x = 0.0; var y = 0.0 }   // accidental shared mutation

struct Point { var x = 0.0; var y = 0.0 }

Model with enums, kill optionals

❌ Two bools that allow impossible states

struct State { var isLoading: Bool; var error: Error? }   // loading + error?

enum LoadState<Value> { case idle, loading, loaded(Value), failed(Error) }

Optionals

  • Unwrap with if let / guard let; avoid force-unwrap ! outside tests.
  • guard for early exit, keeping the happy path unindented.

func name(_ u: User?) -> String { return u!.name }

func name(_ u: User?) -> String {
    guard let u else { return "Guest" }
    return u.name
}

Error handling

❌ Boolean failure

func save() -> Bool

enum SaveError: Error { case diskFull, notAuthorized }
func save() throws    // call sites use try/catch; errors carry meaning

API design (naming)

  • Read at the call site like a phrase. Include the noun a method acts on.
  • Omit needless words; drop type names from labels.

func insertObject(_ obj: Element, atIndex i: Int)
list.insertObject(x, atIndex: 0)

func insert(_ element: Element, at index: Int)
list.insert(x, at: 0)

Generics & protocols

  • Constrain generics with where; prefer protocols with associated types over Any.
  • Use protocol extensions for default behavior; don't reach for class inheritance.

Read the full file on GitHub · 122 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. 12d ago First seen · 122 lines · 37 tokens per session scan A d2fa53e009ca

Subscribe to this mod's changes

swift-language-pro is a skill published in the GitHub repository laxrajpurohit/swift-skills-pro (5 stars, last pushed 3mo ago), licensed MIT. It adds 37 tokens to every session and 811 once invoked, about $0.0002 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

generators

Code generator skills that produce production-ready Swift code for common app components. Use when user wants to add logging, analytics, onboarding, review prompts, networking, authentication, paywalls, settings, persistence, error monitoring, CI/CD pipelines, localization, push notifications, deep linking, testing…

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

attributed-string

AttributedString patterns for rich text formatting, alignment, selection, and SwiftUI integration. Use when working with styled text, text editing, or AttributedString APIs.

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

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

networking-layer

Generates a protocol-based networking layer with async/await, error handling, and swappable implementations. Use when user wants to add API client, networking, or HTTP layer.

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

foundation

Foundation framework skills — AttributedString patterns for rich text formatting, alignment, selection, and SwiftUI integration. Use when working with styled text or AttributedString APIs.

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

android-sdk-knowledge-patch

Use this skill when updating Android applications, libraries, build logic, or Play delivery settings where recent platform and Android Gradle Plugin behavior can affect compatibility. Check the project's compileSdk, targetSdk, minSdk, AGP, Gradle, JDK, Kotlin, KSP, NDK, and form factors before applying target-gated…

Nevaberry/nevaberry-plugins · 9 tokens