Add expert SwiftUI Best Practices guidance to your AI coding tool (Agent Skills open format).
Python
3,618
266 commits
updated Sep 18, 2026
Expert guidance for any AI coding tool that supports the Agent Skills open format — SwiftUI state management, view composition, performance, SDK 27 changes, and Liquid Glass adoption.
This repository distills practical SwiftUI best practices into actionable, concise references for agents and code review workflows.
This repository is packaged as a portable Agent Plugin (spec 1.0.0): compatible clients discover the skill automatically from the root plugin.json manifest and the skills/ directory. Client-specific manifests for Claude Code, Cursor, Codex, and pi are included as well.
Install this skill with a single command:
npx skills@latest add https://github.com/avdlee/swiftui-agent-skill --skill swiftui-expert-skill
For more information, visit the skills.sh platform page.
Installed before the Agent Plugins migration? Run npx skills@latest update using skills CLI 1.5.24 or newer. It migrates the saved skill path without treating the skill as deleted.
Then use the skill in your AI agent, for example:
Use the swiftui expert skill and review the current SwiftUI code for state-management and performance improvements
This plugin is distributed through the universal OpenAI Plugins Directory shared by ChatGPT and Codex:
To install this Skill for your personal use in Claude Code:
/plugin marketplace add AvdLee/SwiftUI-Agent-Skill
/plugin install swiftui-expert@swiftui-expert-skill
To automatically provide this Skill to everyone working in a repository, configure the repository's .claude/settings.json:
{
"enabledPlugins": {
"swiftui-expert@swiftui-expert-skill": true
},
"extraKnownMarketplaces": {
"swiftui-expert-skill": {
"source": {
"source": "github",
"repo": "AvdLee/SwiftUI-Agent-Skill"
}
}
}
}
When team members open the project, Claude Code will prompt them to install the Skill.
Load the plugin from a local clone by placing it in ~/.cursor/plugins/local, or install it from the Cursor Marketplace once listed. Cursor supports both the portable Agent Plugins manifest (plugin.json) and the Cursor Plugin manifest (.cursor-plugin/plugin.json) included in this repository.
See INSTALLATION.md for all other installation options: pi, Gemini CLI, Autohand Code, and manual installation.
How to verify:
Your agent should reference the workflow/checklists in skills/swiftui-expert-skill/SKILL.md and jump into the relevant reference file for your task.
This skill covers the full surface of SwiftUI development -- from state management and view composition to Swift Charts, macOS multi-window scenes, animations, SDK 27 changes, and Liquid Glass -- without bloating your agent's task context. Reference files load on demand, so your agent gets deep guidance only for the topic at hand.
@Observable, data flow patterns@Entry, stable defaults, and invalidation-aware propagationAnyShapeStyle@Observable granularity@Animatable macro@State and @ContentBuilder migrations, reordering, AsyncImage caching, swipe actions, dialogs, and toolbarsxctrace toolchain for diagnosing hangs, hitches, and expensive SwiftUI view updates (see below)Non-opinionated: focuses on correctness and performance, not architecture or code style.
Unlike the other reference files — which are text guidance — this part of the skill ships an executable Python toolchain that wraps xctrace. It lets the agent record a new .trace and analyse an existing one end-to-end: the parser reads the Time Profiler, Hangs, Animation Hitches, SwiftUI updates, and SwiftUI cause-graph lanes, correlates hangs/hitches with main-thread samples, and emits JSON + markdown so the agent can reason over structured data instead of the raw xctrace export firehose.
When it triggers:
.trace path appears in the prompt (analysis).What the agent can then ask:
Analyse ~/Desktop/MyApp.trace and tell me what's wrong.
Focus analysis on what happens right after the 'feed loaded' log.
Which of my SwiftUI views is responsible for the hang around 6s?
Record a new trace: attach to MyApp on my iPhone — I'll tell you when I'm done.
Under the hood:
scripts/record_trace.py — wraps xctrace record. Supports attach / launch / all-processes, stop-file for agent-driven sessions, time-limits, JSON device & template discovery.scripts/analyze_trace.py — runs the five-lane analysis. Discovery modes --list-logs, --list-signposts, --fanin-for let the agent scope to a time window or trace a specific view back to its invalidation sources. --window START_MS:END_MS restricts every lane to a slice.scripts/instruments_parser/ — one module per lane (time_profiler, hangs, hitches, swiftui, causes), plus cross-lane correlate and a markdown summary renderer. Pure stdlib Python 3; only external dep is xctrace (ships with Xcode).Key diagnostic: main_running_coverage_pct on each hang/hitch correlation. < 25 % → main thread was blocked (I/O, lock, sync await); ≥ 75 % → CPU-bound. This single metric separates two radically different fix paths.
Full guidance: skills/swiftui-expert-skill/references/trace-analysis.md and skills/swiftui-expert-skill/references/trace-recording.md.
Looking for a visual way to explore Instruments traces? RocketTrace is a companion app created by this repository's author for inspecting and understanding trace data.
skills/swiftui-expert-skill/
SKILL.md
references/
accessibility-patterns.md - Accessibility traits, grouping, Dynamic Type, and VoiceOver
animation-advanced.md - Performance, interpolation, and complex animation chains
animation-basics.md - Core animation concepts, implicit/explicit animations, timing
animation-transitions.md - View transitions, matchedGeometryEffect, and state changes
charts-accessibility.md - Charts accessibility, fallback strategies, and WWDC sessions
charts.md - Swift Charts marks, axes, selection, styling, composition, and Chart3D
document-apps.md - Document protocol, reading, writing, autosave, and FileDocument migration
environment-patterns.md - @Entry, stable defaults, custom actions, and environment invalidation
focus-patterns.md
image-optimization.md - AsyncImage usage, downsampling, caching
iphone-duo.md - Duo displays, fold regions, displacement, hinge effects, and scene accessories
latest-apis.md
layout-best-practices.md - Layout patterns and GeometryReader alternatives
liquid-glass.md - iOS 26+ glass effects and fallback patterns
list-patterns.md - ForEach identity and list performance
localization.md
macos-scenes.md - Scene lifecycle, multi-window setups, and menu bar scenes on macOS
macos-views.md - macOS-specific SwiftUI views and platform differences from iOS
macos-window-styling.md - Window chrome, toolbar, and title bar styling in SwiftUI
modifier-patterns.md - Conditional modifiers, structural identity, and AnyShapeStyle
performance-patterns.md - Hot-path optimizations and update control
previews.md
scroll-patterns.md - ScrollViewReader and programmatic scrolling
sheet-navigation-patterns.md - Sheets and type-safe navigation
soft-deprecation.md
state-management.md - Property wrapper selection and data flow
styled-text-editing.md - AttributedString editing, selection, formatting, and Markdown
text-patterns.md
toolbar-patterns.md - Customization, overflow, visibility, transitions, and minimization
trace-analysis.md
trace-recording.md
view-structure.md - View extraction and composition patterns
webkit-integration.md - WebView, WebPage, navigation, JavaScript, and exports
The repository includes a maintenance skill for keeping API guidance current:
.agents/skills/update-swiftui-apis/
SKILL.md - Workflow for scanning Apple docs and updating latest-apis.md
references/
scan-manifest.md - Categorized API areas, doc paths, and search queries to scan
Use this skill after new iOS or Xcode releases to refresh the deprecated API reference. It requires the Sosumi MCP to be available. See AGENTS.md or CONTRIBUTING.md for details.
Note: only swiftui-expert-skill is intended to be published in the Cursor plugin. The maintenance skill remains a repository workflow utility.
Contributions are welcome! This repository follows the Agent Skills open format, which has specific structural requirements.
Please read CONTRIBUTING.md for:
SKILL.md and the reference filesSeveral SwiftUI guidelines in this skill were inspired by or derived from the following works:
Created by Antoine van der Lee and Omar Elsayed. With years of experience in Swift & SwiftUI, this skill distills practical knowledge into actionable guidance for AI assistants. Antoine published tens of articles on SwiftUI on his blog called SwiftLee.
This skill is open-source and available under the MIT License. See LICENSE for details.
Python
100.0%
Add expert SwiftUI Best Practices guidance to your AI coding tool (Agent Skills open format).
Python
3,618
266 commits
updated Sep 18, 2026
Expert guidance for any AI coding tool that supports the Agent Skills open format — SwiftUI state management, view composition, performance, SDK 27 changes, and Liquid Glass adoption.
This repository distills practical SwiftUI best practices into actionable, concise references for agents and code review workflows.
This repository is packaged as a portable Agent Plugin (spec 1.0.0): compatible clients discover the skill automatically from the root plugin.json manifest and the skills/ directory. Client-specific manifests for Claude Code, Cursor, Codex, and pi are included as well.
Install this skill with a single command:
npx skills@latest add https://github.com/avdlee/swiftui-agent-skill --skill swiftui-expert-skill
For more information, visit the skills.sh platform page.
Installed before the Agent Plugins migration? Run npx skills@latest update using skills CLI 1.5.24 or newer. It migrates the saved skill path without treating the skill as deleted.
Then use the skill in your AI agent, for example:
Use the swiftui expert skill and review the current SwiftUI code for state-management and performance improvements
This plugin is distributed through the universal OpenAI Plugins Directory shared by ChatGPT and Codex:
To install this Skill for your personal use in Claude Code:
/plugin marketplace add AvdLee/SwiftUI-Agent-Skill
/plugin install swiftui-expert@swiftui-expert-skill
To automatically provide this Skill to everyone working in a repository, configure the repository's .claude/settings.json:
{
"enabledPlugins": {
"swiftui-expert@swiftui-expert-skill": true
},
"extraKnownMarketplaces": {
"swiftui-expert-skill": {
"source": {
"source": "github",
"repo": "AvdLee/SwiftUI-Agent-Skill"
}
}
}
}
When team members open the project, Claude Code will prompt them to install the Skill.
Load the plugin from a local clone by placing it in ~/.cursor/plugins/local, or install it from the Cursor Marketplace once listed. Cursor supports both the portable Agent Plugins manifest (plugin.json) and the Cursor Plugin manifest (.cursor-plugin/plugin.json) included in this repository.
See INSTALLATION.md for all other installation options: pi, Gemini CLI, Autohand Code, and manual installation.
How to verify:
Your agent should reference the workflow/checklists in skills/swiftui-expert-skill/SKILL.md and jump into the relevant reference file for your task.
This skill covers the full surface of SwiftUI development -- from state management and view composition to Swift Charts, macOS multi-window scenes, animations, SDK 27 changes, and Liquid Glass -- without bloating your agent's task context. Reference files load on demand, so your agent gets deep guidance only for the topic at hand.
@Observable, data flow patterns@Entry, stable defaults, and invalidation-aware propagationAnyShapeStyle@Observable granularity@Animatable macro@State and @ContentBuilder migrations, reordering, AsyncImage caching, swipe actions, dialogs, and toolbarsxctrace toolchain for diagnosing hangs, hitches, and expensive SwiftUI view updates (see below)Non-opinionated: focuses on correctness and performance, not architecture or code style.
Unlike the other reference files — which are text guidance — this part of the skill ships an executable Python toolchain that wraps xctrace. It lets the agent record a new .trace and analyse an existing one end-to-end: the parser reads the Time Profiler, Hangs, Animation Hitches, SwiftUI updates, and SwiftUI cause-graph lanes, correlates hangs/hitches with main-thread samples, and emits JSON + markdown so the agent can reason over structured data instead of the raw xctrace export firehose.
When it triggers:
.trace path appears in the prompt (analysis).What the agent can then ask:
Analyse ~/Desktop/MyApp.trace and tell me what's wrong.
Focus analysis on what happens right after the 'feed loaded' log.
Which of my SwiftUI views is responsible for the hang around 6s?
Record a new trace: attach to MyApp on my iPhone — I'll tell you when I'm done.
Under the hood:
scripts/record_trace.py — wraps xctrace record. Supports attach / launch / all-processes, stop-file for agent-driven sessions, time-limits, JSON device & template discovery.scripts/analyze_trace.py — runs the five-lane analysis. Discovery modes --list-logs, --list-signposts, --fanin-for let the agent scope to a time window or trace a specific view back to its invalidation sources. --window START_MS:END_MS restricts every lane to a slice.scripts/instruments_parser/ — one module per lane (time_profiler, hangs, hitches, swiftui, causes), plus cross-lane correlate and a markdown summary renderer. Pure stdlib Python 3; only external dep is xctrace (ships with Xcode).Key diagnostic: main_running_coverage_pct on each hang/hitch correlation. < 25 % → main thread was blocked (I/O, lock, sync await); ≥ 75 % → CPU-bound. This single metric separates two radically different fix paths.
Full guidance: skills/swiftui-expert-skill/references/trace-analysis.md and skills/swiftui-expert-skill/references/trace-recording.md.
Looking for a visual way to explore Instruments traces? RocketTrace is a companion app created by this repository's author for inspecting and understanding trace data.
skills/swiftui-expert-skill/
SKILL.md
references/
accessibility-patterns.md - Accessibility traits, grouping, Dynamic Type, and VoiceOver
animation-advanced.md - Performance, interpolation, and complex animation chains
animation-basics.md - Core animation concepts, implicit/explicit animations, timing
animation-transitions.md - View transitions, matchedGeometryEffect, and state changes
charts-accessibility.md - Charts accessibility, fallback strategies, and WWDC sessions
charts.md - Swift Charts marks, axes, selection, styling, composition, and Chart3D
document-apps.md - Document protocol, reading, writing, autosave, and FileDocument migration
environment-patterns.md - @Entry, stable defaults, custom actions, and environment invalidation
focus-patterns.md
image-optimization.md - AsyncImage usage, downsampling, caching
iphone-duo.md - Duo displays, fold regions, displacement, hinge effects, and scene accessories
latest-apis.md
layout-best-practices.md - Layout patterns and GeometryReader alternatives
liquid-glass.md - iOS 26+ glass effects and fallback patterns
list-patterns.md - ForEach identity and list performance
localization.md
macos-scenes.md - Scene lifecycle, multi-window setups, and menu bar scenes on macOS
macos-views.md - macOS-specific SwiftUI views and platform differences from iOS
macos-window-styling.md - Window chrome, toolbar, and title bar styling in SwiftUI
modifier-patterns.md - Conditional modifiers, structural identity, and AnyShapeStyle
performance-patterns.md - Hot-path optimizations and update control
previews.md
scroll-patterns.md - ScrollViewReader and programmatic scrolling
sheet-navigation-patterns.md - Sheets and type-safe navigation
soft-deprecation.md
state-management.md - Property wrapper selection and data flow
styled-text-editing.md - AttributedString editing, selection, formatting, and Markdown
text-patterns.md
toolbar-patterns.md - Customization, overflow, visibility, transitions, and minimization
trace-analysis.md
trace-recording.md
view-structure.md - View extraction and composition patterns
webkit-integration.md - WebView, WebPage, navigation, JavaScript, and exports
The repository includes a maintenance skill for keeping API guidance current:
.agents/skills/update-swiftui-apis/
SKILL.md - Workflow for scanning Apple docs and updating latest-apis.md
references/
scan-manifest.md - Categorized API areas, doc paths, and search queries to scan
Use this skill after new iOS or Xcode releases to refresh the deprecated API reference. It requires the Sosumi MCP to be available. See AGENTS.md or CONTRIBUTING.md for details.
Note: only swiftui-expert-skill is intended to be published in the Cursor plugin. The maintenance skill remains a repository workflow utility.
Contributions are welcome! This repository follows the Agent Skills open format, which has specific structural requirements.
Please read CONTRIBUTING.md for:
SKILL.md and the reference filesSeveral SwiftUI guidelines in this skill were inspired by or derived from the following works:
Created by Antoine van der Lee and Omar Elsayed. With years of experience in Swift & SwiftUI, this skill distills practical knowledge into actionable guidance for AI assistants. Antoine published tens of articles on SwiftUI on his blog called SwiftLee.
This skill is open-source and available under the MIT License. See LICENSE for details.
Python
100.0%