swiftui-expert-skill

Reviews, refactors, and writes SwiftUI code with state management, performance, and Instruments trace analysis.

3.6k|161|Updated Jan 21, 2026
Ready to run
npx skills add https://github.com/AvdLee/SwiftUI-Agent-Skill --skill swiftui-expert-skill-avdlee
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: swiftui-expert-skill
Source: https://github.com/AvdLee/SwiftUI-Agent-Skill/tree/main/skills/swiftui-expert-skill
Command: npx skills add https://github.com/AvdLee/SwiftUI-Agent-Skill --skill swiftui-expert-skill-avdlee

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? SwiftUI codebases accumulate subtle bugs around state ownership, view identity, deprecated APIs, and rendering performance that are hard to catch in review. This Skill gives AI coding agents structured, topic-routed guidance for writing, reviewing, and refactoring SwiftUI code on iOS and macOS, including SDK 27 changes and Liquid Glass adoption. ## Core Features & Use Cases - Topic-Routed Code Review: Routes each task to one of 30+ reference guides covering state management, @Observable data flow, view composition, lists, animations, charts, accessibility, layout, and macOS scenes, with a hard-rule correctness checklist. - API Migration and Deprecation Handling: Replaces hard-deprecated APIs with modern equivalents, flags soft-deprecated APIs, and validates #available gating with fallbacks. - Instruments Trace Workflows: Records .trace files via xctrace scripts and analyzes SwiftUI lanes, hangs, hitches, and cause graphs to produce prioritized performance fixes. - Use Case: Ask the agent to review a SwiftUI view for state-management and performance issues; it flags incorrect @State/@StateObject usage, unstable ForEach identity, and deprecated modifiers, then suggests concrete refactors. ## Quick Start Use the swiftui expert skill to review the current SwiftUI code for state-management and performance improvements.

Frequently Asked Questions about swiftui-expert-skill

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I review SwiftUI code for state management issues?▼

Invoke the skill and ask for a review of the target SwiftUI files. It checks hard rules such as private `@State`, correct `@StateObject` versus `@ObservedObject` ownership, stable `ForEach` identity, and iOS 17+ `@Observable` patterns, then reports violations with fixes.

How to profile SwiftUI performance with Instruments?▼

Ask the agent to record a trace; it runs the bundled record_trace.py script with xctrace using the SwiftUI template on real devices or Time Profiler on the Simulator. The analyze_trace.py script then reports hangs, hitches, hot views, and invalidation sources.

Does this skill support iOS 26 and SDK 27 APIs?▼

Yes. It covers SDK 27 changes including the `Document`/`DocumentReader` APIs replacing `FileDocument`, the `@Animatable` macro, `Chart3D`, and Liquid Glass on iOS 26+, with guidance to gate version-specific APIs using `#available` and sensible fallbacks.

Can it migrate deprecated SwiftUI APIs automatically?▼

It replaces hard-deprecated APIs with modern equivalents from its latest-apis reference. Soft-deprecated APIs are flagged but left in place during feature work unless you explicitly request a migration, following its soft-deprecation policy.

Why does my SwiftUI view keep re-rendering unnecessarily?▼

Common causes are overly broad state ownership, unstable view identity, or high-edge-count invalidation sources like `UserDefaultObserver`. The skill's trace analysis ranks cause-graph sources with `--fanin-for` to identify which nodes drive repeated view updates.

When should I not use Liquid Glass in SwiftUI?▼

The skill only adopts Liquid Glass when explicitly requested, since it requires iOS 26+ and changes visual design significantly. For broader deployment targets, it recommends standard materials and native styling with `#available` fallbacks.