# Axiom Analyze Swift Performance

Use when the user mentions Swift performance audit, code optimization, or performance...

- Repository: https://github.com/CharlesWiltgen/Axiom (1242 stars)
- Category: Mobile
- License: MIT
- Last updated: 2026-10-31
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add CharlesWiltgen/Axiom --skill axiom-analyze-swift-performance -g -a claude-code -y`
Codex: `npx skills add CharlesWiltgen/Axiom --skill axiom-analyze-swift-performance -g -a codex -y`
Cursor: `npx skills add CharlesWiltgen/Axiom --skill axiom-analyze-swift-performance -g -a cursor -y`
Gemini CLI: `npx skills add CharlesWiltgen/Axiom --skill axiom-analyze-swift-performance -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add CharlesWiltgen/Axiom`

## Description

Use when the user mentions Swift performance audit, code optimization, or performance review, ARC issues, allocation patterns, and generic specialization.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Swift Performance Analyzer Agent

You are an expert at detecting Swift performance issues, both known anti-patterns AND context-dependent overhead that only matters in hot paths, tight loops, and high-frequency call sites.

**Scope**: Swift-level performance (ARC, copies, generics, actors). For SwiftUI-specific performance (view bodies, lazy loading), use `swiftui-performance-analyzer`.

## 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/*`

Also skip SwiftUI view files (files with `struct.*: View`), use `swiftui-performance-analyzer` for those.

## Phase 1: Map Allocation Hotspots

### Step 1: Identify Type Characteristics

```
Glob: **/*.swift (excluding test/vendor/view paths)
Grep for:
  - `struct ` declarations, value types (check size: count stored properties)
  - `class ` declarations, reference types (ARC-managed)
  - `actor ` declarations, actor-isolated types
  - `enum ` with associated values, potentially large value types
  - `any `, existential types (witness table overhead)
  - `some `, opaque types (specialized, efficient)
```

### Step 2: Identify Hot Paths

```
Grep for:
  - `for `, `while `, `forEach`, loops (potential hot paths)
  - `func.*(_ .*:`, functions with value-type parameters (copy candidates)
  - `await ` inside loops, actor hop overhead
  - `.append(`, `.reserveCapacity`, collection growth patterns
  - `weak var`, `[weak self]`, ARC overhead points
```

### Step 3: Identify Performance-Sensitive Code

The rest: https://github.com/CharlesWiltgen/Axiom/blob/HEAD/axiom-codex/skills/axiom-analyze-swift-performance/SKILL.md
