vscode: Skill for Claude Code

.github/skills/memory-leak-audit/SKILL.md

memory-leak-audit is a skill for Claude Code, Codex from microsoft/vscode. It costs 52 tokens per session (1,292 once invoked), scanned A, original, MIT.

A guide for finding memory leaks caused by event listeners and objects that are not cleaned up when they are no longer needed.

In plain words
What is it for?
It supports reviewing DOM handlers, repeated setup methods, lifecycle events, disposal code, and cleanup patterns such as disposable stores.
Why use it?
It helps prevent unused listeners and lifecycle objects from accumulating and consuming memory over time.

Skill for Claude CodeCodex ✓ vendor

Written for no agent in particular: nothing here depends on one.

This is microsoft/vscode's own configuration. It tells Claude Code and Codex how to work on vscode 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 vscode configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is import { ensureNoDisposablesAreLeakedInTestSuite } from '../../../../base/test/common/utils.js';.

About the project

Visual Studio Code is a code editor that supports editing, navigating, understanding, debugging, and extending software projects. Developers use it for the edit-build-debug cycle, and the catalogue add-ons provide skills, instructions, and agents for working within the editor.

microsoft/vscode · 195,911 stars · on GitHub · code.visualstudio.com

Reuse

Borrowing it

Nothing to install: this file belongs to microsoft/vscode. 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/microsoft/vscode/main/.github/skills/memory-leak-audit/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/microsoft/vscode

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-audit

README.md
[![agentmods](https://agentmods.dev/badge/skills/microsoft/vscode/memory-leak-audit/github.svg)](https://agentmods.dev/skills/microsoft/vscode/memory-leak-audit)
Your own site
<a href="https://agentmods.dev/skills/microsoft/vscode/memory-leak-audit"><img src="https://agentmods.dev/badge/skills/microsoft/vscode/memory-leak-audit/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-audit

Your own site · 80×15
<a href="https://agentmods.dev/skills/microsoft/vscode/memory-leak-audit"><img src="https://agentmods.dev/badge/skills/microsoft/vscode/memory-leak-audit.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,292 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. Third-party audits
  • Snyk pass 26 Oct 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
  • Socket pass 26 Oct 2026
How audits are shown
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.00052 $0.01292
Opus 5.5 $0.00021 $0.00517
Sonnet 5.5 $0.00010 $0.00258
Haiku 4.5 $0.00005 $0.00129

Measured 28d ago against content hash e92ec3760535, 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-audit 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 28d 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.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.github/skills/memory-leak-audit/SKILL.md · 149 lines

How it starts

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

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

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

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

// 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(() => { ... });
}

Read the full file on GitHub · 149 lines

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. 28d ago Changed e92ec3760535
  2. 3mo ago First seen · 149 lines · 52 tokens per session scan A 72f75c035013

Subscribe to this mod's changes

memory-leak-audit is a skill published in the GitHub repository microsoft/vscode (195,911 stars, last pushed today), licensed MIT. It adds 52 tokens to every session and 1,292 once invoked, about $0.0002 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-08-30.

Related

memory-leak-audit compared with skills from other repositories

memory-leak-audit next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
memory-leak-auditmicrosoft/vscodeSkill196ktodayMITA52Claude Code, Codex
rememberlangchain-ai/deepagentsSkill32ktodayMITA71Claude Code, Codex
coding-prefslangchain-ai/deepagentsSkill32ktodayMITA36Claude Code, Codex
ax-cpp-agent-memory-skillsax-llm/axSkill3.0ktodayApache-2.0A42Claude Code, Codex
ax-agent-contextax-llm/axSkill3.0ktodayApache-2.0A147Claude Code, Codex
cyrene-plugin-devPlaya-0v0/Cyrene-AgentSkill8119d agoMITA61Claude Code, Codex
cyrene-obsidian-workspacePlaya-0v0/Cyrene-AgentSkill8119d agoMITA42Claude Code, Codex