swift-patterns/SKILL.md
Review, refactor, or build SwiftUI features with correct state management, modern API usage, optimal view composition, navigation patterns, performance optimization, and testing best practices.
npx skillsauth add efremidze/swift-patterns-skill swift-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Review, refactor, or build SwiftUI features with correct state management, modern API usage, optimal view composition, and performance-conscious patterns. Prioritize native APIs, Apple design guidance, and testable code structure. This skill focuses on facts and best practices without enforcing specific architectural patterns.
→ Read references/workflows-review.md for review methodology
references/state.md)references/view-composition.md)references/lists-collections.md)references/modern-swiftui-apis.md)references/concurrency.md)references/navigation.md)→ Read references/workflows-refactor.md for refactor methodology
references/refactor-playbooks.md)references/modern-swiftui-apis.md)references/performance.md)references/state.md)references/patterns.md)references/state.md)references/view-composition.md)references/modern-swiftui-apis.md)references/concurrency.md)references/performance.md)references/navigation.md)If intent unclear, ask: "Do you want findings only (review), or should I change the code (refactor)?"
Review Response:
Refactor Response:
| Wrapper | Use When | Ownership |
|---------|----------|-----------|
| @State | Internal view state (value type or @Observable class) | View owns |
| @Binding | Child needs to modify parent's state | Parent owns |
| @Bindable | Injected @Observable object needing bindings | Injected |
| let | Read-only value from parent | Injected |
| var + .onChange() | Read-only value needing reactive updates | Injected |
Key rules:
@State as private (makes ownership explicit)@State for passed values (accepts initial value only)@State with @Observable classes (not @StateObject)See references/state.md for detailed guidance and tradeoffs.
| Deprecated | Modern Alternative | Notes |
|------------|-------------------|-------|
| foregroundColor() | foregroundStyle() | Supports dynamic type |
| cornerRadius() | .clipShape(.rect(cornerRadius:)) | More flexible |
| NavigationView | NavigationStack | Type-safe navigation |
| tabItem() | Tab API | iOS 18+ |
| onTapGesture() | Button | Unless need location/count |
| onChange(of:) { value in } | onChange(of:) { old, new in } or onChange(of:) { } | Two or zero parameters |
| UIScreen.main.bounds | GeometryReader or layout APIs | Avoid hard-coded sizes |
See references/modern-swiftui-apis.md for complete migration guide.
Use this when reviewing SwiftUI code:
@State properties marked private@State or @StateObject@Binding only where child modifies parent stateNavigationStack instead of NavigationViewButton instead of onTapGesture when appropriateonChange()body simple and pure (no side effects)navigationDestination(for:) for type-safe navigation.sheet(item:) for model-based sheetsForEach uses stable identity (never .indices for dynamic data)ForEach elementForEach (prefilter and cache)AnyView in list rowsLazyVStack/LazyHStack for large listsbody.task for automatic cancellation.task(id:) for value-dependent tasks.onAppear with async workSee reference files for detailed explanations of each item.
.task for SwiftUI async workdeveloper.apple.com/documentation/swiftui/, developer.apple.com/documentation/swift/All workflows must follow these constraints.
This skill focuses on facts and best practices from Apple's documentation:
All references in references/:
workflows-review.md - Review methodology and findings taxonomyworkflows-refactor.md - Refactor methodology and invariantsrefactor-playbooks.md - Step-by-step refactor guidesstate.md - Property wrappers and ownership patternsnavigation.md - Navigation implementation patternsview-composition.md - View structure and extractionlists-collections.md - Identity and ForEach patternsscrolling.md - Scroll handling and paginationconcurrency.md - Async work with .taskperformance.md - Optimization strategiestesting-di.md - Testing and dependency injectionpatterns.md - Common SwiftUI patternsmodern-swiftui-apis.md - Legacy API migrationcode-review-refactoring.md - Code quality checksdevelopment
Maintainer-only workflow for handling GitHub Secret Scanning alerts on OpenClaw. Use when Codex needs to triage, redact, clean up, and resolve secret leakage found in issue comments, issue bodies, PR comments, or other GitHub content.
development
Maintainer workflow for OpenClaw releases, prereleases, changelog release notes, and publish validation. Use when Codex needs to prepare or verify stable or beta release steps, align version naming, assemble release notes, check release auth requirements, or validate publish-time commands and artifacts.
development
Run, watch, debug, and extend OpenClaw QA testing with qa-lab and qa-channel. Use when Codex needs to execute the repo-backed QA suite, inspect live QA artifacts, debug failing scenarios, add new QA scenarios, or explain the OpenClaw QA workflow. Prefer the live OpenAI lane with regular openai/gpt-5.4 in fast mode; do not use gpt-5.4-pro or gpt-5.4-mini unless the user explicitly overrides that policy.
development
End-to-end Parallels smoke, upgrade, and rerun workflow for OpenClaw across macOS, Windows, and Linux guests. Use when Codex needs to run, rerun, debug, or interpret VM-based install, onboarding, gateway smoke tests, latest-release-to-main upgrade checks, fresh snapshot retests, or optional Discord roundtrip verification under Parallels.