apple-patterns-check

apple-patterns-check is a skill for Claude Code from markdavidgan/apple-dev-skills. It costs 54 tokens per session (3,896 once invoked), scanned A, original, MIT.

A checker for Swift code, the programming language used to build Apple apps, that looks for patterns recommended by Apple.

In plain words
What is it for?
Use it before committing changes, during a release workflow, or while reviewing modified Swift files for Apple conventions.
Why use it?
It catches Apple-specific issues before they reach automated checks or cause problems later, especially in SwiftUI, SwiftData, and concurrent code.

Skill for Claude Code

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

Part of the apple-dev-skills plugin — 62 skills, 25 commands, 7 agents shipped together

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.

agentmods
npx agentmods add skills/markdavidgan/apple-dev-skills/apple-patterns-check
Any agent
npx skills add markdavidgan/apple-dev-skills --skill apple-patterns-check
Clone the repo
git clone --depth 1 https://github.com/markdavidgan/apple-dev-skills

Made for: Claude Code.

Or install apple-dev-skills, the plugin that ships this one along with the rest of its 62 skills, 25 commands, 7 agents.

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 apple-patterns-check

README.md
[![agentmods](https://agentmods.dev/badge/skills/markdavidgan/apple-dev-skills/apple-patterns-check.svg)](https://agentmods.dev/skills/markdavidgan/apple-dev-skills/apple-patterns-check)
Your own site
<a href="https://agentmods.dev/skills/markdavidgan/apple-dev-skills/apple-patterns-check"><img src="https://agentmods.dev/badge/skills/markdavidgan/apple-dev-skills/apple-patterns-check.svg" alt="Measured on agentmods" height="20"></a>
Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,896 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00054 $0.03896
Opus 5 $0.00027 $0.01948
Sonnet 5 $0.00011 $0.00779
Haiku 4.5 $0.00005 $0.00390

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

Security

Grade A, and why

apple-patterns-check 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 6d 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.

platforms/claude/skills/apple-patterns-check/SKILL.md · 302 lines

How it starts

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

Apple Patterns Check

Fast validation that code follows Apple's documented patterns. Uses shell commands to detect violations before they reach CI.

When to Use

  • Before committing significant Swift changes
  • During /ship — after implement, before archive
  • When reviewing code touching SwiftUI, SwiftData, or concurrency
  • When unsure "is this the Apple way?"

Quick Check

/apple-check
/apple-check src/ViewModels/
/apple-check --since-last-commit

Pattern Validation

1. Swift 6 Concurrency Patterns

# 1.1 Task @MainActor annotation — CRITICAL: crash risk
# All Task { [weak self] must be Task { @MainActor [weak self]
git diff HEAD --name-only -- "*.swift" | xargs grep -n "Task { \[weak self\]" 2>/dev/null | grep -v "@MainActor"

# 1.2 @preconcurrency import — OBSOLETE CHECK (2026-04-03)
# iOS 26 first-party frameworks are Sendable-annotated. Prophylactic @preconcurrency
# masks real concurrency issues. Only add where compiler specifically demands it.
# This check is kept for legacy/third-party modules only.
# git diff HEAD --name-only -- "*.swift" | xargs grep -n "^import SomeLegacyModule" 2>/dev/null | grep -v "@preconcurrency"

# 1.3 Double @MainActor (crash risk if SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor)
# If the build setting is already MainActor, remove explicit @MainActor from class declarations
grep -rn "@MainActor" . --include="*.swift" | grep "class " | head -20

1.5 nonisolated deinit — CRITICAL: crash risk for @MainActor classes

Any @MainActor class with deinit that doesn't say nonisolated will crash

grep -rn "deinit" . --include="*.swift" | grep -v "nonisolated|Tests|// no-cleanup"

If the class is @MainActor (explicit or via SWIFT_DEFAULT_ACTOR_ISOLATION), deinit MUST be nonisolated

1.6 FoundationModels isAvailable must NOT be hardcoded — CRITICAL: crash on non-AI devices

grep -rn "isAvailable.return true|isAvailable.=.true" . --include=".swift" | grep -iv "test|mock|preview"

Expected: 0 results — must use SystemLanguageModel.default.isAvailable

Read the full file on GitHub · 302 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. 6d ago First seen · 302 lines · 54 tokens per session scan A d0e245d4fc30

Subscribe to this mod's changes

apple-patterns-check is a skill published in the GitHub repository markdavidgan/apple-dev-skills (5 stars, last pushed 7d ago), licensed MIT. It adds 54 tokens to every session and 3,896 once invoked, about $0.0003 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

asc-ppp-pricing

Set territory-specific pricing for subscriptions and in-app purchases using current asc setup, pricing summary, price import, and price schedule commands. Use when adjusting prices by country or implementing localized PPP strategies.

rorkai/app-store-connect-cli-skills · 45 tokens

asc-revenuecat-catalog-sync

Reconcile App Store Connect subscriptions and in-app purchases with RevenueCat products, entitlements, offerings, and packages using asc and RevenueCat MCP. Use when setting up or syncing subscription catalogs across ASC and RevenueCat.

rorkai/app-store-connect-cli-skills · 51 tokens

asc-apple-ads

Use when managing Apple Ads with asc, including OAuth profiles, ad-account discovery, Platform API v1 campaigns and targeting, reports, assets, recommendations, guarded mutations, raw requests, and Campaign Management API v5 migration.

rorkai/app-store-connect-cli-skills · 50 tokens

asc-aso-audit

Run an offline ASO audit on canonical App Store metadata under ./metadata and surface keyword gaps using Astro MCP. Use after pulling metadata with asc metadata pull.

rorkai/app-store-connect-cli-skills · 40 tokens

asc-localize-metadata

Automatically translate and sync App Store metadata (description, keywords, what's new, subtitle) to multiple languages using LLM translation and asc CLI. Use when asked to localize an app's App Store listing, translate app descriptions, or add new languages to App Store Connect.

rorkai/app-store-connect-cli-skills · 60 tokens

asc-shots-pipeline

Orchestrate iOS screenshot automation with xcodebuild/simctl for build-run, AXe for UI actions, JSON settings and plan files, Koubou-based framing (asc screenshots frame), and screenshot upload (asc screenshots upload). Use when users ask for automated screenshot capture, AXe-driven simulator flows, frame composition…

rorkai/app-store-connect-cli-skills · 79 tokens