Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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: 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.
  • 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 in Tests and files ending in Tests.swift are skipped. --include-tests scans 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

  1. Apply fix findings in small batches and build after each one. Change only the reported expression.
  2. For each 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.
  3. Report the rest with 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.

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-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.
  • Regex literals are not masked, and a + between two values that are both stored Text variables 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
Полный SKILL.md на GitHub

Установить swiftui-audit в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

scripts/swiftui-audit.mjs

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 запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить swiftui-audit с