swift-5-9-development-standards

swift-5-9-development-standards is a cursor rule for Cursor from beettlle/pi-spine. It costs 0 tokens per session (8,251 once invoked), scanned A, original, MIT.

A set of coding standards for Swift 5.9, Apple’s programming language, with guidance for SwiftUI apps, app layers, concurrency, and testing.

In plain words
What is it for?
Use it when writing or reviewing Swift and SwiftUI code, especially architecture, asynchronous work, memory management, and tests.
Why use it?
It keeps iOS and macOS code consistent with the project’s deployment target and avoids using Swift features that the project may not support.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/. Also seen: positional $N argument.

Good fit Use it when writing or reviewing Swift and SwiftUI code, especially architecture, asynchronous work, memory management, and tests.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/beettlle/pi-spine/swift-5-9-development-standards
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.

Clone the repo
git clone --depth 1 https://github.com/beettlle/pi-spine

Made for: Cursor.

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-5-9-development-standards

README.md
[![agentmods](https://agentmods.dev/badge/rules/beettlle/pi-spine/swift-5-9-development-standards/github.svg)](https://agentmods.dev/rules/beettlle/pi-spine/swift-5-9-development-standards)
Your own site
<a href="https://agentmods.dev/rules/beettlle/pi-spine/swift-5-9-development-standards"><img src="https://agentmods.dev/badge/rules/beettlle/pi-spine/swift-5-9-development-standards/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-5-9-development-standards

Your own site · 80×15
<a href="https://agentmods.dev/rules/beettlle/pi-spine/swift-5-9-development-standards"><img src="https://agentmods.dev/badge/rules/beettlle/pi-spine/swift-5-9-development-standards.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 8,251 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.00000 $0.08251
Opus 5 $0.00000 $0.04126
Sonnet 5 $0.00000 $0.01650
Haiku 4.5 $0.00000 $0.00825

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

Security

Grade A, and why

swift-5-9-development-standards 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 9d 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.

.cursor/rules/swift-5-9-development-standards.mdc · 865 lines

How it starts

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

Persona: Senior iOS Craftsman

  • Role: Apple Ecosystem expert (SwiftUI/Combine/ARC). Philosophy: SwiftUI purist, strict layer separation
  • Bias: User-first (60fps, non-blocking main), Memory-safe (paranoid retain cycles, [weak self]), Modern (async/await > GCD), Architecture (MVVM, value types), Platform (deployment target from project, Swift 5.9 language mode)

iOS Development Standards

You are an expert iOS developer using Swift and SwiftUI. Follow these guidelines:

Scope

  • Swift (filename contract): This file targets Swift 5.9 (see swift-5-9-*.mdc filename). Do not use Swift 6-only language features listed under "Swift 5.9 Compatibility" unless the project explicitly adopts Swift 6.
  • For Swift 6 language mode: See swift-6-development-standards.mdc and swift-6-brutal-audit.mdc.
  • Platform: Minimum OS version is defined by the Xcode target (IPHONEOS_DEPLOYMENT_TARGET / MACOSX_DEPLOYMENT_TARGET / etc.), SwiftPM platforms, or extension targets—not by this rule. Prefer APIs available at that minimum; use #available / @available and fallbacks when supporting a range. Verify symbol availability in Apple documentation for the SDK you build with.

Code Structure

  • Use Swift and SwiftUI features allowed by Swift 5.9 and the project's deployment target; protocol-oriented programming
  • Prefer value types (structs) over classes
  • Use MVVM architecture with SwiftUI
  • Structure: Features/, Core/, UI/, Resources/
  • Follow Apple's Human Interface Guidelines

Source File Naming (Guidance)

PascalCase matching primary type (UserProfileViewModel.swift). Extensions: Type+ExtensionPurpose.swift. 📍 See: general-llm-anti-patterns.mdc Category 12.

Architectural Layers (CRITICAL)

To prevent "God Objects" and "Smart UI", strict layer separation is enforced:

1. Presentation Layer (Views & ViewModels)

  • Role: Transforming user intent into actions and State into UI.
  • FORBIDDEN: Importing SwiftData or MusicKit directly.
  • FORBIDDEN: Direct database fetches or API calls.
  • ALLOWED: Calling methods on injected Use Cases or Repositories.

Read the full file on GitHub · 865 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. 9d ago First seen · 865 lines · 0 tokens per session scan A ea07c629faa4

Subscribe to this mod's changes

swift-5-9-development-standards is a cursor rule published in the GitHub repository beettlle/pi-spine (3 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 8,251 tokens. 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.