agentleFS
ChromeDevToolsChromeDevTools/chrome-devtools-mcp/skills/memory-leak-debugging/SKILL.md

memory-leak-debugging

Skill53k starsChanged 6 months agoApache-2.0View on GitHub

Diagnoses and resolves memory leaks in JavaScript/Node.js applications. Use when a user reports high memory usage, OOM errors, or wants to capture, compare, or inspect heap snapshots with Chrome DevTools MCP memory tools.

2 other projects use a version of this, 2 of them edited; 2 of 2 edited versions we compared changed its rules.

How people change it

2 of 2 edited versions changed its rules, and some changes recur.

Of the 2 edited versions we compared: 2 made changes of their own.

Rules people drop

  1. Prefer MCP memory tools: Do NOT attempt to read raw .heapsnapshot files directly, as they are extremely large and will consume too many tokens. Use the Chrome DevTools MCP heap snapshot tools to summarize, compare, and inspect snapshots.dropped by 2 of 2
  2. Start with get_heapsnapshot_summary for each snapshot to confirm that the files load and to compare high-level totals.dropped by 2 of 2
  3. Use compare_heapsnapshots to compare baseline and target snapshots. Start without classIndex for the summary diff, then request detailed class diffs only for suspicious growth by specifying classIndex.dropped by 2 of 2
  4. Use the summary output from compare_heapsnapshots before drilling into specific node IDs.dropped by 2 of 2
  5. When a class or object type grows unexpectedly, inspect the retaining chain and dominators with the MCP tools before changing code.dropped by 2 of 2
  6. Use get_heapsnapshot_class_nodes to list instances of the suspicious class.dropped by 2 of 2
  7. Use get_heapsnapshot_retainers, get_heapsnapshot_retaining_paths, get_heapsnapshot_dominators, and get_heapsnapshot_edges to understand why representative nodes are still reachable.dropped by 2 of 2
  8. Use get_heapsnapshot_object_details with a specific nodeId to retrieve detailed object metadata (size, type, distance, and DOM detachedness).dropped by 2 of 2

Rules people add

  1. A rule we can't quote: its licence doesn't allow itadded by 2 of 2
  2. A rule we can't quote: its licence doesn't allow itadded by 2 of 2
  3. A rule we can't quote: its licence doesn't allow itadded by 2 of 2
  4. A rule we can't quote: its licence doesn't allow itadded by 2 of 2
  5. A rule we can't quote: its licence doesn't allow itadded by 2 of 2
  6. A rule we can't quote: its licence doesn't allow itadded by 2 of 2
  7. A rule we can't quote: its licence doesn't allow itadded by 2 of 2

We split this file and each edited version into the rules they give an agent and match them by wording. A version that adds no rule of its own and has not changed since this file last did reads as an older text, so what it lacks is not counted as dropped. We keep no past texts of a file, so that is inferred, and an edited version that started from an older text still counts its gaps as drops.

Adopted by

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Sep 27: 0 new projectsWeek of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projectsWeek of Nov 8: 0 new projectsWeek of Nov 15: 0 new projects
Sep 2026Oct 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Most recently taken up by

Who's talking about ChromeDevTools/chrome-devtools-mcp

The biggest 5 of 102 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 102

Talked about on GitHub, Bluesky and Hacker News (102 times).

On GitHub · 50

45 more on GitHub

On Bluesky · 50

