swiftui-audit
БесплатноЗапускает вложенные скриптыНе проверен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…
от fcakyon★ 1 223 звезды на GitHubОб этом скилле
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
For an app that reuses a manually managed AppKit window, trace close, Dock reopen and updater relaunch. Set isReleasedWhenClosed = false on a window that those callbacks retain and reuse. Exercise close and reopen on the same instance.
- 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
Установить swiftui-audit в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл swiftui-audit?
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.
Как установить скилл swiftui-audit?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл swiftui-audit запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic