# Swift performance optimization

> Swift performance optimization is an open-source agent skill for developer tools. Guides profiling and fixing slow SwiftUI screens, lists, main-thread work and memory. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/pstuart/pstuart/tree/main/plugins/swift-modern-dev/skills/swift-performance-optimization
- **Repository:** https://github.com/pstuart/pstuart
- **GitHub stars:** 20
- **License:** MIT
- **Skill name:** swift-performance-optimization
- **Collection:** https://github.com/pstuart/pstuart
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill steers an agent through diagnosing performance problems in Swift and SwiftUI apps. It insists on measuring with Instruments before changing code, and it offers a decision guide that maps symptoms such as scroll jank, hangs on user actions, memory growth and actor waits to the right tool or fix.

The workflow centers on Time Profiler and the Swift Concurrency instrument: the agent is told to invert the call tree, focus on main-thread self time, fix only the top offenders and re-measure. It also includes code patterns for keeping list rows lightweight, moving heavy computation into an actor away from the main actor, using @Observable view models, and loading images with AsyncImage phases. A short checklist closes the workflow.

The skill is a single SKILL.md with no scripts. It assumes a Swift codebase and Xcode, and it refers to a related memory-leak diagnosis skill for leak investigations.

## When your agent uses it

> Use when profiling slow SwiftUI screens, optimizing lists, reducing main-thread work, improving memory/CPU, or using Instruments Time Profiler or Swift Concurrency tools.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/pstuart/pstuart/tree/HEAD/plugins/swift-modern-dev/skills/swift-performance-optimization)
- [License: MIT](https://github.com/pstuart/pstuart/tree/HEAD/plugins/swift-modern-dev/skills/swift-performance-optimization)

## Features

- **Symptom-based decision guide:** Maps scroll jank, action hangs, memory growth and actor waits to the appropriate investigation path.
- **Instruments profiling workflow:** Walks through Time Profiler and Swift Concurrency analysis, from inverting the call tree to re-measuring.
- **Main-actor offloading patterns:** Shows how to move heavy parsing or compute into an actor and keep view models on the main actor.
- **Efficient SwiftUI lists:** Covers stable identity, lightweight row views and lazy containers for large collections.
- **Async image loading:** Demonstrates AsyncImage with success, failure and placeholder phases.
- **Pre-finish performance checklist:** Confirms the bottleneck was measured, main-actor work reduced and the fix re-profiled.

## Good for

- Find why a SwiftUI list stutters while scrolling
- Track down a UI hang after a button tap
- Move heavy JSON parsing off the main thread
- Investigate steadily growing memory in an iOS app
- Review a SwiftUI screen for unnecessary main-actor work

## Install

### Claude Code

This skill ships in the `swift-modern-dev` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add pstuart/pstuart
/plugin install swift-modern-dev@pstuart
```

Or copy only this skill to `~/.claude/skills/swift-performance-optimization`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pstuart/pstuart.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/swift-performance-optimization &&
cp -R "$tmp/plugins/swift-modern-dev/skills/swift-performance-optimization" ~/.claude/skills/swift-performance-optimization &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/swift-performance-optimization` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/swift-performance-optimization` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pstuart/pstuart.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/swift-performance-optimization &&
cp -R "$tmp/plugins/swift-modern-dev/skills/swift-performance-optimization" ~/.agents/skills/swift-performance-optimization &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/swift-performance-optimization` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/swift-performance-optimization` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pstuart/pstuart.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/swift-performance-optimization &&
cp -R "$tmp/plugins/swift-modern-dev/skills/swift-performance-optimization" ~/.cursor/skills/swift-performance-optimization &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/swift-performance-optimization` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/pstuart/pstuart.git --path plugins/swift-modern-dev/skills/swift-performance-optimization
```

Or copy the folder to `~/.gemini/skills/swift-performance-optimization` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/swift-performance-optimization`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/pstuart/pstuart.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/swift-performance-optimization &&
cp -R "$tmp/plugins/swift-modern-dev/skills/swift-performance-optimization" ~/.copilot/skills/swift-performance-optimization &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/swift-performance-optimization` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/pstuart/pstuart.git
```

Then copy `pstuart/plugins/swift-modern-dev/skills/swift-performance-optimization` into your agent's skills folder as `swift-performance-optimization`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does Swift performance optimization trigger?

When the task involves profiling slow SwiftUI screens, optimizing lists, reducing main-thread work, improving memory or CPU use, or using Instruments Time Profiler or Swift Concurrency tools.

### Does Swift performance optimization need any scripts or extra tools?

It ships no scripts. It relies on Xcode Instruments and describes working with Time Profiler and the Swift Concurrency instrument.

### Does Swift performance optimization change code automatically?

No. It gives the agent a measure-first workflow and code patterns to apply to the measured hot path.

### How do I install Swift performance optimization in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/swift-performance-optimization to use it in all your projects, or to .claude/skills/swift-performance-optimization in one project. Or install the swift-modern-dev plugin, which includes it: /plugin marketplace add pstuart/pstuart, then /plugin install swift-modern-dev@pstuart.

### Does Swift performance optimization run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Swift performance optimization?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

### What are the best alternatives to Swift performance optimization?

The closest alternatives to Swift performance optimization are Axiom analyze swiftui performance, Performance, Memory leak diagnosis, Axiom performance and Axiom analyze swift performance.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Axiom analyze swiftui performance](https://ai-powered.com/skills/axiom-analyze-swiftui-performance): Axiom analyze swiftui performance is an open-source agent skill for developer tools.
- [Performance](https://ai-powered.com/skills/performance-daveebbelaar): Performance is an open-source agent skill for developer tools.
- [Memory leak diagnosis](https://ai-powered.com/skills/memory-leak-diagnosis): Memory leak diagnosis is an open-source agent skill for developer tools.
- [Axiom performance](https://ai-powered.com/skills/axiom-performance-charleswiltgen-2): Axiom performance is an open-source agent skill for developer tools.
- [Axiom analyze swift performance](https://ai-powered.com/skills/axiom-analyze-swift-performance): Axiom analyze swift performance is an open-source agent skill for developer tools.
- [Swift modern architecture](https://ai-powered.com/skills/swift-modern-architecture): Swift modern architecture is an open-source agent skill for developer tools.
- [Axiom swiftui](https://ai-powered.com/skills/axiom-swiftui-charleswiltgen-2): Axiom swiftui is an open-source agent skill for developer tools.
- [Swift swiftui](https://ai-powered.com/skills/swift-swiftui): Swift swiftui is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/swift-performance-optimization
