---
name: "webgpu-nextgen-compute-pipeline"
description: "Execute high-performance parallel compute workloads and graphics with WebGPU and WGSL."
metadata:
  author: "W3C WebGPU"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "initialize webgpu device"
  - "write wgsl compute shader"
  - "dispatch webgpu compute pass"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# WebGPU Compute Shaders & WGSL Pipeline

Configures WebGPU pipelines from scratch: navigator.gpu.requestAdapter, GPUDevice, WGSL compute shaders, bind groups, GPUBuffer allocation, and compute pass dispatching.

## When to Invoke
Invoke this skill whenever you need to:
- initialize webgpu device
- write wgsl compute shader
- dispatch webgpu compute pass

## Execution SOP & Rules
1. Verify navigator.gpu availability before attempting adapter requests; provide WebGL fallback.
2. Write compute kernels in WebGPU Shading Language (WGSL) using @compute @workgroup_size(64).
3. Allocate GPUBuffer instances with explicit usage flags (GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC).
4. Submit command buffers cleanly via device.queue.submit([commandEncoder.finish()]).

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
