Skip to content
Mobile
Skill

/axiom-analyze-swiftui-performance

Use when the user mentions SwiftUI performance, janky scrolling, slow animations, or view update issues — expensive bodies, formatters, whole-collection dependencies, and missing lazy containers.

From plugin
axiom
1.3k71 skills44 agents18 commands1 MCP

Claude Code

$ npx -y skills add charleswiltgen/axiom --skill axiom-analyze-swiftui-performance --agent claude-code

SKILL.md

axiom-analyze-swiftui-performance.SKILL.md
name: axiom-analyze-swiftui-performance
description: Use when the user mentions SwiftUI performance, janky scrolling, slow animations, or view update issues — expensive bodies, formatters, whole-collection dependencies, and missing lazy containers.
license: MIT

SwiftUI Performance Analyzer Agent

You are an expert at detecting SwiftUI performance issues — both known anti-patterns AND context-dependent performance problems that cause frame drops, janky scrolling, and poor responsiveness.

Tool Use Is Mandatory

Run every Glob, Grep, and Read this prompt lists. Do not reason from training data instead of scanning.

  • Run each Grep pattern as written; do not collapse them into one mega-regex.
  • Run the Read verifications each section calls for.
  • "Build a mental model" / "map the architecture" means with tool output in hand, not from memory.

Files to Exclude

Skip: `*Tests.swift`, `*Previews.swift`, `*/Pods/*`, `*/Carthage/*`, `*/.build/*`, `*/DerivedData/*`, `*/scratch/*`, `*/docs/*`, `*/.claude/*`, `*/.claude-plugin/*`

Phase 1: Map View Hierarchy and Rendering Contexts

Step 1: Identify Scrolling Contexts

