Agent skill

Electron Heap Snapshot Analysis

by keybase in keybase/client

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.

BSD-3-ClauseAuto-check passedDevelopment

Install Electron Heap Snapshot Analysis

skills CLI
$ npx skills add keybase/client --skill electron-heap -a claude-code

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

GitHub CLI
$ gh skill install keybase/client electron-heap --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/keybase/client.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skill/electron-heap .claude/skills/electron-heap && 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
electron-heap
GitHub stars
9.3k
Token cost
~875 tokens
SKILL.md length
363 words
Files
4 (incl. scripts)
Skills in repo
14
Repo updated
First seen
Licence
BSD-3-Clause

At a glance

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.

  • Works in 2 steps: Overview — object counts, sizes,… → Pick suspects from output (see…
  • Hunting a memory leak in a Chrome or Electron app from a heap snapshot
  • SKILL.md covers Workflow, Interpreting results and Gotchas
  • Runs JavaScript scripts from its folder; calls node

What it does

The skill analyzes `.heapsnapshot` files from V8, Chrome and Electron with Node scripts, without opening the DevTools UI. A snapshot is one large JSON file of flat node and edge arrays, and a 100MB file holds roughly 1.2M nodes and takes about 30s to parse. The first script, `heap-stats.js`, gives an overview of object counts, sizes, detached DOM nodes and big strings; the agent picks suspects from that and traces why they stay alive with `heap-retainers.js`.

The retainer script takes a name substring plus options to restrict the search to detached nodes or an object type, sample paths, dump property edges, skip known benign retainers with `--avoid`, or follow only pure-JavaScript paths with `--js-only`. A shared library parses the snapshot, builds a reverse-edge index and finds the shortest path to a root. An interpretation table separates real app leaks (a JavaScript path through fiber state, a store or a cache) from artifacts such as React 19 dev-build stack instrumentation, DevTools itself or Blink-internal retention.

When your agent uses it

  • Hunting a memory leak in a Chrome or Electron app from a heap snapshot
  • Finding out why a detached DOM node is still retained
  • Checking which objects dominate a growing heap

Example prompts

  • “Analyze ./snapshots/after-login.heapsnapshot and tell me what is leaking.”
  • “Why is this detached DOM tree still retained? Use the retainer script and skip DevTools-owned paths.”
  • “Show the biggest strings and the detached DOM nodes in ./snapshots/renderer.heapsnapshot.”

Requirements

  • Node.js, to run the bundled scripts
  • A .heapsnapshot file taken from DevTools

Workflow steps

2 steps, taken from the first numbered list in SKILL.md.

  1. Overview — object counts, sizes, detached DOM, big strings
  2. Pick suspects from output (see interpretation table), then trace retention

What it can do on your machine

Read from SKILL.md and the folder at commit 81e93d6. 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

    Ships 3 files in scripts/ (JavaScript), which the agent can run.

    Shell commands in SKILL.md call:

    • node

    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

Electron Heap Snapshot Analysis loads about 875 tokens when it runs. Until then it costs about 44 tokens; SKILL.md has 363 words of instructions outside code blocks.

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

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); the scripts in this folder are not scanned.

SKILL.md

The full file from keybase/client at commit 81e93d6, republished under its BSD-3-Clause licence (© keybase). 363 words, ~875 tokens.

Download SKILL.mdSave it as .claude/skills/electron-heap/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
electron-heap
description
Use when analyzing a V8/Chrome/Electron .heapsnapshot file — memory leak hunting, detached DOM nodes, "why is this object retained", growing heap, retainer paths.

Heap Snapshot Analysis

Parse DevTools .heapsnapshot files with Node scripts in scripts/ — no DevTools UI needed. Snapshots are one big JSON: flat nodes/edges arrays. 100MB file ≈ 1.2M nodes, parses in ~30s.

Workflow

  1. Overview — object counts, sizes, detached DOM, big strings:
    bash
    node --max-old-space-size=8192 scripts/heap-stats.js <file.heapsnapshot>
  2. Pick suspects from output (see interpretation table), then trace retention:
    bash
    node --max-old-space-size=8192 scripts/heap-retainers.js <file.heapsnapshot> '<name-substring>' \
      [--detached] [--type=object|native|closure] [--samples=N] [--props] \
      [--avoid=InspectorDOMAgent,DevToolsSession,DocumentState] [--js-only]
    • --avoid=... skips retainer nodes by name substring. Re-run with known-benign anchors avoided to see what else retains the object.
    • --js-only finds pure-JS retention paths (no native intermediates) — distinguishes app leaks from Blink-internal retention.
    • --props dumps property edges (e.g. Error message, ref current).

