termio-device
See and drive the sibling agent sessions running alongside you on this machine via the…
Use when investigating measured Swift or Apple-platform regressions in CPU, memory, launch, scrolling, animation hitches, image processing, energy, networking, or concurrency, or when designing performance tests and Instruments experiments. Do not use for speculative
$ npx -y skills add termio-sh/termio --skill swift-performance-optimization-skill --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/swift-performance-optimization-skillContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when investigating measured Swift or Apple-platform regressions in CPU, memory, launch, scrolling, animation hitches, image processing, energy, networking, or concurrency, or when designing performance tests and Instruments experiments. Do not use for speculative
name: Swift Performance Optimization Skill description: Use when investigating measured Swift or Apple-platform regressions in CPU, memory, launch, scrolling, animation hitches, image processing, energy, networking, or concurrency, or when designing performance tests and Instruments experiments. Do not use for speculative micro-optimization, ordinary refactoring, or a functional bug without performance evidence.
Optimize from evidence. Preserve behavior, accessibility, data correctness, and lifecycle safety while changing performance characteristics.
The copy-ready examples use Xcode 16, Swift 6 language mode with strict concurrency, and iOS 17. Most principles apply to older targets; verify each API against the app's actual minimum. Material from the OS 27 development cycle is beta relative to stable Xcode 26.6 and requires an explicit request, beta labeling, stable fallback, and availability gate.
1. Define a user-visible symptom and a reproducible scenario. 2. Record device, OS, build configuration, dataset, thermal state, and network conditions. 3. Measure an optimized Release build on representative hardware. Simulator-only timing is not release evidence. 4. Select the instrument that answers the hypothesis. 5. Save a baseline trace or metric, change one variable, then repeat the same scenario. 6. Confirm that the bottleneck moved and no memory, energy, correctness, or accessibility regression appeared. 7. Add a regression threshold where the workload is stable enough to automate.
Useful tools include:
| Symptom | First evidence source | |---|---| | CPU-bound work | Time Profiler; inspect heavy stacks and self time | | SwiftUI update cost | SwiftUI instrument plus Time Profiler | | Scroll or animation stalls | Animation Hitches, Core Animation, signposts | | Growth or leaks | Allocations, Leaks, Memory Graph, memgraphs | | Slow launch | App Launch template and launch signposts | | Battery or thermal issues | Energy Log and device testing | | Field regressions | MetricKit payloads and app-specific telemetry |
Use `os_signpost` or signposter intervals around important operations so traces answer product questions rather than only showing raw symbols.
import Foundation
@MainActor
final class PollingModel {
private var task: Task<Void, Never>?
private(set) var tickCount = 0
func start() {
stop()
task = Task { [weak self] in
while !Task.isCancelled {
do {
try await Task.sleep(for: .seconds(1))
} catch {
return
}
guard let self else { return }
tickCount += 1
}
}
}
func stop() {
task?.cancel()
task = nil
}
deinit {
task?.cancel()
}
}If a Foundation `Timer` is required, capture its owner weakly, store the timer, invalidate the old instance before starting another, and invalidate it on stop/deinit.
See [the lifecycle-safe example](examples/example_memory_management.swift).
See [the list identity example](examples/example_list_optimization.swift).
A terminal-first agentic development environment for agentic coding. Build for CLI/TUI agent. Runtime for Coding Agent, Tmux alternative
Repo: termio-sh/termio
See and drive the sibling agent sessions running alongside you on this machine via the…
See and drive the sibling agent sessions running alongside you in this Termio project via the…
Reverse-lookup glossary that turns a vague description of a web animation or motion effect…
Drive the running termio app via AppleScript / System Events to reach a UI state (focus the…
Apple's approach to interface design and fluid, physical motion, translated for the web. Use…
Drive App Store Connect from the terminal with the `asc` CLI — TestFlight builds, groups,…