swift-rules

swift-rules is a skill for Claude Code from softspark/ai-toolkit. It costs 41 tokens per session (3,219 once invoked), scanned A, original, Apache-2.0.

A set of coding, security, testing, and style rules for Swift projects, including SwiftUI, Combine, asynchronous code, and XCTest.

In plain words
What is it for?
Use it when writing or reviewing Swift files, Swift packages, Xcode projects, or Apple-platform tests.
Why use it?
It gives Swift code a consistent structure and highlights common safety and maintainability practices.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: positional $N argument.

Part of the ai-toolkit plugin — 115 skills, 44 agents, 14 hooks shipped together

Good fit Use it when writing or reviewing Swift files, Swift packages, Xcode projects, or Apple-platform tests.

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

Made for: Claude Code.

Or install ai-toolkit, the plugin that ships this one along with the rest of its 115 skills, 44 agents, 14 hooks.

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

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/softspark/ai-toolkit/swift-rules"><img src="https://agentmods.dev/badge/skills/softspark/ai-toolkit/swift-rules.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,219 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. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 5 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Privilege Escalation · line 216
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 185
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 187
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 189
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • medium Rogue Agent · line 188
    Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
    Fix: Remove any persistence mechanisms (cron jobs, startup scripts, state files). Skills should not maintain state across sessions without explicit user consent.
How audits are shown
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.00041 $0.03219
Opus 5 $0.00020 $0.01610
Sonnet 5 $0.00008 $0.00644
Haiku 4.5 $0.00004 $0.00322

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

Security

Grade A, and why

swift-rules 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 8d 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.

app/skills/swift-rules/SKILL.md · 294 lines

How it starts

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

Swift Rules

These rules come from app/rules/swift/ in ai-toolkit. They cover the project's standards for coding style, frameworks, patterns, security, and testing in Swift. Apply them when writing or reviewing Swift code.

Swift Coding Style

Naming

  • PascalCase: types, protocols, enums, struct, class.
  • camelCase: functions, methods, properties, variables, enum cases.
  • No prefixes: Swift has module namespacing (no NS or UI prefix for your types).
  • Use descriptive names: removeElement(at:) not remove(i:).
  • Boolean properties read as assertions: isEmpty, hasChildren, canSubmit.

Types

  • Prefer struct over class by default (value semantics, no reference cycles).
  • Use class only when reference semantics or inheritance is required.
  • Use enum with associated values for modeling finite states.
  • Use protocol for defining capabilities. Prefer protocol composition.
  • Use typealias for complex generic signatures for readability.

Optionals

  • Use guard let for early exit on nil. Use if let for conditional binding.
  • Never force-unwrap (!) unless failure is a programming error.
  • Use ?? for default values: let name = user?.name ?? "Unknown".
  • Use optional chaining: user?.address?.city.
  • Use map / flatMap on optionals for transformations.

Properties

  • Use let by default. Use var only when mutation is required.
  • Use computed properties for derived values: var fullName: String { ... }.
  • Use property observers (willSet, didSet) for side effects on change.
  • Use lazy var for expensive initialization deferred until first access.
  • Use @Published (Combine) for observable properties in classes.

Functions

  • Use argument labels for clarity: func move(from source: Int, to destination: Int).
  • Omit argument labels when the function name makes the role clear: func contains(_ element: T).
  • Use default parameter values instead of multiple overloads.
  • Use throws / async throws for fallible operations.
  • Use trailing closure syntax for the last closure parameter.

Read the full file on GitHub · 294 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. 8d ago First seen · 294 lines · 41 tokens per session scan A 0d21dd42cd04

Subscribe to this mod's changes

swift-rules is a skill published in the GitHub repository softspark/ai-toolkit (174 stars, last pushed yesterday), licensed Apache-2.0. It adds 41 tokens to every session and 3,219 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-09-03.

Related

Other skills, from other repositories

android-kotlin-advisor

Développement Android natif avec Kotlin et Jetpack Compose — architecture MVVM/MVI, UI Compose, Hilt, Room, Coroutines, Flow, tests, Gradle KTS, Play Store. Se déclenche avec "Android", "Kotlin", "Jetpack Compose", "Android Studio", "Gradle", "Room", "Hilt", "Coroutines", "Play Store". Also triggers on "Android with…

khalilbenaz/claude-skills-collection · 100 tokens

agent-flutter-expert

Expert Flutter specialist mastering Flutter 3+ with modern architecture patterns. Specializes in cross-platform development, custom animations, native integrations, and performance optimization with focus on creating beautiful, native-performance applications.

majiayu000/claude-skill-registry · 45 tokens

swift-development

You MUST activate this skill when working on Swift projects.

sammcj/agentic-coding · 13 tokens

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

android-development

Android development with Kotlin, Jetpack Compose, and modern Android architecture. Use when building Android apps, implementing Material Design, or following Android best practices.

travisjneuman/.claude · 33 tokens

ios-development

Comprehensive guide for building native Apple platform applications.

travisjneuman/.claude · 43 tokens