/swift-skills:swiftui-auditfrom swift-skills
Audits SwiftUI code for deprecated API, anti-patterns, and style issues. Runs a static analyzer that checks for index identity, text concatenation, foreground color, view argument overloads, onChange syntax, animation without value, corner radius, and non-private state.
Ships in swift-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Run the bundled auditor first. It finds a small set of patterns that can be recognized from source text alone, then the swiftui-best-practices skill covers everything that needs judgment.
node scripts/swiftui-audit.mjs <app-or-package-dir> [--json] [--target ios=17,macos=14] [--include-tests]
platforms: in Package.swift or *_DEPLOYMENT_TARGET in project.pbxproj, inside the scan root or its nearest parent that has one. With several targets, the lowest per platform wins. --target overrides it. The output names the source, or says the target is unknown..build, DerivedData, Pods, Carthage, SourcePackages, checkouts, node_modules, *.xcodeproj, directories ending in Tests and files ending in Tests.swift are skipped. --include-tests scans tests too.Each finding gives the file, line, rule, the code, the problem and the next action. fix means the replacement is mechanical. review means the next action starts with "Needs human context" and names the fact to check before changing anything.
| Rule | Level | Flags | Kept off when |
|---|---|---|---|
index-identity | review | ForEach(x.indices, ...), ForEach(0..<x.count, ...) or enumerated() with id: \.offset | element IDs, literal ranges, for loops |
text-concatenation | review | Text + Text chains (one finding per chain) and Text("a" + b) | + inside interpolation, Text(verbatim:), + not next to a literal |
foreground-color | fix | .foregroundColor() modifier | inside a reported Text + chain, target below iOS 15 / macOS 12 |
view-argument-overload | fix | .background(Circle()), .overlay(MyView()), .mask(...) with a built-in or project-declared View or Shape | style arguments, in: shapes, closures, unknown types |
onchange-single-parameter | fix | .onChange(of:) { value in } and perform: | zero or two parameters, initial:, target below iOS 17 / macOS 14 |
animation-without-value | fix | .animation(x) modifier without value: | TimelineView(.animation...), $binding.animation(), transitions, the .animation(x) { } body form |
corner-radius-modifier | fix | .cornerRadius() modifier | RoundedRectangle(cornerRadius:) and other labels |
state-not-private | review | @State or @StateObject without private | private and private(set) |
Next actions follow the deployment target. corner-radius-modifier suggests .rect(cornerRadius:) from iOS 17 / macOS 14 and RoundedRectangle below. index-identity keeps Array(x.enumerated()) below iOS 26 / macOS 26.
fix findings in small batches and build after each one. Change only the reported expression.review finding, read the collection or property it names. Leave it as is when the stated condition does not hold, and say so in the review.swiftui-best-practices. Do not rewrite code that the auditor did not report only because a pattern exists. Examples are ObservableObject, GeometryReader and compatibility code for older targets.view-argument-overload recognizes only built-in views and View or Shape types declared in the scanned files, and skips variables.Binding(get:set:) is not a rule. Most real setters have side effects or roll back on failure, so a safe replacement always needs a person.+ between two values that are both stored Text variables is missed.node --test plugins/swift-skills/skills/swiftui-audit/tests/swiftui-audit.test.mjs
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
swiftui-audit, deprecated-api, anti-patterns, static-analysis
npx claudepluginhub fcakyon/claude-codex-settings --plugin swift-skills3 skills in this plugin
/macos-releaseThis skill should be used when the user asks to "sign a Mac app", "notarize a DMG", "publish a macOS release", "fix a Mac download", or verify or rotate a Sparkle update key./swiftui-best-practicesThis skill should be used when user asks to "write SwiftUI code", "review SwiftUI code", or "refactor SwiftUI code" for iOS or macOS apps.Other plugins' skills for the same job