chowser: Skill for Claude Code

.agents/skills/memory-leak-diagnosis-skill/SKILL.md

Memory Leak Diagnosis Skill is a skill for Claude Code, Codex from bsreeram08/chowser. It costs 23 tokens per session (4,043 once invoked), scanned A, original, MIT.

A guide to finding and fixing memory leaks and retain cycles in Swift apps. A retain cycle is a loop of references that keeps objects alive after they should be released; Instruments is Apple's tool for investigating this.

In plain words
What is it for?
Use it to inspect leaks and allocations, find reference cycles in closures or delegates, manage timers and observers, cancel requests, and monitor memory during app use.
Why use it?
It helps explain why an app's memory keeps growing and why unused screens or objects are not being released. It covers weak references, cleanup, and profiling with Instruments.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

This is bsreeram08/chowser's own configuration. It tells Claude Code and Codex how to work on chowser itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything chowser configures →

Reuse

Borrowing it

Nothing to install: this file belongs to bsreeram08/chowser. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/bsreeram08/chowser/main/.agents/skills/memory-leak-diagnosis-skill/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/bsreeram08/chowser

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Memory Leak Diagnosis Skill

README.md
[![agentmods](https://agentmods.dev/badge/skills/bsreeram08/chowser/memory-leak-diagnosis-skill/github.svg)](https://agentmods.dev/skills/bsreeram08/chowser/memory-leak-diagnosis-skill)
Your own site
<a href="https://agentmods.dev/skills/bsreeram08/chowser/memory-leak-diagnosis-skill"><img src="https://agentmods.dev/badge/skills/bsreeram08/chowser/memory-leak-diagnosis-skill/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for Memory Leak Diagnosis Skill

Your own site · 80×15
<a href="https://agentmods.dev/skills/bsreeram08/chowser/memory-leak-diagnosis-skill"><img src="https://agentmods.dev/badge/skills/bsreeram08/chowser/memory-leak-diagnosis-skill.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,043 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00023 $0.04043
Opus 5.5 $0.00009 $0.01617
Sonnet 5.5 $0.00005 $0.00809
Haiku 4.5 $0.00002 $0.00404

Measured 4d ago against content hash 6f46b4325a78, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

Memory Leak Diagnosis Skill scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/memory-leak-diagnosis-skill/SKILL.md · 619 lines

How it starts

The opening of the file, as written. The whole thing — 619 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Memory Leak Diagnosis Skill

This skill provides expertise in identifying, diagnosing, and fixing memory leaks and retain cycles in Swift applications. It covers Instruments usage, ARC concepts, and memory management best practices for iOS development.

Best Practices

  1. Understand ARC: Automatic Reference Counting manages memory automatically, but cycles can still occur.

  2. Use Weak References: Break retain cycles by using weak or unowned references in closures and delegates.

  3. Profile Regularly: Use Instruments to detect leaks early in development.

  4. Avoid Strong Reference Cycles: Be aware of parent-child relationships and delegate patterns.

  5. Clean Up Resources: Properly invalidate timers, cancel network requests, and remove observers.

  6. Test Memory Usage: Monitor memory growth during app usage.

Memory Management Guidelines

  • Classes create strong references by default.
  • Use weak for optional relationships that can become nil.
  • Use unowned for non-optional relationships that will always exist.
  • Capture self weakly in closures to prevent retain cycles.
  • Use Instruments Leaks and Allocations instruments for diagnosis.
  • Monitor memory usage with Xcode's Memory Graph Debugger.

Examples

Example 1: Fixing Retain Cycles in Closures

User Prompt: "Fix the retain cycle in this network manager that uses a completion handler."

Expected Output:

import Foundation

// PROBLEMATIC CODE - Retain Cycle
class NetworkManagerBad {
    var completionHandler: (() -> Void)?
    
    func fetchData() {
        // This creates a retain cycle: self -> completionHandler -> self
        self.completionHandler = {
            print("Data fetched")
            self.processData() // 'self' is strongly captured
        }
        
        // Simulate async operation
        DispatchQueue.global().asyncAfter(deadline: .now() + 1) {
            self.completionHandler?()
        }
    }
    
    func processData() {
        print("Processing data")
    }
    
    deinit {
        print("NetworkManagerBad deallocated")
    }
}

// FIXED CODE - Using weak self
class NetworkManagerGood {
    var completionHandler: (() -> Void)?
    
    func fetchData() {
        // Use [weak self] to break the retain cycle
        self.completionHandler = { [weak self] in
            print("Data fetched")
            self?.processData() // 'self' is now weakly captured
        }
        
        // Simulate async operation
        DispatchQueue.global().asyncAfter(deadline: .now() + 1) {
            self.completionHandler?()
        }
    }
    
    func processData() {
        print("Processing data")
    }
    
    deinit {
        print("NetworkManagerGood deallocated") // This will now print!
    }
}

// Alternative: Using unowned for guaranteed non-nil self
class NetworkManagerUnowned {
    var completionHandler: (() -> Void)?
    
    func fetchData() {
        // Use [unowned self] if you're certain self won't be nil
        self.completionHandler = { [unowned self] in
            print("Data fetched")
            self.processData() // No optional chaining needed
        }
        
        DispatchQueue.global().asyncAfter(deadline: .now() + 1) {
            self.completionHandler?()
        }
    }
    
    func processData() {
        print("Processing data")
    }
    
    deinit {
        print("NetworkManagerUnowned deallocated")
    }
}

// Usage example
func testMemoryLeak() {
    print("Creating NetworkManagerBad...")
    var managerBad: NetworkManagerBad? = NetworkManagerBad()
    managerBad?.fetchData()
    managerBad = nil // Won't deallocate due to retain cycle
    
    print("Creating NetworkManagerGood...")
    var managerGood: NetworkManagerGood? = NetworkManagerGood()
    managerGood?.fetchData()
    managerGood = nil // Will deallocate properly
    
    // Give time for async operations
    RunLoop.current.run(until: Date(timeIntervalSinceNow: 2))
}

Read the full file on GitHub · 619 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 619 lines · 23 tokens per session scan A 6f46b4325a78

Subscribe to this mod's changes

Memory Leak Diagnosis Skill is a skill published in the GitHub repository bsreeram08/chowser (12 stars, last pushed 1mo ago), licensed MIT. It adds 23 tokens to every session and 4,043 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-28.

Related

Memory Leak Diagnosis Skill compared with skills from other repositories

Memory Leak Diagnosis Skill next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
Memory Leak Diagnosis Skillbsreeram08/chowserSkill121mo agoMITA23Claude Code, Codex
ios-signing-troubleshootingmilisp/mcp-linkerSkill3441mo agoAGPL-3.0A59Claude Code
ios-simulator-build-runmilisp/mcp-linkerSkill3441mo agoAGPL-3.0A55Claude Code
ipad-layout-auditcruisediary/apple-app-review-skillsSkill207mo agoMITA49Claude Code, Codex
node-connectopenclaw/openclawSkill396ktodayMITA39Claude Code, Codex
jetpack-compose-performanceandroid/skillsSkill11k9d agoApache-2.0A41Claude Code
competition-ios-runtimezhaoxuya520/reverse-skillSkill46k18d agoMITA123Codex