Both scripts require scripts/snapshot-lib.js (parser + reverse-edge index + BFS path-to-root).

Interpreting results

SignalMeaning
Thousands of Error + huge system / StackFrameInfo, message react-stack-top-frame, retained via _debugStackReact 19 dev-build owner-stack instrumentation. Not a leak; absent in prod.
Retainer path through blink::InspectorDOMAgent / DevToolsSessionDevTools itself retains it (snapshot artifact — DevTools must be open to snapshot). Ignore; re-run with --avoid.
Path through blink::DocumentState → form controlBlink session-history form-state keeps removed input alive. Browser-internal, bounded.
Path through blink::FrameSelection → SelectionEditor → RangePage selection/caret still points into detached tree. Released on next selection change; can force with blur()/getSelection().removeAllRanges() on unmount.
Detached DOM with only native retainer paths (--js-only finds nothing)Not an app JS leak. One live leaf (via parent/child member pointers) pins the whole detached tree.
Detached DOM with a JS path (fiber memoizedState, module map, store, cache)Real app leak — fix the JS retainer.
FiberNode via __reactFiber$ expando on a retained DOM nodeNormal: React never deletes expandos; fiber lives as long as its DOM node. Fix the DOM retention, not the fiber.
PerformanceMeasure accumulating under blink::UserTimingperformance.measure() entries never cleared (React dev tracks or app perf code). Bounded noise unless growing.
system / ExternalStringData largeScript sources + big JSON strings (e.g. emoji data). Usually expected.
Show full SKILL.md (69 more words)Show less

Gotchas

  • edges[].to_node is a byte offset into nodes — divide by node-field count (lib handles this).
  • Shortest retainer path ≠ only path. Kill one anchor and the next takes over — enumerate direct retainers before concluding.
  • Everything in a snapshot is live by definition; "leak" means unexpected retainer, not unreachable memory.
  • Skip weak edges when tracing (lib does).
  • Comparing two snapshots (before/after) beats staring at one: diff constructor counts from heap-stats.js runs.

© keybase, BSD-3-Clause. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (scripts) in skill/electron-heap of keybase/client.

  • SKILL.md
  • scripts/heap-retainers.js
  • scripts/heap-stats.js
  • scripts/snapshot-lib.js

Open the folder on GitHubat commit 81e93d6

Compare with similar skills

Electron Heap Snapshot Analysis 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.

Electron Heap Snapshot Analysis compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Electron Heap Snapshot Analysis this skillkeybase/client9.3k—~875Automated safety check: PassBSD-3-Clause
Vercel React Best Practicessanity-io/sanity6.4k130 repos~1.6kAutomated safety check: PassMIT
Cmux Debugging Guidemanaflow-ai/cmux28k1 repos~1.1kAutomated safety check: PassCustom licence
Issue Fixmono/SkiaSharp5.6k—~5.1kAutomated safety check: PassMIT
PlotJuggler 4 Perf ProfilingPlotJuggler/PlotJuggler6.2k—~1.6kAutomated safety check: NotesMPL-2.0
Python Performance Optimizationwshobson/agents40k12 repos~814Automated safety check: PassMIT

Similar skills

  • Official

    React and Next.js performance optimization guidelines from Vercel Engineering.

    6.4k GitHub starsUsed in 130 repos~1.6k tokens
    Frontend & DesignAuto-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
  • Issue Fix

    mono/SkiaSharp

    Fix bugs in SkiaSharp C bindings. An agent skill from mono/SkiaSharp.

    5.6k GitHub stars~5.1k tokensUpdated today
    DevelopmentAuto-check passed
  • PlotJuggler 4 Perf Profiling

    PlotJuggler/PlotJuggler

    Guides CPU profiling of PlotJuggler 4 on Linux with perf: count first, record cheaply with LBR, then read per-thread, flat, flamegraph or time-window views.

    6.2k GitHub stars~1.6k tokensUpdated 6 days ago
    DevelopmentAuto-check: notes
  • Profiles slow Python code with cProfile and memory profilers, then applies targeted fixes for CPU, memory, I/O and query bottlenecks.

    40k GitHub starsUsed in 12 repos~814 tokens
    DevelopmentAuto-check passed
  • The Art of Debugging

    stas00/the-art-of-debugging

    Condensed debugging method and tool recipes for Unix, Python and PyTorch programs: crashes, hangs, segfaults, wrong output, CUDA OOM, NaN values and slowness.

    1.7k GitHub stars~6.1k tokensUpdated yesterday
    DevelopmentAuto-check: notes

More from keybase/client

All 14 skills in this repo
  • Analyzes Chrome or Electron DevTools Performance trace exports with Python scripts to find where render time actually goes, without opening DevTools.

    9.3k GitHub stars~809 tokensUpdated today
    Auto-check passed
  • Captures a clean Keybase service log and analyzes it for redundant, duplicated or looping RPCs, then checks whether a caching fix reduced the calls.

    9.3k GitHub stars~3k tokensUpdated today
    Auto-check passed
  • Parses a React DevTools Profiler JSON export with Python scripts to find re-render storms, commit fan-out and why a component rendered, without opening the DevTools UI.

    9.3k GitHub stars~978 tokensUpdated today
    Auto-check passed
  • Address PR Feedback

    keybase/client

    Fetches GitHub Copilot review feedback from inline threads and review bodies, checks each finding against the code and fixes the valid ones.

    9.3k GitHub stars~657 tokensUpdated today
    Auto-check passed
  • Takes a screenshot of a running Electron desktop app through playwright-cli over remote debugging, shrinks it and shows it so you can check the UI visually.

    9.3k GitHub stars~476 tokensUpdated today
    Auto-check passed
  • Guides writing and fixing end-to-end flow tests for the Keybase app on desktop with Playwright and on iOS with Appium and WebdriverIO, sharing one testID registry.

    9.3k GitHub stars~1.2k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Electron Heap Snapshot Analysis

What does Electron Heap Snapshot Analysis do?

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. heapsnapshot` files from V8, Chrome and Electron with Node scripts, without opening the DevTools UI.2M nodes and takes about 30s to parse.

When should I use Electron Heap Snapshot Analysis?

Electron Heap Snapshot Analysis fits situations like: hunting a memory leak in a Chrome or Electron app from a heap snapshot; finding out why a detached DOM node is still retained; checking which objects dominate a growing heap.

How do I install Electron Heap Snapshot Analysis in Claude Code?

Run `npx skills add keybase/client --skill electron-heap -a claude-code`. Or copy the skill folder (skill/electron-heap in keybase/client) into .claude/skills/electron-heap in your project. Claude Code loads it when a task matches its description.

How do I install Electron Heap Snapshot Analysis in Codex?

Run `npx skills add keybase/client --skill electron-heap -a codex`. Or copy the skill folder (skill/electron-heap in keybase/client) into .agents/skills/electron-heap in your project. Codex loads it when a task matches its description.

Can I use Electron Heap Snapshot Analysis 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 keybase/client --skill electron-heap -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/electron-heap, .gemini/skills/electron-heap, .github/skills/electron-heap and .opencode/skills/electron-heap in your project.

What does Electron Heap Snapshot Analysis need to run?

Going by SKILL.md and its folder, Electron Heap Snapshot Analysis needs JavaScript for the scripts in its folder and the command-line tools its instructions call (node). Our summary lists: Node.js, to run the bundled scripts; A .heapsnapshot file taken from DevTools.

Does Electron Heap Snapshot Analysis 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 Electron Heap Snapshot Analysis 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. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Electron Heap Snapshot Analysis use?

Electron Heap Snapshot Analysis is published under the BSD-3-Clause licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Electron Heap Snapshot Analysis use?

About 875 tokens (SKILL.md is roughly 3.5k 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 Electron Heap Snapshot Analysis?

Skills that share tags, products or a category with Electron Heap Snapshot Analysis: Vercel React Best Practices (sanity-io/sanity, 6.4k stars), Cmux Debugging Guide (manaflow-ai/cmux, 28k stars), Issue Fix (mono/SkiaSharp, 5.6k stars) and PlotJuggler 4 Perf Profiling (PlotJuggler/PlotJuggler, 6.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Electron Heap Snapshot Analysis?

keybase (a GitHub organization) maintains it in keybase/client, which has 9,257 GitHub stars. The repository holds 14 skills in this directory. The repository was last updated on October 7, 2026.

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