kjuhwa/skills-hub/cached-heap-snapshot-worker
Claude Code and agent skill by kjuhwa/skills-hub
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Load a Chrome heap snapshot (`.heapsnapshot`) once into a DevTools worker proxy, cache by absolute path, and answer aggregates/stats/staticData queries against the cached proxy to avoid re-parsing multi-gigabyte files on every query.
Install
npx vskill@latest install kjuhwa/skills-hub/cached-heap-snapshot-workerSKILL.md
The same SKILL.md was published earlier as kjuhwa/skills-hub/cached-heap-snapshot-worker.
Cached Heap Snapshot Loader
When to use
- You're exposing "aggregate memory breakdown" / "total size per class" via a tool and the raw V8 heap snapshot is 100s of MB.
- Agents will ask multiple follow-up questions about the same snapshot (top classes, filter by class name, retained sizes).
- Re-parsing per query would blow latency and memory.
How it works
- Maintain a
Map<absolutePath, {snapshot: HeapSnapshotProxy, worker: HeapSnapshotWorkerProxy}>on the manager instance. getSnapshot(path): resolve to absolute path, return cached proxy if present. Otherwise call#loadSnapshot(abs).#loadSnapshot: construct a DevToolsHeapSnapshotWorkerProxy, callworkerProxy.createLoader(1, snapshotProxy => resolveSnapshot(snapshotProxy))withPromise.withResolversto wire the async snapshot-ready callback to a promise.- Stream the file:
fsSync.createReadStream(absolutePath, {encoding: 'utf-8', highWaterMark: 1024*1024}),for await (const chunk of fileStream) await loaderProxy.write(chunk); await loaderProxy.close();. Awaiting each write applies backpressure. - Each cached entry lives until an explicit
dispose(path)call, which terminates the worker (worker.dispose()) and drops the Map entry. - Expose narrow query methods:
getAggregates(path)(pass a blankNodeFilter),getStats(path),getStaticData(path)— each resolves the snapshot and asks it for the derived data.
Example
Gotchas
- The DevTools worker is heavy; a cached entry holds the parsed graph in memory for the lifetime of its process. Expose
disposeand document it. - Resolve paths to absolute before using as map keys — relative paths from different CWDs would double-cache the same file.
createReadStreamwithencoding: 'utf-8'is required; the worker's loader expects strings, not Buffers. The 1MBhighWaterMarkkeeps per-chunk overhead low.await loaderProxy.write(chunk)insidefor awaitis the backpressure point. Never buffer the whole file to a string first — defeats the streaming purpose.- If the file is truncated or malformed, the worker may never call the loader callback. Add an outer timeout/abort or the consumer hangs.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/heap-snapshot/cached-heap-snapshot-worker/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kjuhwa/skills-hub/cached-heap-snapshot-worker)