swift-review
БесплатноБез исполняемых скриптовНе проверенReviewing Swift code - what to flag, and what the compiler and SwiftLint already flag for you USE WHEN: you are reviewing, critiquing or auditing existing…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Reviewing Swift
A reviewer's leverage is what the toolchain cannot say. Swift's compiler is strong on nullability and exhaustiveness, so what remains clusters in the two things it does not model by default: object graph lifetime (ARC will not warn you about a cycle) and concurrency, whose checking is a per-target setting rather than a language guarantee.
The snippets are fragments cut down to the defect, not runnable programs.
Already covered - do not spend review on it
| Defect | Reported by |
|---|---|
| Using an optional without unwrapping | the compiler |
Non-exhaustive switch over an enum |
the compiler |
| Unused variable, unreachable code | the compiler |
Unhandled throws |
the compiler |
Force unwrap ! |
SwiftLint force_unwrapping — opt-in, not in the default rules |
Force cast as!, force try! |
SwiftLint force_cast / force_try (force_cast is default) |
| Line length, naming, formatting | SwiftLint defaults |
| Data race on shared mutable state | the compiler — only under Swift 6 language mode or -strict-concurrency=complete |
The last row is the one that matters most. In Swift 5 mode with minimal concurrency checking, every concurrency finding below is unreported. Establish the target's setting before deciding.
The table above dates; the tools do not. Verify a default set with
mcp__documentation__fetch_docson technologyswift-quality— topicsswiftlint-rules,swift-6-migration. Those entries point at the indexes the tool authors maintain, so they follow the version the project actually pins rather than the one this skill was written against.
The checks that earn their place
A closure capturing self strongly and outliving the call
manager.onUpdate = { self.refresh() } // manager holds the closure, closure holds self
When you see it: an @escaping closure stored on a long-lived object, a
Timer, a NotificationCenter observer, or a Combine sink assigned to a
property — capturing self without a capture list.
Ask: does the callee outlive self? ARC frees nothing in a cycle, and
nothing reports it. The leak shows up as a view controller that is never
deinitialised and keeps responding to events after its screen is gone.
[weak self] breaks it; a non-escaping closure does not need one.
[weak self] followed by a force unwrap
load { [weak self] data in
self!.render(data) // crashes exactly in the case weak was for
}
When you see it: guard let self = self else { return } is correct;
self! or self?.x! is not.
Ask: what is the behaviour when the object is gone? The capture list says
"this may be nil", and the force unwrap says "it will not be" — one of them is
wrong. A guard with an early return states the intent.
An implicitly unwrapped optional read before it is set
var client: APIClient! // nil until configure() runs
func send() { client.post(msg) } // crash if the order changes
When you see it: var x: T! outside an @IBOutlet, or a dependency
assigned in a setup method rather than an initialiser.
Ask: is every entry point downstream of the assignment? An IUO turns a
compile-time check into a runtime trap you opted into — the same trade as
Kotlin's lateinit, and worth the same scrutiny.
An unstructured Task that nobody cancels
Task { await refresh() } // detached from the caller's lifetime
When you see it: Task { } created in a view's onAppear, a view model
method, or a deinit-less object, with the handle discarded.
Ask: what cancels this? An unstructured task does not inherit
cancellation from the scope that created it, so the work continues after the
screen is dismissed. .task { } in SwiftUI ties it to the view's lifetime; a
stored handle cancelled in deinit does it manually.
State assumed unchanged across an await inside an actor
actor Cache {
func refresh() async {
guard !isLoading else { return }
isLoading = true
let data = await fetch() // other calls can run HERE
entries = data // isLoading may have been reset meanwhile
isLoading = false
}
}
When you see it: a check, then an await, then a mutation depending on that
check — inside an actor or a @MainActor type.
Ask: what else can run at the suspension point? Actors are re-entrant: they
guarantee no simultaneous execution, not that a method runs atomically. Every
await is a place another call can interleave, and the compiler will not
mention it even under strict checking.
try? discarding the reason
let user = try? decoder.decode(User.self, from: data) // nil, and no idea why
When you see it: try? on a decode, a file read, or a network call whose
failure is actionable.
Ask: does the caller need to know why? try? collapses every distinct error
int
Установить swift-review в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobFAQ
Что делает скилл swift-review?
Reviewing Swift code - what to flag, and what the compiler and SwiftLint already flag for you USE WHEN: you are reviewing, critiquing or auditing existing Swift code - a "code review", a "review" of a .swift file, a diff, a PR or a pull request; deciding what to comment on in Swift; avoiding false positives on Swift code DO NOT USE FOR: writing, explaining or learning Swift - use `languages/swift`; anything the compiler or a configured SwiftLint already reports (this skill lists those so you can stay silent about them); SwiftUI layout - use the SwiftUI material; Kotlin Multiplatform bridging - use `languages/uniffi`
Как установить скилл swift-review?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл swift-review запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic