SwiftUI Code Review Skill for Cline
Review a SwiftUI change for actor isolation, observation, and main-actor UI updates. Use for a SwiftUI code review. Do not use for a non-Swift repository or to silence isolation with unchecked Sendable.
name: "swiftui-code-review" description: "Review a SwiftUI change for actor isolation, observation, and main-actor UI updates. Use for a SwiftUI code review. Do not use for a non-Swift repository or to silence isolation with unchecked Sendable."
SwiftUI Code Review Skill for Cline
Cline skill swiftui-code-review for SwiftUI. /swiftui-code-review forces it. A global skill of the same name overrides this project file.
When to run
Run this review for a SwiftUI view, a model, or a concurrency change.
When to leave it
Stop for a non-Swift repository. Do not change the deployment target or the Swift tools version unless the user asked.
Steps
- Read the Swift tools version and the deployment target. An API used below that target is a high finding.
@unchecked Sendableadded in the diff is a high finding unless a comment proves the invariant. - Check UI updates. A published property written from a non-main-actor task is a high finding.
- Search for
try?and!on decoded or optional values. Each one that hides a failure is a finding. - Check task lifetime.
.taskis cancelled with the view. A plainTask { }with no stored handle and nocancel()is a finding. A task that never checks cancellation during a long loop is a finding. - Note tests. Run the project's test action only if the user asked. Otherwise write
not run.
Output
Findings with severity, file, line, the isolation or availability issue, and a fix.
## Findings
- high | path:line | what is wrong | what to do instead
## No findings
Say "No findings" and list the files you opened. A search you skipped is not a clean result.
## Example
Input: `ProfileView.body` starts `Task { await model.load() }`, so every redraw starts another load.
Output: high | ProfileView.swift:11 | the load is an unstructured task in `body` | use `.task { await model.load() }`. A `Task` inside a button action is not this finding.
Do not flag the valid pattern named in the standards. Flag the mistake next to it.
Stop
Stop when the user asks you to disable strict concurrency to get a green build.
Severity
high is a bug a caller can hit or a secret that leaks. medium is a broken contract that needs a specific input. low is a cleanup that does not change behaviour.