swift-performance-pro

swift-performance-pro is a skill for Claude Code from laxrajpurohit/swift-skills-pro. It costs 31 tokens per session (713 once invoked), scanned A, original, MIT.

A guide for measuring and fixing performance problems in Swift and SwiftUI apps. It covers screen rendering, memory use, retain cycles, launch time, lists, and Instruments, Apple’s performance-analysis tool.

In plain words
What is it for?
Use it to investigate slow launches, janky scrolling, memory leaks, battery drain, or performance regressions, and to plan an Instruments session.
Why use it?
It helps replace guesswork with measurements and identifies the code that causes slow screens, high memory use, or poor scrolling.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

Part of the swift-performance-pro plugin — 1 skill shipped together

Good fit Use it to investigate slow launches, janky scrolling, memory leaks, battery drain, or performance regressions, and to plan an Instruments session.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/laxrajpurohit/swift-skills-pro/swift-performance-pro
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add laxrajpurohit/swift-skills-pro --skill swift-performance-pro
Clone the repo
git clone --depth 1 https://github.com/laxrajpurohit/swift-skills-pro

Made for: Claude Code.

Or install swift-performance-pro, the plugin that ships this one along with the rest of its 1 skill.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swift-performance-pro

README.md
[![agentmods](https://agentmods.dev/badge/skills/laxrajpurohit/swift-skills-pro/swift-performance-pro/github.svg)](https://agentmods.dev/skills/laxrajpurohit/swift-skills-pro/swift-performance-pro)
Your own site
<a href="https://agentmods.dev/skills/laxrajpurohit/swift-skills-pro/swift-performance-pro"><img src="https://agentmods.dev/badge/skills/laxrajpurohit/swift-skills-pro/swift-performance-pro/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for swift-performance-pro

Your own site · 80×15
<a href="https://agentmods.dev/skills/laxrajpurohit/swift-skills-pro/swift-performance-pro"><img src="https://agentmods.dev/badge/skills/laxrajpurohit/swift-skills-pro/swift-performance-pro.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 713 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00031 $0.00713
Opus 5 $0.00015 $0.00357
Sonnet 5 $0.00006 $0.00143
Haiku 4.5 $0.00003 $0.00071

Measured 11d ago against content hash eb4cb80ac8ce, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

swift-performance-pro scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

swift-performance-pro/skills/swift-performance-pro/SKILL.md · 99 lines

How it starts

The opening of the file, as written. The whole thing — 99 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Swift Performance Pro

Find and fix performance problems with evidence, not guesses. Measure first.

When to use

  • Janky scrolling, slow launch, high memory, or battery drain.
  • Reviewing code for performance regressions.
  • Planning an Instruments session.

Trigger: /swift-performance-pro.

Core principles

  • Measure before optimizing — use Instruments (Time Profiler, Allocations, SwiftUI, Leaks), not intuition.
  • Keep SwiftUI body cheap and pure; recomputation is frequent.
  • Do heavy work off the main actor.
  • Don't optimize what you haven't proven is hot.

SwiftUI render cost

Keep body free of side effects and heavy compute.

❌ Sorting on every render

var body: some View {
    List(items.sorted { $0.date > $1.date }) { Row($0) }   // re-sorts each pass
}

✅ Sort once in the model

// model exposes already-sorted `items`
var body: some View { List(model.items) { Row($0) } }

Narrow observation so unrelated changes don't redraw everything. Split big views into small subviews so SwiftUI can diff precisely.

Lists

  • LazyVStack/List for long content, not eager VStack in a ScrollView.
  • Stable Identifiable IDs — index-based identity forces full rebuilds.
  • Avoid AnyView in row builders; it defeats SwiftUI's diffing.

Memory & retain cycles

❌ Strong self capture in a stored closure

manager.onUpdate = { self.refresh() }   // cycle: manager → closure → self

manager.onUpdate = { [weak self] in self?.refresh() }

Verify deinit runs. Use Instruments → Leaks / Allocations to confirm.

Off the main actor

let image = UIImage(data: hugeData)   // decode on main → dropped frames

let image = await Task.detached { UIImage(data: hugeData) }.value

Downsample large images to the display size instead of loading full-resolution.

Launch time

  • Defer non-critical work out of init/onAppear; load it in .task.
  • Avoid synchronous disk/network on the launch path.
  • Audit with Instruments → App Launch.

Read the full file on GitHub · 99 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 99 lines · 31 tokens per session scan A eb4cb80ac8ce

Subscribe to this mod's changes

swift-performance-pro is a skill published in the GitHub repository laxrajpurohit/swift-skills-pro (5 stars, last pushed 3mo ago), licensed MIT. It adds 31 tokens to every session and 713 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

swiftui-debugging

Diagnose SwiftUI performance issues including unnecessary re-renders, view identity problems, and slow body evaluations. Use when SwiftUI views are slow, janky, or re-rendering too often.

rshankras/claude-code-apple-skills · 44 tokens

performance-profiling

Guide performance profiling with Instruments, diagnose hangs, memory issues, slow launches, and energy drain. Use when reviewing app performance or investigating specific bottlenecks.

rshankras/claude-code-apple-skills · 36 tokens

performance

Performance profiling and SwiftUI debugging skills — Instruments guidance, hangs, memory issues, slow launches, energy drain, unnecessary re-renders, and view identity problems. Use when an app is slow, janky, or resource-hungry.

rshankras/claude-code-apple-skills · 50 tokens

xcode-build-fixer

Implement approved Xcode build optimization changes following best practices, then re-benchmark to verify improvement. Use when the developer has reviewed an optimization plan and approved specific changes, or when there is a clear list of build-setting or source-level fixes to apply and verify.

carloshpdoc/ios-workflow-claude · 58 tokens

xcode-project-analyzer

Audit Xcode project configuration, build settings, scheme behavior, and script phases to find build-time improvements with explicit approval gates. Use when a developer wants project-level build analysis, slow incremental builds, guidance on target dependencies, build settings review, run script phase analysis…

carloshpdoc/ios-workflow-claude · 72 tokens

asc-crash-triage

Triage TestFlight crashes, beta feedback, and performance diagnostics using asc. Use when the user asks about TF crashes, TestFlight crash reports, beta tester feedback, app hangs, disk writes, launch diagnostics, or wants a crash summary for a build or app.

rorkai/app-store-connect-cli-skills · 60 tokens