Swiftui Audit
Unsigned, install at your own risk
UnverifiedThis skill has no cryptographic signature attached. We can't verify the contents match what the publisher intended.
Install this skill
No account required. Pick your tool, then copy.
Run in your terminal. It detects your AI tool.
npx @skills-hub-ai/cli install claude-codex-settings-swiftui-auditWhat this does: This skill should be used when the user asks to "audit SwiftUI code", "scan a SwiftUI project for deprecated API", "find SwiftUI anti-patterns", or run a static SwiftUI check before a review or release.
Manual setup by platform
Claude Code
~/.claude/skills/claude-codex-settings-swiftui-audit/SKILL.md
Instructions
SwiftUI audit
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]
- Node with no dependencies. The tests pass on Node 24 (Linux) and Node 22 (macOS).
- The deployment target comes from
platforms:inPackage.swiftor*_DEPLOYMENT_TARGETinproject.pbxproj, inside the scan root or its nearest parent that has one. With several targets, the lowest per platform wins.--targetoverrides it. The output names the source, or says the target is unknown. - Comments and string contents are masked before matching, so commented-out code and text in literals never match.
.build,DerivedData,Pods,Carthage,SourcePackages,checkouts,node_modules,*.xcodeproj, directories ending inTestsand files ending inTests.swiftare skipped.--include-testsscans tests too.- Exit code 1 means findings were printed, 0 means none, 2 means a usage error.
Rules
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.
Acting on findings
- Apply
fixfindings in small batches and build after each one. Change only the reported expression. - For each
reviewfinding, read the collection or property it names. Leave it as is when the stated condition does not hold, and say so in the review. - Report the rest with
swiftui-best-practices. Do not rewrite code that the auditor did not report only because a pattern exists. Examples areObservableObject,GeometryReaderand compatibility code for older targets.
Limits
- Matching is lexical. It does not resolve types, so
view-argument-overloadrecognizes 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.- Regex literals are not masked, and a
+between two values that are both storedTextvariables is missed. - A clean run proves only that these eight patterns are absent. It is not a SwiftUI review.
Tests
node --test plugins/swift-skills/skills/swiftui-audit/tests/swiftui-audit.test.mjs
Security
Reviews (0)
Related skills
Browse all →More from claude-codex-settings
View source →More Build skills
Browse category →Frequently asked questions about swiftui-audit
What does the swiftui-audit skill do?
This skill should be used when the user asks to "audit SwiftUI code", "scan a SwiftUI project for deprecated API", "find SwiftUI anti-patterns", or run a static SwiftUI check before a review or release. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the swiftui-audit skill?
Run `npx @skills-hub-ai/cli install claude-codex-settings-swiftui-audit` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/claude-codex-settings-swiftui-audit/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does swiftui-audit work with?
swiftui-audit runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the swiftui-audit skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use swiftui-audit after installing it?
In Claude Code, type `/claude-codex-settings-swiftui-audit` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the swiftui-audit skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.