Install
$ agentstack add skill-codeanurag-swift-performance-engineering-skill-swift-performance-engineering-skill ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Swift Performance Engineering
Overview
Use this skill to shape Swift, SwiftUI, UIKit, and iOS code while it is being designed, generated, modified, or reviewed. Optimize for lower CPU time, fewer allocations, tighter memory behavior, faster startup, less main-thread work, smoother rendering, and lower contention without trading away correctness or maintainability.
Working Mode
Start with the execution path the user cares about: launch, first render, scrolling, animation, networking, persistence, background work, or a specific regression.
Use this skill in two modes:
Build mode: when generating or modifying Swift code. Design the code to avoid predictable performance problems before they are introduced.Review mode: when auditing existing code or profiler output. Identify and prioritize bottlenecks and cleanup opportunities.
Treat claims in one of three buckets:
Measured: Backed by profiler output, metrics, traces, or a reproducible benchmark.Likely: Strongly implied by code structure and known platform behavior.Possible: Plausible but not yet verified. Keep these clearly labeled.
Prefer changes that:
- Remove work instead of relocating it.
- Reduce repeated allocations, copying, diffing, decoding, layout, or synchronization.
- Move non-UI work off the main actor without breaking isolation or ordering guarantees.
- Tighten lifecycle ownership so expensive resources are created once and released predictably.
Workflow
- Identify the hottest path or likely-sensitive path before writing code.
- Read the relevant code and trace object lifetimes, thread hops, data movement, invalidation scope, and rendering triggers.
- Apply the checklist in [references/review-checklist.md](references/review-checklist.md).
- If you are generating or editing code, incorporate the checklist into the implementation, not as a post-pass.
- If you need citations or current platform guidance, load [references/official-performance-sources.md](references/official-performance-sources.md) and ground advice in current Apple or Swift sources.
- When reviewing, return findings ordered by impact: startup, frame drops, contention, memory pressure, battery, then cleanup opportunities.
- For every recommendation or code change, state the expected win, the tradeoff, and how to verify it with Instruments, benchmarks, or production telemetry.
Build Rules
When writing or modifying code, apply these rules by default:
- Keep expensive work out of
body, cell configuration, view lifecycle callbacks, and launch paths unless the feature strictly requires it. - Reuse expensive helpers and shared resources when configuration is stable.
- Choose data structures and ownership patterns before writing loops and transforms.
- Avoid main-actor work for parsing, decoding, image preparation, persistence, and other non-UI computation.
- Design cancellation, batching, caching, and lazy initialization into the first implementation when the feature is latency-sensitive.
- Prevent accidental quadratic work, repeated diffing, repeated decoding, and avoidable copy-on-write before it lands in the codebase.
- If a simpler implementation is slightly slower but clearly outside any hot path, keep it simple and note that the path is not performance critical.
Core Standards
Apply these standards by default:
- Favor stable, measurable improvements over speculative micro-optimizations.
- Keep hot paths allocation-light, branch-light, and synchronization-light.
- Do not create work on the main thread that can be prepared, cached, batched, or deferred.
- Prefer the simplest data structure that matches lookup, mutation, ordering, and memory needs.
- Avoid hidden copying, repeated formatting, repeated decoding, and repeated view recomputation.
- Use structured concurrency and actor isolation deliberately; do not introduce gratuitous task creation or actor hopping.
- Align performance fixes with quality gates: correctness, testability, readability, lifecycle safety, and observability.
Focus Areas
Always inspect these areas when relevant:
- Object creation discipline: repeated formatter creation, per-cell view model creation, transient wrapper objects, unnecessary boxing, repeated
Taskor closure allocation, avoidable bridging to Foundation. - Resource lifecycle safety: caches without eviction, observers/timers not invalidated, tasks that outlive owners, images/data loaded too early, expensive singletons initialized on launch.
- Loop and hot-path efficiency: nested loops, repeated sorting/filtering/mapping in render or scroll paths, repeated date/number formatting, repeated regex/JSON decoding, redundant copy-on-write triggers.
- Data-structure fit:
Array.containswhereSetor dictionary lookup matches usage, ordered collections used where hashing is appropriate, large value types copied repeatedly,String/Dataslicing and bridging mistakes. - Algorithmic efficiency: accidental quadratic work, repeated whole-collection diffs, N+1 fetches, redundant layout passes, avoidable database or disk churn.
- Memory management: retain cycles, large temporary buffers, autorelease-heavy bridging, image inflation, cache growth, actor/task retention chains.
- Concurrency and threading: main-actor overuse, priority inversions, lock contention, serial queue bottlenecks, unbounded task fan-out, cancellation ignored, data races hidden behind
nonisolatedor unsafe shared state. - UI rendering and responsiveness: expensive
bodyrecomputation, unstable identity in SwiftUI lists, synchronous image decoding, layout thrash, work in lifecycle callbacks that blocks first interaction, repeated diffing or invalidation. - Startup and first-frame time: eager dependency construction, synchronous disk/network work, migration or logging work in launch path, oversized initial view models, work that can move behind first frame.
Output Format
When reviewing code, report findings in this shape:
Issue: concise statement of the bottleneck or risk.Why it matters: user-visible impact or systems impact.Evidence: measured, likely, or possible.Recommendation: the smallest credible change.Verification: Instruments view, benchmark, metric, or regression test to run.
If nothing is clearly wrong, say so explicitly and list residual risks or missing measurements.
When generating or modifying code, also explain:
Performance-sensitive choices: data structures, ownership, caching, batching, or concurrency decisions baked into the implementation.Risk avoided: the bottleneck or anti-pattern prevented by the design.Verification: what should be profiled or benchmarked after the change lands.
Evidence Expectations
- Prefer official Apple Developer and Swift documentation when justifying platform-specific advice.
- If a recommendation depends on a moving platform detail, verify against current official docs at the time of the review.
- When profiling is missing, say what should be measured before approving a risky refactor.
- Do not promise wins you cannot explain mechanically.
Agent Compatibility
Keep the workflow tool-agnostic so it works in Codex, Claude Code, Cursor, and similar agents:
- Do not rely on vendor-specific commands or UI affordances.
- Use repo-local tooling when available, otherwise reason directly from source.
- Cite official docs with plain links or titles so any agent can reuse them.
- Keep recommendations actionable even when Instruments screenshots or traces are unavailable.
References
- Review checklist: [references/review-checklist.md](references/review-checklist.md)
- Official grounding: [references/official-performance-sources.md](references/official-performance-sources.md)
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: codeanurag
- Source: codeanurag/swift-performance-engineering-Skill
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.