Agent skill

Memory Leak Audit

by diodeme in diodeme/Gold-Band

Audit code for memory leaks and disposable issues. An agent skill from diodeme/Gold-Band.

AGPL-3.0Auto-check passedDevelopment

Install Memory Leak Audit

skills CLI
$ npx skills add diodeme/Gold-Band --skill memory-leak-audit -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install diodeme/Gold-Band memory-leak-audit --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/diodeme/Gold-Band.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/memory-leak-audit .claude/skills/memory-leak-audit && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
memory-leak-audit
GitHub stars
143
Token cost
~1.3k tokens
SKILL.md length
365 words
Files
1
Skills in repo
11
Repo updated
First seen
Licence
AGPL-3.0

At a glance

Audit code for memory leaks and disposable issues. An agent skill from diodeme/Gold-Band.

  • Works in 6 steps: DOM Event Listeners → One-Time Events → Repeated Method Calls → …
  • Reviewing event listeners
  • SKILL.md covers When to Use, Audit Checklist, Quick Reference and Verification
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Memory Leak Audit is an agent skill from diodeme/Gold-Band. Audit code for memory leaks and disposable issues. Use when reviewing event listeners, DOM handlers, lifecycle callbacks, or fixing leak reports. Covers addDisposableListener, Event.once, MutableDisposable, DisposableStore, and onWillDispose patterns.

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Performance optimization. The repository describes itself as: Desktop app for harness engineering, loop engineering, graph engineering—and whatever comes next in local AI-agent workflows. The licence is AGPL-3.0.

When your agent uses it

  • Reviewing event listeners
  • Lifecycle callbacks
  • Fixing leak reports

Example prompts

  • “/memory-leak-audit”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. DOM Event Listeners
  2. One-Time Events
  3. Repeated Method Calls
  4. Model-Tied DisposableStores
  5. Resource Pool Patterns
  6. Test Validation

What it can do on your machine

Read from SKILL.md and the folder at commit 75622ac. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Memory Leak Audit loads about 1.3k tokens when it runs. Until then it costs about 67 tokens; SKILL.md has 365 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~67
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from diodeme/Gold-Band at commit 75622ac, republished under its AGPL-3.0 licence (© diodeme). 365 words, ~1,337 tokens.

