Webgpu metal debug kit
Skill penspanic/webgpu-metal-debug-kit/skills/webgpu-metal-debug-kit
Debug Chrome WebGPU applications on macOS — browser-level via Chrome DevTools MCP, GPU-driver-level via Xcode xctrace Metal System Trace. Use when: WebGPU rendering bugs, GPU performance issues, shader debugging, frame timing analysis, Metal command buffer profiling.From its SKILL.md
npx -y skills add penspanic/webgpu-metal-debug-kit --skill webgpu-metal-debug-kitAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 4 stars4 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
- runs commandsInstructs the agent to run 6 commands, including `bash ${CLAUDE_SKILL_DIR}/../../demo/start.sh --no-open` and 5 more.
What its file declares
Copied from the file, not written here
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
4.2 KB, 950 tokens by cl100k_base, as published. Nobody here has run it
WebGPU Metal Debug Kit
Debug Chrome WebGPU applications on macOS at two levels:
- Browser level — Chrome DevTools MCP
- GPU driver level — Xcode
xctraceMetal System Trace
Environment
Metal Toolchain: !/usr/bin/xcrun xctrace list templates 2>/dev/null | grep -q "Metal System Trace" && echo "installed" || echo "NOT INSTALLED — run: xcodebuild -downloadComponent MetalToolchain"
Rules
- ONE Chrome only. MCP manages Chrome. Never launch Chrome manually. Never run
setup-metal-debug.sh. - Wait after navigate. After
navigate_page, wait 2-3 seconds before callingevaluate_script. evaluate_scriptovertake_screenshot. Stats = few tokens. Screenshot = ~1MB tokens.- Metal trace: direct command only. Always use
/usr/bin/xcrun xctracedirectly. Never usebash scripts/capture-metal-trace.sh(PATH issues in Claude Code).
Workflow
The user provides a URL to their running WebGPU app. If they say "demo", run bash ${CLAUDE_SKILL_DIR}/../../demo/start.sh --no-open in the background. The script finds an available port automatically and prints Server ready: http://localhost:<port>/demo/. Parse the URL from the output and use it. The --no-open flag prevents opening a system browser (MCP Chrome will be used instead).
Step 1: Open the app
navigate_page → <user's URL>
Wait, then verify the debug helpers are loaded:
// evaluate_script
() => window.__gpu ? window.__gpu.stats() : 'not loaded'
If window.__gpu is not available, the app may not include webgpu-debug-helpers.js. Guide the user to add it.
Step 2: Browser-level debugging
window.__gpu.stats() // { fps, avgMs, maxMs, frameGapMs }
window.__gpu.setDebugMode(0) // normal
window.__gpu.setDebugMode(1) // render path (blue=hit, dark=miss)
window.__gpu.setDebugMode(2) // step heatmap (green=few, red=many)
window.__gpu.setDebugMode(3) // depth (dark=near, bright=far)
window.__gpu.setDebugMode(4) // normals (RGB)
window.__gpu.textures() // tracked texture info
window.__gpu.timings() // GPU timing records
Check list_console_messages for WGSL shader errors or WebGPU warnings.
Step 3: Metal-level profiling (when needed)
When frameGapMs >> avgMs, there may be a driver-level bottleneck.
GPU_PID=$(pgrep -f "Google Chrome.*--type=gpu-process" | head -1)
echo "GPU PID: $GPU_PID"
rm -rf /tmp/webgpu-metal-trace.trace
/usr/bin/xcrun xctrace record \
--template 'Metal System Trace' \
--attach "$GPU_PID" \
--time-limit 5s \
--output /tmp/webgpu-metal-trace.trace
Export and analyze:
/usr/bin/xcrun xctrace export --input /tmp/webgpu-metal-trace.trace --toc | grep schema
/usr/bin/xcrun xctrace export --input /tmp/webgpu-metal-trace.trace \
--xpath '/trace-toc/run/data/table[@schema="metal-gpu-intervals"]'
Look for:
- Command buffer count per frame (high = Dawn overhead)
- Encoder durations (long = GPU bottleneck)
- Gaps between GPU executions (stalls)
Note: For full Metal encoder/command buffer detail, the user should configure MCP with --browser-url to connect to a Chrome launched with --disable-gpu-sandbox. See assets/mcp-settings-metal.json.
Diagnostic Reference
| Symptom | Action |
|---|---|
| Artifacts | setDebugMode(1) — which path is wrong? |
| Shader error | list_console_messages |
| Data missing on GPU | __gpu.stats() — check uploadCount |
| Slow, GPU time fine | Metal trace — command buffer count |
| Hot pixels | setDebugMode(2) — red = expensive |
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 0 of the 12 instructions most debug triage skills give in 950 tokens
Counted across 1,020 of the 1,639 authors here whose files we hold, read 2026-09-06
- Find root cause before attempting any fixin 134 of 1020, across 118 files
- Create a failing test case before implementing a fixin 109 of 1020, across 95 files
- Read error messages and stack traces completelyin 102 of 1020, across 88 files
- Reproduce the issue consistently before investigatingin 90 of 1020, across 77 files
- Make the smallest possible change to test a hypothesisin 90 of 1020, across 76 files
- Trace data flow backward to find the sourcein 84 of 1020, across 70 files
- Form a single hypothesis before testingin 78 of 1020, across 64 files
- Implement only one fix at a timein 76 of 1020, across 63 files
- Question the architecture if three fixes failin 73 of 1020, across 59 files
- Add diagnostic instrumentation at component boundariesin 68 of 1020, across 56 files
- Compare broken code against working examplesin 68 of 1020, across 57 files
- Write a regression test before applying the fixin 62 of 1020, across 55 files
Said here and by no other author read
- Use MCP to manage Chrome instances
- Wait three seconds after navigating pages
- Use evaluate_script instead of taking screenshots
- Use xcrun xctrace directly for Metal profiling
- Verify debug helpers are loaded via window.__gpu
- Check console messages for shader errors
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.