V8 Heap Snapshot Analyzer
Trace V8 heap retention paths to diagnose leaks and GC-surviving objects.
The skill mainly reads user-supplied heap snapshots and writes investigation scripts under a gitignored scratchpad; no credential theft, exfiltration, or destructive default is shown. However, it does not request confirmation of paths or disclose that heap snapshots may contain source code, prompts, or other sensitive data, and it lacks explicit permission boundaries, cleanup/rollback guidance, and dependency-integrity guidance, so points are deducted.
The workflow is coherent and includes a streaming alternative for large files and explicit weak-edge handling. Static review nevertheless finds that parseSnapshot.ts searches backward from only roughly the final 100 bytes for the strings-array key, which will generally fail to locate a large strings section, and scratchpad examples may use an incorrect ../helpers relative path. There are no skill-specific tests or strong diagnosable failure procedures, so the score remains low.
The audience, input type, and main scenarios are reasonably clear, and the skill states a limitation for snapshots above 2 GiB. It does not define a standard output format, broader non-fit boundaries, exclusion triggers, or Chinese-language usage support. Its core function does not depend on overseas services, so no extra mainland-network deduction is applied.
The documentation is layered across parsing, comparison, retainer tracing, and script authoring, with examples, limitations, concepts, and MIT copyright headers. It lacks a skill version, changelog, standalone installation/dependency notes, FAQ, explicit maintenance owner, and update path; the example import paths are also questionable, so points are deducted.
The intended comparison, graph, and retainer-path operations have clear practical value, and the skill offers a streaming strategy for very large snapshots. However, the apparent parser defect undermines reliable use, outputs are primarily console logs rather than a stable consumable format, and no representative results are statically verifiable, so only partial credit is justified.
The source files, copyright notices, and repository CI are auditable, but the supplied CI workflows cover chat performance and leak checks rather than these helpers. There are no skill-specific tests, sample snapshots, or third-party execution artifacts; the assessment therefore rests mainly on static code inspection and receives low credit.
- The strings-section locator in parseSnapshot.ts may fail on ordinary or large snapshots; fix it and add sample-snapshot tests.
- Relative imports from dated scratchpad subdirectories may need to be ../../helpers.
- Heap snapshots may contain source code, prompts, object contents, and other sensitive data; authorization, storage, retention, and redaction requirements should be explicit.
- Document a stable output format, failure behavior, version/changelog information, dependency setup, and maintenance/update path.
What it does & when to use it
This Agent Skill analyzes V8 `.heapsnapshot` files for memory leaks, retention issues, before/after changes, and objects that survive garbage collection. It provides helpers for parsing snapshots, comparing them, and tracing retainer paths, plus guidance for investigation-specific scratchpad scripts. It starts with snapshots that already exist and does not capture them or drive VS Code scenarios. Snapshots larger than roughly 2 GiB may require streaming analysis instead of a full-file read.
Reads V8 .heapsnapshot files; uses parseSnapshot.ts and buildGraph to parse and model a snapshot; uses compareSnapshots.ts to compare before/after files and expose size, count, new-object-group, and summary results; uses findRetainers.ts to trace retainer paths while skipping weak edges; creates dated investigation scripts and findings.md files in .github/skills/heap-snapshot-analysis/scratchpad/; and uses streamSnapshot.mjs primitives for large-file section scanning, metadata parsing, chunked node and edge processing, and selective string resolution.
- A developer has before/after snapshots from DevTools or another workflow and needs to quantify object-count or size changes.
- An engineer needs to determine why a particular object class remains alive after garbage collection.
- A VS Code memory investigation needs to examine patterns such as RowCache templates, resource pools, observable closures, HoverService state, or serializer snapshots.
- A snapshot is larger than roughly 2 GiB and the analyst must scan only the relevant sections without materializing the whole file.
- An investigator needs one-off scripts and a dated record of hypotheses, rejected leads, measurements, and conclusions.
Pros & cons
- Covers the main analysis stages: parsing, before/after comparison, and retainer-path tracing.
- Explicitly instructs analysts to skip weak edges, reducing false leads from WeakRef and WeakMap relationships.
- Includes a streaming approach for snapshots above roughly 2 GiB, including offset discovery, metadata-driven tuple widths, and chunked processing.
- Documents several VS Code-specific retention patterns and defensive disposal practices.
- Supports dated, gitignored scratchpad investigations with scripts, cached outputs, and findings documentation.
- It analyzes snapshots that already exist; it does not capture snapshots or reproduce interaction scenarios.
- The regular helper may fail on files above roughly 2 GiB because of Node Buffer limits, requiring custom streaming analysis.
- Streaming analysis requires investigation-specific choices about sections and fields, and field-level attribution can undercount listeners, watchers, and back-references.
- The examples assume substantial Node.js heap allocation, including `--max-old-space-size=16384` or higher.
- The source does not provide a standalone installation procedure, platform matrix, or test-suite information.
How to install
The Skill is located at .github/skills/heap-snapshot-analysis/SKILL.md in the microsoft/vscode repository. The source does not document a standalone installation command or separate package; place the directory containing this path where the chosen Agent Skills client can discover it. The repository is licensed under MIT.
How to use
Start with existing .heapsnapshot files and ask, for example: “Compare /path/to/before.heapsnapshot with /path/to/after.heapsnapshot, identify the largest new object groups, and trace retainer paths for ChatModel.” Investigation scripts can import parseSnapshot and buildGraph from ../helpers/parseSnapshot.ts, compareSnapshots from ../helpers/compareSnapshots.ts, or findRetainerPaths from ../helpers/findRetainers.ts. The source provides this execution form: cd .github/skills/heap-snapshot-analysis, then run node --max-old-space-size=16384 scratchpad/analyze.mjs; for very large files, write a streaming script using streamSnapshot.mjs. If the task also requires launching VS Code, driving a scenario, and capturing snapshots, use the VS Code performance workflow skill first.
Compared to similar skills
The VS Code performance workflow skill serves a different stage: it launches VS Code, drives a scenario, and captures snapshots, while this Skill performs low-level analysis on snapshots that already exist. They are complementary rather than interchangeable.