Analyze V8 heap snapshots to investigate memory leaks and retention issues. Use when given .heapsnapshot files, asked to compare before/after snapshots, asked to find what retains objects, or investigating why objects survive GC. Provides snapshot parsing, comparison, retainer-path helpers, and scratchpad scripts.
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "heap-snapshot-analysis" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/vscode/main/.github/skills/heap-snapshot-analysis/SKILL.md 2. 保存为 ~/.claude/skills/heap-snapshot-analysis/SKILL.md 3. 装好后重载技能,告诉我可以用了
Investigate memory leaks from V8 heap snapshots (.heapsnapshot files). This skill starts when snapshots already exist: either the user provided them, DevTools exported them, or another workflow produced them. Use the helpers here to compare snapshots, group object deltas, and trace retainer paths.
Start every investigation fresh. Do NOT read, consult, or be influenced by prior investigations found in:
/memories/ (user, session, or repo memory).github/skills/heap-snapshot-analysis/scratchpad/ (previous dated subfolders and their findings.md files)Previous findings can bias the analysis toward suspects that are no longer relevant, or cause the agent to skip steps and jump to conclusions. Let the current snapshots speak for themselves. Only reference prior work if the user explicitly asks you to.
.heapsnapshot files (before/after a workflow)If the user needs the agent to launch VS Code, drive a scenario, and capture snapshots first, use the VS Code performance workflow skill before returning here for low-level snapshot analysis.
Use the helpers in parseSnapshot.ts to load snapshots. The files are often >500MB and too large for JSON.parse as a string — the helpers use Buffer-based extraction. In scratchpad scripts, import helpers from ../helpers/*.ts.
For very large snapshots, the helper may still be too eager. Node cannot create a Buffer larger than roughly 2 GiB, so snapshots above that size can fail with ERR_FS_FILE_TOO_LARGE even before parsing. In that case, do not try to raise --max-old-space-size and retry the same full-file read. Switch to a streaming script.
import { parseSnapshot, buildGraph } from '../helpers/parseSnapshot.ts';
const data = parseSnapshot('/path/to/snapshot.heapsnapshot');
const graph = buildGraph(data);
When a snapshot is too large to load into a single Buffer, write scratchpad scripts that scan and parse only the sections needed for the question. Use streamSnapshot.mjs for the common streaming primitives instead of copying them between scratch scripts.
Useful tricks:
"nodes":, "edges":, "strings":, and "trace_function_infos":. This lets follow-up scripts jump directly to the large arrays instead of searching the whole file repeatedly.snapshot.meta separately from the small header at the start of the file. Use meta.node_fields, meta.node_types, meta.edge_fields, and meta.edge_types to avoid hard-coding tuple widths.nodes and edges, keep a small carryover string between chunks, split on commas, and process complete numeric tokens as they arrive.strings table unless the investigation truly needs it. If you only need suspicious names, collect string indexes from matching nodes/edges first, then resolve only those indexes in a second streaming pass.…
帮助开发者验证 Azure DevOps 流水线改动,快速排查构建与 YAML 配置问题。
帮助用户更新 GitHub Copilot 的 CLI 或 SDK 到较新版本。
帮助开发者升级 Anthropic SDK、迁移版本并解决相关依赖与类型问题。
为 AI 编码助手生成或更新聊天定制配置文件,统一协作与开发体验
帮助开发者定位并读取 Code OSS 开发构建日志,快速排查运行与扩展问题。
将当前会话分支的修改合并回基础分支,便于整合开发成果。