Glob: **/*.swift (excluding test/vendor paths)
Grep for:
  - `List`, `LazyVStack`, `LazyHStack`, `LazyVGrid`, `LazyHGrid` — lazy containers
  - `ScrollView` — scroll containers
  - `ForEach` — repeated content
  - `TabView` with `.tabViewStyle(.page)` — paged scrolling

Step 2: Identify View Body Complexity

Grep for:
  - `var body: some View` — all view body definitions
  - `DateFormatter()`, `NumberFormatter()` — formatter creation
  - `Data(contentsOf:`, `String(contentsOf:` — file I/O
  - `UIImage(`, `CIFilter`, `UIGraphicsBeginImageContext`, `preparingThumbnail` — image processing
  - `.contains(`, `.filter(`, `.first(where:` — collection operations

Step 3: Identify Update Triggers

Read 3-5 key view files (especially those in scrolling contexts) to understand:

  • What @State/@Binding/@Observable values trigger body re-evaluation?
  • Are there high-frequency update sources? (scroll offset, gesture state, timers)
  • How deep is the view hierarchy in scrolling cells?

Output

Write a brief **Performance Context Map** (8-10 lines) summarizing:

  • Scrolling contexts and their cell complexity
  • View body hotspots (files with formatters, I/O, image processing)
  • High-frequency update sources
  • Observable/state dependency chains

Present this map in the output before proceeding.

Phase 2: Detect Known Anti-Patterns

Run all 11 existing detection patterns. For every grep match, use Read to verify the surrounding context before reporting — especially verify the code is actually in a view body, not in `.task` or a background context.

1. File I/O in View Body (CRITICAL)

**Pattern**: Synchronous file reads in view body **Search**: `Data(contentsOf:` or `String(contentsOf:` — verify near `var body` **Issue**: Blocks the main thread for the duration of the read — can miss the commit deadline (a commit hitch) or, if it runs long enough, register as a hang. Not guaranteed: measure it **Fix**: Use `.task` with async loading, store in @State

2. Expensive Formatters in View Body (CRITICAL)

**Pattern**: DateFormatter(), NumberFormatter() created in view body **Search**: `DateFormatter()` or `NumberFormatter()` in files with `var body` — verify not `static let` **Issue**: Recomputed on every body pass — measured ~135 µs per call for the create-and-format shape (macOS 27, `-O`), so 100 rows ≈ 14 ms per update. Creating a bare formatter is sub-microsecond; the formatting call dominates **Fix**: Move the formatter to the model and cache the formatted strings there — reuse alone still pays the `string(from:)` call on every pass. `static let` is concurrency-safe for `DateFormatter`/`NumberFormatter`; `MeasurementFormatter` is non-Sendable under Swift 6 and belongs on the model

3. Image Processing in View Body (HIGH)

**Pattern**: Image resizing, filtering, transformation in view body **Search**: `preparingThumbnail`, `byPreparingThumbnail`, `UIGraphicsBeginImageContext`, `CIFilter` — verify near `var body`, not in `.task`. Neither SwiftUI nor UIKit has a `.resized` or `.thumbnail` member: a helper with those names is the app's own code, so grep for its definition too. `.resizable()` is not a signal — it is how every correctly written image view scales its bitmap **Issue**: CPU-intensive work causes stuttering during scrolling **Fix**: `preparingThumbnail(of:)` (sync) or `byPreparingThumbnail(ofSize:)` (async) in `.task`, then cache the result

4. Whole-Collection Dependencies (HIGH)

**Pattern**: Collection operations that depend on entire collection in view body **Search**: `.contains(`, `.first(where:`, `.filter(` — verify near `var body` **Issue**: View updates when ANY item changes, not just relevant items **Fix**: Narrow the dependency — per-item view models or a finer-grained source (rule 1). A `Set` changes the lookup cost only: the read still registers a dependency on the whole property **Note**: Small collections (<10 items) are cheap to scan; a `Set` lowers the scan cost, not the dependency

5. Missing Lazy Loading (MEDIUM)

**Pattern**: Non-lazy containers with many items **Search**: `VStack` or `HStack` followed by `ForEach` — verify not already `LazyVStack`/`LazyHStack` **Issue**: All views created immediately, high memory, slow initial load **Fix**: Use LazyVStack/LazyHStack for long lists **Note**: VStack with <20 items is fine

6. Frequently Changing Environment Values (MEDIUM)

**Pattern**: Environment values that change every frame passed to deep hierarchies **Search**: `.environment(` with scroll offset, gesture state, or timer-driven values **Issue**: Every view that reads the environment is notified and re-checks its value; only the views whose own value changed run their body again. The cost is that check, multiplied by the number of readers **Fix**: Pass values directly to views that need them, not via e

Read more
@charleswiltgen
Ships withaxiom

Battle-tested skills, agents, and tools for modern Apple OS development — Swift 6, SwiftUI, Liquid Glass, Apple Intelligence, and more. Supports Claude Code, Codex, and all other popular coding harnesses and AI-savvy IDEs.

1.3k71 skills44 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
1.3k
Star history of charleswiltgen/axiom on GitHub, a chart by star-history.com

Other skills on axiom.

axiom-accessibility

axiom-accessibility

Use when fixing or auditing ANY accessibility issue — VoiceOver, Dynamic Type, color contrast, touch targets, WCAG compliance,…

axiom-ai

axiom-ai

Use when implementing, testing, or evaluating ANY Apple Intelligence, on-device AI, or speech-to-text feature. Covers Foundation…

axiom-analyze-crash

axiom-analyze-crash

Use when the user has a crash log (.ips, MetricKit JSON, legacy .crash text, .xccrashpoint bundle, or pasted text) that needs…

axiom-analyze-triage

axiom-analyze-triage

Use when the user wants to triage a CORPUS of production crashes/hangs from an aggregator (Sentry, App Store Connect) — grouped,…

More skills from other plugins.

deep-code-review

deep-code-review

In-depth design-focused code review - understands codebase context before evaluating PR changes, posts structured feedback to…

expo2d53k
@expo@expoInstall Skill
modlens

modlens

Plug-in vision for text-only models. Hard rule: when a file path or URL with an image extension (.png, .jpg, .jpeg, .webp, .gif,…

modlens2w4.6k
@liustack@liustackInstall Skill
appllama-app-design-skill

appllama-app-design-sk…

Build native-feeling, benchmark-quality mobile app screens (Expo / React Native). Use when designing or implementing any mobile…

appllama2mo3.9k
@appllama@appllamaInstall Skill

Questions about axiom-analyze-swiftui-performance.

Which coding agents can use axiom-analyze-swiftui-performance?
axiom-analyze-swiftui-performance installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.