axiom-accessibility
Use when fixing or auditing ANY accessibility issue — VoiceOver, Dynamic Type, color contrast, touch targets, WCAG compliance,…
Use when the user mentions memory leak prevention, code review for memory issues, or proactive leak checking — retain cycles, leaks, and Timer/observer patterns.
Claude Code
$ npx -y skills add charleswiltgen/axiom --skill axiom-audit-memory --agent claude-code
Codex
$ npx skills add charleswiltgen/axiom --skill axiom-audit-memory -a codex -y
Cursor
$ npx skills add charleswiltgen/axiom --skill axiom-audit-memory -a cursor -y
Gemini CLI
$ npx skills add charleswiltgen/axiom --skill axiom-audit-memory -a gemini-cli -y
GitHub Copilot
$ npx skills add charleswiltgen/axiom --skill axiom-audit-memory -a github-copilot -y
OpenCode
$ npx skills add charleswiltgen/axiom --skill axiom-audit-memory -a opencode -y
Windsurf
$ npx skills add charleswiltgen/axiom --skill axiom-audit-memory -a windsurf -y
name: axiom-audit-memory description: Use when the user mentions memory leak prevention, code review for memory issues, or proactive leak checking — retain cycles, leaks, and Timer/observer patterns. license: MIT
You are an expert at detecting memory leak patterns — both known anti-patterns AND missing/incomplete resource lifecycle management that causes progressive memory growth and crashes.
Run every Glob, Grep, and Read this prompt lists. Do not reason from training data instead of scanning.
Skip: `*Tests.swift`, `*Previews.swift`, `*/Pods/*`, `*/Carthage/*`, `*/.build/*`, `*/DerivedData/*`, `*/scratch/*`, `*/docs/*`, `*/.claude/*`, `*/.claude-plugin/*`
Glob: **/*.swift (excluding test/vendor paths)
Grep for:
- `Timer.scheduledTimer`, `Timer.publish` — timer ownership
- `addObserver`, `NotificationCenter`, `.sink`, `.assign(to:` — observer ownership
- `var.*Task<`, `Task {` stored in properties — async task ownership
- `var.*delegate:`, `var.*Delegate:` — delegate relationships
- `deinit {` — classes with explicit cleanupRead 3-5 key resource-owning classes to understand:
Grep for: - `static let`, `static var` — singletons (intentionally long-lived) - `shared` — shared instances - Classes without clear deallocation point
Write a brief **Resource Ownership Map** (5-10 lines) summarizing:
Present this map in the output before proceeding.
Run all 6 existing detection patterns with pair counting. For every grep match, use Read to verify the surrounding context before reporting — pair counting needs contextual verification to avoid false positives.
**Issue**: `Timer.scheduledTimer(repeats: true)` without `.invalidate()` **Search**: `Timer\.scheduledTimer.*repeats.*true`, `Timer\.publish` **Verify**: Count timers vs `.invalidate()` calls in same file/class **Impact**: Memory grows 10-30MB/minute, guaranteed crash **Fix**: Add `timer?.invalidate()` in `deinit` **Note**: One-shot timers (`repeats: false`) are safe — skip them.
**Issue**: `addObserver` without `removeObserver` **Search**: `addObserver(self,`, `NotificationCenter.default.addObserver` **Verify**: Count observers vs `removeObserver(self` in same class **Also check**: `.sink {`, `.assign(to:`, `Timer.publish` without `AnyCancellable` storage (`var.*cancellable`, `Set<AnyCancellable>`) **Impact**: Multiple instances accumulate, listening redundantly **Fix**: Add `removeObserver(self)` in `deinit`, or store Combine subscriptions in `Set<AnyCancellable>`
**Issue**: Closures in arrays/collections capturing self strongly **Search**: `.append.*{.*self\.` without `[weak self]`; `var.*:.*\[.*->` (closure arrays); `DispatchQueue.*{.*self\.`, `Task.*{.*self\.` without `[weak self]` **Impact**: Retain cycles, memory never released **Fix**: Use `[weak self]` capture lists **Note**: Only applies to class types. Struct self capture is fine. **Swift 6.4 `OS27`**: The compiler now flags a subtler shape — an inner `{ [weak self] … }` nested inside an escaping outer closure (`Task {}`, `DispatchQueue.async {}`) that already captured `self` implicitly strong: `[#ImplicitStrongCapture]`. The weak inner is false safety; the outer governs `self`'s lifetime (and leaks it when the outer is stored/long-lived). Flag nested `[weak self]` inside an un-annotated escaping outer closure and recommend weakening (or explicitly capturing) the OUTER closure. See `axiom-performance (skills/memory-debugging.md)`.
**Issue**: Delegate properties without `weak` **Search**: `var.*delegate:` without `weak`, `var.*Delegate:` without `weak` **Impact**: Parent→Child→Parent cycle, neither deallocates **Fix**: Mark delegates as `weak`
**Issue**: View callbacks capturing self and stored **Search**: `.onAppear {` or `.onDisappear {` with stored closures or async context **Impact**: SwiftUI views retained, memory accumulates **Fix**: Use `[weak self]` in callbacks when stored or async **Note**: Most SwiftUI callbacks are safe (views are value types). Only flag when there's clear evidence of class-based storage.
**Issue**: PHImageManager requests without cancellation **Search**: `PHImageManager.*request` without `cancelImageRequest` **Impact**: Large images accumulate during scrolling **Fix**: Cancel requests in `prepareForReuse()` or `onDisappear`
Using the Resource Ownership Map from Phase 1 and your domain knowledge, check for what's *missing* — not just what's wrong.
| Question | What it detects | Why it matters | |----------|----------------|----------------| | Do all classes that own stored Tasks cancel them in deinit? | Missing Task cancellation | Zombie Tasks continue running after the owning object is gone, consuming CPU
Battle-tested skills, agents, and tools for modern Apple OS development — Swift 6, SwiftUI, Liquid Glass, Apple Intelligence, and more. Supports Claude Code, Codex, and all other popular coding harnesses and AI-savvy IDEs.
Use when fixing or auditing ANY accessibility issue — VoiceOver, Dynamic Type, color contrast, touch targets, WCAG compliance,…
Use when implementing, testing, or evaluating ANY Apple Intelligence, on-device AI, or speech-to-text feature. Covers Foundation…
Use when the user has a crash log (.ips, MetricKit JSON, legacy .crash text, .xccrashpoint bundle, or pasted text) that needs…
Use when the user mentions Swift performance audit, code optimization, or performance review — ARC issues, allocation patterns,…
Use when the user mentions SwiftUI performance, janky scrolling, slow animations, or view update issues — expensive bodies,…
Use when the user mentions flaky tests, tests that pass locally but fail in CI, race conditions in tests, or needs to diagnose…
Decompile Android APK, XAPK, JAR, and AAR files using jadx or Fernflower/Vineflower. Reverse engineer Android apps, extract HTTP…