45 more on Bluesky
  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 2

    1. diodeme/Gold-Band★ 14348% same
    2. MorningStar0709/trae-agent-enhancements★ 1826% same

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository7 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 4 are distinctive, and 12 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 12

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Prefer MCP memory tools: Do NOT attempt to read raw .heapsnapshot files directly, as they are extremely large and will consume too many …

    line 16
  2. Distinctive:

    Common Culprits: Look for detached DOM nodes, unhandled closures, global variables, event listeners not being removed, and caches growing …

    line 18
  3. Very specific:

    When investigating a frontend web application memory leak, utilize the chrome-devtools-mcp tools to interact with the application and take …

    line 25
  4. Very specific:

    Use page-scoped tools like click, navigate_page, fill, etc.

    line 27
  5. Very specific:

    Use take_heapsnapshot (with pageId) to save .heapsnapshot files to disk at baseline, target (after actions), and final (after reverting …

    line 30
  6. Very specific:

    Start with get_heapsnapshot_summary for each snapshot to confirm that the files load and to compare high-level totals.

    line 36
  7. Very specific:

    Use compare_heapsnapshots to compare baseline and target snapshots.

    line 37
  8. Very specific:

    Use the summary output from compare_heapsnapshots before drilling into specific node IDs.

    line 38
  9. Distinctive:

    When a class or object type grows unexpectedly, inspect the retaining chain and dominators with the MCP tools before changing code.

    line 42
  10. Very specific:

    Use get_heapsnapshot_class_nodes to list instances of the suspicious class.

    line 44
  11. Very specific:

    Use get_heapsnapshot_retainers, get_heapsnapshot_retaining_paths, get_heapsnapshot_dominators, and get_heapsnapshot_edges to understand why …

    line 45
  12. Very specific:

    Use get_heapsnapshot_object_details with a specific nodeId to retrieve detailed object metadata (size, type, distance, and DOM …

    line 46
  13. Very specific:

    Use get_heapsnapshot_duplicate_strings when string growth dominates the diff.

    line 47
  14. Distinctive:

    Read references/common-leaks.md for examples of common memory leaks and how to fix them after the retaining path points at application code.

    line 48
  15. Distinctive:

    Use built-in MCP memory tools and filters to pinpoint specific leak categories directly without external tools.

    line 52
  16. Very specific:

    Use get_heapsnapshot_details or get_heapsnapshot_class_nodes with filterName to target common leak causes:

    line 54

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Memory Leak Debugging

This skill provides expert guidance and workflows for finding, diagnosing, and fixing memory leaks in JavaScript and Node.js applications using Chrome DevTools MCP tools.

Prerequisites

Advanced memory debugging tools (compare_heapsnapshots, get_heapsnapshot_details, etc.) are only available when the server is started with the --memoryDebugging flag. First check if these tools are available; if not, try to read the MCP configuration file to check if --memoryDebugging is enabled.

Core Principles

  • Prefer MCP memory tools: Do NOT attempt to read raw .heapsnapshot files directly, as they are extremely large and will consume too many tokens. Use the Chrome DevTools MCP heap snapshot tools to summarize, compare, and inspect snapshots.
  • Isolate the Leak: Determine if the leak is in the browser (client-side) or Node.js (server-side).
  • Common Culprits: Look for detached DOM nodes, unhandled closures, global variables, event listeners not being removed, and caches growing unbounded. Note: Detached DOM nodes are sometimes intentional caches; always ask the user before nulling them.
  • Close Loaded Snapshots: Heap snapshots can be large. After completing an investigation, use close_heapsnapshot for each loaded snapshot to release memory held by the MCP server.

Workflows

1. Capturing Snapshots

When investigating a frontend web application memory leak, utilize the chrome-devtools-mcp tools to interact with the application and take snapshots.

  • Use page-scoped tools like click, navigate_page, fill, etc. (specifying pageId) to manipulate the page into the desired state.
  • Revert the page back to the original state after interactions to see if memory is released.
  • Repeat the same user interactions 10 times to amplify the leak.
  • Use take_heapsnapshot (with pageId) to save .heapsnapshot files to disk at baseline, target (after actions), and final (after reverting actions) states.

2. Comparing Snapshots

Once you have generated .heapsnapshot files using take_heapsnapshot, compare them with Chrome DevTools MCP memory tools.

  • Start with get_heapsnapshot_summary for each snapshot to confirm that the files load and to compare high-level totals.
  • Use compare_heapsnapshots to compare baseline and target snapshots. Start without classIndex for the summary diff, then request detailed class diffs only for suspicious growth by specifying classIndex.
  • Use the summary output from compare_heapsnapshots before drilling into specific node IDs.

3. Inspecting Retainers and Dominator Chains

When a class or object type grows unexpectedly, inspect the retaining chain and dominators with the MCP tools before changing code.

  • Use get_heapsnapshot_class_nodes to list instances of the suspicious class.
  • Use get_heapsnapshot_retainers, get_heapsnapshot_retaining_paths, get_heapsnapshot_dominators, and get_heapsnapshot_edges to understand why representative nodes are still reachable.
  • Use get_heapsnapshot_object_details with a specific nodeId to retrieve detailed object metadata (size, type, distance, and DOM detachedness).
  • Use get_heapsnapshot_duplicate_strings when string growth dominates the diff.
  • Read references/common-leaks.md for examples of common memory leaks and how to fix them after the retaining path points at application code.

4. Advanced Analysis and Categorized Filters

Use built-in MCP memory tools and filters to pinpoint specific leak categories directly without external tools.

  • Use get_heapsnapshot_details or get_heapsnapshot_class_nodes with filterName to target common leak causes:
    • objectsRetainedByDetachedDomNodes: Identifies detached DOM elements retained in memory.
    • objectsRetainedByEventHandlers: Identifies objects kept alive by unremoved event listeners.
    • objectsRetainedByContexts: Identifies objects trapped in closures or execution contexts.
    • objectsRetainedByConsole: Identifies objects retained by console logging.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.