Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

axiom-audit-memory

БесплатноБез исполняемых скриптовНе проверен

Use when the user mentions memory leak prevention, code review for memory issues, or proactive leak checking — retain cycles, leaks, and Timer/observer…

CharlesWiltgenот CharlesWiltgen★ 1 277 звёзд на GitHub

Об этом скилле

Memory Auditor Agent

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.

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

Phase 1: Map Resource Ownership

Step 1: Identify Resource-Owning Classes

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 cleanup

Step 2: Identify Cleanup Patterns

Read 3-5 key resource-owning classes to understand:

  • What's the ownership graph? (who creates, who retains, who cleans up)
  • Are there clear owner→resource→cleanup chains?
  • Which classes have deinit and which don't?
  • Are there objects that accumulate resources without bounds?

Step 3: Identify Long-Lived Objects

Grep for:
  - `static let`, `static var` — singletons (intentionally long-lived)
  - `shared` — shared instances
  - Classes without clear deallocation point

Output

Write a brief Resource Ownership Map (5-10 lines) summarizing:

  • Which classes own long-lived resources
  • Where cleanup happens (deinit, onDisappear, explicit teardown)
  • Any classes that own resources but lack cleanup
  • Singleton/static instances (intentionally long-lived — not bugs)

Present this map in the output before proceeding.

Phase 2: Detect Known Leak Patterns

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.

Pattern 1: Timer Leaks (CRITICAL/HIGH)

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.

Pattern 2: Observer/Notification Leaks (HIGH/HIGH)

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>

Pattern 3: Closure Capture Leaks (HIGH/MEDIUM)

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).

Pattern 4: Strong Delegate Cycles (MEDIUM/HIGH)

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

Pattern 5: View Callback Leaks (MEDIUM/LOW)

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 whe

Полный SKILL.md на GitHub

Установить axiom-audit-memory в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

agents/openai.yaml

FAQ

Что делает скилл axiom-audit-memory?

Use when the user mentions memory leak prevention, code review for memory issues, or proactive leak checking — retain cycles, leaks, and Timer/observer patterns.

Как установить скилл axiom-audit-memory?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл axiom-audit-memory запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить axiom-audit-memory с