Download SKILL.mdSave it as .claude/skills/memory-leak-audit/SKILL.md (or your agent's skills folder).
name
memory-leak-audit
description
Audit code for memory leaks and disposable issues. Use when reviewing event listeners, DOM handlers, lifecycle callbacks, or fixing leak reports. Covers addDisposableListener, Event.once, MutableDisposable, DisposableStore, and onWillDispose patterns.

Memory Leak Audit

The #1 bug category in VS Code. This skill encodes the patterns that prevent and fix leaks.

When to Use

  • Reviewing code that registers event listeners or DOM handlers
  • Fixing reported memory leaks (listener counts growing over time)
  • Creating objects in methods that are called repeatedly
  • Working with model lifecycle events (onWillDispose, onDidClose)
  • Adding event subscriptions in constructors or setup methods

Audit Checklist

Work through each check in order. A single missed pattern can cause thousands of leaked objects.

Step 1: DOM Event Listeners

Rule: Never use raw .onload, .onclick, or addEventListener() directly. Always use addDisposableListener().

typescript
// BAD — leaks a listener every call
this.iconElement.onload = () => { ... };

// GOOD — tracked and disposable
this._register(addDisposableListener(this.iconElement, 'load', () => { ... }));

Validated by: PR #280566 — Extension icon widget leaked 185 listeners after 37 toggles.

Step 2: One-Time Events

Rule: Use Event.once() for events that should only fire once (lifecycle events, close events, first-change events).

typescript
// BAD — listener stays registered forever after first fire
model.onDidDispose(() => store.dispose());

// GOOD — auto-removes after first invocation
Event.once(model.onDidDispose)(() => store.dispose());

Validated by: PRs #285657, #285661 — Terminal lifecycle hacks replaced with Event.once().

Step 3: Repeated Method Calls

Rule: Objects created in methods called multiple times must NOT be registered to the class this._register(). Use MutableDisposable or return IDisposable to the caller.

typescript
// BAD — every call adds another listener to the class store
startSearch() {
    this._register(this.model.onResults(() => { ... }));
}

// GOOD — MutableDisposable ensures max 1 listener
private readonly _searchListener = this._register(new MutableDisposable());

startSearch() {
    this._searchListener.value = this.model.onResults(() => { ... });
}

When the event should only fire once per method call, combine Event.once() with MutableDisposable — this auto-removes the listener after the first invocation while still guarding against repeated calls:

typescript
private readonly _searchListener = this._register(new MutableDisposable());

startSearch() {
    this._searchListener.value = Event.once(this.model.onResults)(() => { ... });
}

Validated by: PR #283466 — Terminal find widget leaked 1 listener per search.

Show full SKILL.md (153 more words)Show less
Step 4: Model-Tied DisposableStores

Rule: When creating a DisposableStore tied to a model's lifetime, register model.onWillDispose(() => store.dispose()) to the store itself.

typescript
const store = new DisposableStore();
store.add(model.onWillDispose(() => store.dispose()));
store.add(model.onDidChange(() => { ... }));

Validated by: Pattern used in chatEditingSession.ts, fileBasedRecommendations.ts, testingContentProvider.ts.

Step 5: Resource Pool Patterns

Rule: When using factory methods that create pooled objects (lists, trees), disposables must be registered to the individual item, not the pool class.

typescript
// BAD — registers to pool, never cleaned per item
createItem() {
    const item = new Item();
    this._register(item.onEvent(() => { ... }));
    return item;
}

// GOOD — wrap with item-scoped disposal
createItem(): IDisposable & Item {
    const store = new DisposableStore();
    const item = new Item();
    store.add(item.onEvent(() => { ... }));
    return { ...item, dispose: () => store.dispose() };
}

Validated by: PR #290505 — Chat content parts CollapsibleListPool and TreePool leaked disposables.

Step 6: Test Validation

Rule: Every test suite that creates disposable objects must call ensureNoDisposablesAreLeakedInTestSuite().

typescript
import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js';

suite('MyFeature', () => {
    ensureNoDisposablesAreLeakedInTestSuite();

    test('does something', () => {
        // test disposables are tracked automatically
    });
});

Quick Reference

ScenarioPatternAnti-Pattern
DOM eventsaddDisposableListener().onclick =, addEventListener()
One-time eventsEvent.once(event)(handler)event(handler) for lifecycle
Repeated methodsMutableDisposable or return IDisposablethis._register() in non-constructor
Model lifecyclestore.add(model.onWillDispose(...))Forgetting cleanup
Pooled objectsItem-scoped DisposableStorePool-scoped this._register()
TestsensureNoDisposablesAreLeakedInTestSuite()No leak checking

Verification

After fixing leaks, verify by:

  1. Checking listener counts before/after repeated operations
  2. Running ensureNoDisposablesAreLeakedInTestSuite() in tests
  3. Confirming object counts stabilize (don't grow linearly with usage)

© diodeme, AGPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/memory-leak-audit of diodeme/Gold-Band.

Open the folder on GitHubat commit 75622ac

Compare with similar skills

Memory Leak Audit next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Memory Leak Audit compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Memory Leak Audit this skilldiodeme/Gold-Band143—~1.3kAutomated safety check: PassAGPL-3.0
Code Review ChecklistshareAI-lab/learn-claude-code78k5 repos~1.1kAutomated safety check: PassMIT
LLM Torch Profiler Analysissgl-project/sglang37k2 repos~6.4kAutomated safety check: PassApache-2.0
Pycrazyguitar/pysheeet8.2k—~886Automated safety check: PassMIT
Cmux Debugging Guidemanaflow-ai/cmux28k1 repos~1.1kAutomated safety check: PassCustom licence
Electron Heap Snapshot Analysiskeybase/client9.3k—~875Automated safety check: PassBSD-3-Clause

Similar skills

  • Code Review Checklist

    shareAI-lab/learn-claude-code

    Reviews code against a five-part checklist covering security, correctness, performance, maintainability and testing, and reports findings in a fixed format.

    78k GitHub starsUsed in 5 repos~1.1k tokens
    DevelopmentAuto-check passed
  • LLM Torch Profiler Analysis

    sgl-project/sglang

    Unified LLM torch-profiler triage skill for sglang, vllm, TensorRT-LLM, and TokenSpeed.

    37k GitHub starsUsed in 2 repos~6.4k tokens
    DevelopmentAuto-check passed
  • Py

    crazyguitar/pysheeet

    Comprehensive Python programming reference covering syntax, concurrency, networking, databases, ML/LLM development, and HPC.

    8.2k GitHub stars~886 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Cmux Debugging Guide

    manaflow-ai/cmux

    Covers debug logging, the Debug menu, profiling rules and runtime pitfalls for working on the cmux macOS terminal app.

    28k GitHub starsUsed in 1 repo~1.1k tokens
    DevelopmentAuto-check passed
  • Analyzes V8, Chrome and Electron .heapsnapshot files with Node scripts to find memory leaks, detached DOM nodes and the retainer paths that keep objects alive.

    9.3k GitHub stars~875 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Runs controlled JMH experiments on the Caffeine cache to find shared contention and hot-path waste, then reviews correctness and returns a reviewable patch.

    18k GitHub stars~2.6k tokensUpdated 3 days ago
    DevelopmentAuto-check: notes

More from diodeme/Gold-Band

All 11 skills in this repo
  • Rust Async Patterns

    diodeme/Gold-Band

    Master Rust async programming with Tokio, async traits, error handling, and concurrent patterns.

    143 GitHub starsUsed in 10 repos~3.1k tokens
    Auto-check passed
  • Rust Profiling

    diodeme/Gold-Band

    Rust profiling skill for performance analysis. An agent skill from diodeme/Gold-Band.

    143 GitHub starsUsed in 1 repo~1.7k tokens
    Auto-check: notes
  • Memory Leak Debugging

    diodeme/Gold-Band

    Diagnoses and resolves memory leaks in JavaScript/Node.js applications.

    143 GitHub stars~712 tokensUpdated 8 days ago
    Auto-check passed
  • Git Changelog

    diodeme/Gold-Band

    Create and localize user-facing release notes from an explicit Git change range.

    143 GitHub stars~1.4k tokensUpdated 8 days ago
    Auto-check passed
  • Git PR

    diodeme/Gold-Band

    Prepare, review, publish, or update a complete GitHub pull request for the current repository, including local commit readiness, safe push strategy, semantic title validation, repository-native PR…

    143 GitHub stars~1.5k tokensUpdated 8 days ago
    Auto-check passed
  • Stitch Design

    diodeme/Gold-Band

    Unified entry point for Stitch design work. An agent skill from diodeme/Gold-Band.

    143 GitHub starsUsed in 1 repo~925 tokens
    Auto-check passed

Categories

Questions about Memory Leak Audit

What does Memory Leak Audit do?

Audit code for memory leaks and disposable issues. An agent skill from diodeme/Gold-Band. Memory Leak Audit is an agent skill from diodeme/Gold-Band. Audit code for memory leaks and disposable issues.

When should I use Memory Leak Audit?

Memory Leak Audit fits situations like: reviewing event listeners; lifecycle callbacks; fixing leak reports.

How do I install Memory Leak Audit in Claude Code?

Run `npx skills add diodeme/Gold-Band --skill memory-leak-audit -a claude-code`. Or copy the skill folder (.agents/skills/memory-leak-audit in diodeme/Gold-Band) into .claude/skills/memory-leak-audit in your project. Claude Code loads it when a task matches its description.

How do I install Memory Leak Audit in Codex?

Run `npx skills add diodeme/Gold-Band --skill memory-leak-audit -a codex`. Or copy the skill folder (.agents/skills/memory-leak-audit in diodeme/Gold-Band) into .agents/skills/memory-leak-audit in your project. Codex loads it when a task matches its description.

Can I use Memory Leak Audit in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add diodeme/Gold-Band --skill memory-leak-audit -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/memory-leak-audit, .gemini/skills/memory-leak-audit, .github/skills/memory-leak-audit and .opencode/skills/memory-leak-audit in your project.

What does Memory Leak Audit need to run?

SKILL.md names no scripts, command-line tools or credentials: Memory Leak Audit is instructions for the agent only.

Does Memory Leak Audit access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Memory Leak Audit safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Memory Leak Audit use?

Memory Leak Audit is published under the AGPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Memory Leak Audit use?

About 1.3k tokens (SKILL.md is roughly 5.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Memory Leak Audit?

Skills that share tags, products or a category with Memory Leak Audit: Code Review Checklist (shareAI-lab/learn-claude-code, 78k stars), LLM Torch Profiler Analysis (sgl-project/sglang, 37k stars), Py (crazyguitar/pysheeet, 8.2k stars) and Cmux Debugging Guide (manaflow-ai/cmux, 28k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Memory Leak Audit?

diodeme (a GitHub user) maintains it in diodeme/Gold-Band, which has 143 GitHub stars. The repository holds 11 skills in this directory. The repository was last updated on September 30, 2026.

Source: diodeme/Gold-Band on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.