Skip to main content
skill CX Codex

metal-shader-expert — Claude Code skill: MSL, PBR, GPU debugging

Gives your agent Metal shader expertise for Apple GPUs: MSL, PBR, tile-based deferred rendering, ray tracing. Useful when graphics performance on Apple Silicon becomes the bottleneck.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add curiositech/some_claude_skills --skill metal-shader-expert -a claude-code
Open on GitHub

What metal-shader-expert does

The skill hands your agent a working knowledge of Metal Shading Language and the TBDR architecture. It walks through the usual mistakes: float where half would do, branching on material flags in every fragment, treating an Apple GPU like a desktop renderer. Each one comes with a fix — function constants and pipeline specialization instead of runtime branches, memoryless targets instead of needless stores, the intersector API instead of intersection queries.

Three reference files ship with it. references/pbr-shaders.md covers Cook-Torrance BRDF and material structs. references/noise-effects.md holds hash functions, FBM, Voronoi and domain warping. references/debug-tools.md collects heat maps, debug modes, overdraw visualization and NaN detection. The skill is allowed to use Read, Write, Edit and Bash limited to xcrun, metal and metallib, plus Firecrawl for SIGGRAPH research and WebFetch for Apple docs.

It is not for WebGL or GLSL, not for CUDA, and not for CPU-side optimization. General OpenGL on Apple is out of scope too. Writing shaders for NVIDIA hardware or the browser? The advice here will miss, because the architectures differ.

What it helps with

  • move a fragment shader from float to half and free up registers
  • replace runtime material branches with function constants
  • find out why memory bandwidth stalls on a TBDR GPU
  • set up a GPU capture and locate the pipeline bottleneck
  • build PBR lighting on Cook-Torrance BRDF

Example prompts for the agent

  • Review my Metal fragment shader — where am I wasting float and branching divergently?
  • Help me rewrite this pipeline for TBDR so it stops burning bandwidth
  • Look at my compute shader and tell me how to capture a GPU profile with xcrun

How to install metal-shader-expert

1Skills CLI (Vercel)

npx skills add curiositech/some_claude_skills --skill metal-shader-expert -a claude-code

2Manually: put the files in place

~/.claude/skills/metal-shader-expert/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/metal-shader-expert/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about metal-shader-expert

How do I install metal-shader-expert in Claude?

Run npx skills add curiositech/some_claude_skills --skill metal-shader-expert -a claude-code. The skill lands at ~/.claude/skills/metal-shader-expert/SKILL.md.

What does metal-shader-expert do?

It gives your agent expertise in MSL, PBR rendering, tile-based deferred rendering and GPU debugging on Apple Silicon. It flags common shader performance mistakes and shows the fix.

Does it work for WebGL or CUDA?

No. WebGL and GLSL follow a different architecture, and CUDA is NVIDIA-only. This skill targets Metal and Apple GPUs.

Source text

SKILL.md · MIT
---
name: metal-shader-expert
description: 20 years Weta/Pixar experience in real-time graphics, Metal shaders, and visual effects. Expert in MSL shaders, PBR rendering, tile-based deferred rendering (TBDR), and GPU debugging. Activate
  on 'Metal shader', 'MSL', 'compute shader', 'vertex shader', 'fragment shader', 'PBR', 'ray tracing', 'tile shader', 'GPU profiling', 'Apple GPU'. NOT for WebGL/GLSL (different architecture), general
  OpenGL (deprecated on Apple), CUDA (NVIDIA only), or CPU-side rendering optimization.
allowed-tools: Read,Write,Edit,Bash(xcrun:*,metal:*,metallib:*),mcp__firecrawl__firecrawl_search,WebFetch
metadata:
  category: AI & Machine Learning
  pairs-with:
  - skill: native-app-designer
    reason: GPU-accelerated iOS/Mac apps
  - skill: 2000s-visualization-expert
    reason: Advanced shader techniques
  tags:
  - metal
  - shaders
  - gpu
  - pbr
  - apple
---

# Metal Shader Expert

20+ years Weta/Pixar experience specializing in Metal shaders, real-time rendering, and creative visual effects. Expert in Apple's Tile-Based Deferred Rendering (TBDR) architecture.

## When to Use This Skill

**Use for:**
- Metal Shading Language (MSL) development
- Apple GPU optimization (TBDR architecture)
- PBR rendering pipelines
- Compute shaders and parallel processing
- Ray tracing on Apple Silicon
- GPU profiling and debugging

**Do NOT use for:**
- WebGL/GLSL → different architecture, browser constraints
- CUDA → NVIDIA-only
- OpenGL → deprecated on Apple since 2018
- CPU-side optimization → use general performance tools

## Expert vs Novice Shibboleths

| Topic | Novice | Expert |
|-------|--------|--------|
| **Data types** | Uses `float` everywhere | Defaults to `half` (16-bit), `float` only when precision needed |
| **Specialization** | Runtime branching | Function constants for compile-time specialization |
| **Memory** | Everything in device space | Knows constant/device/threadgroup tradeoffs |
| **Architecture** | Treats like desktop GPU | Understands TBDR: tile memory is free, bandwidth is expensive |
| **Ray tracing** | Uses intersection queries | Uses intersector API (hardware-aligned) |
| **Debugging** | Print debugging | GPU capture, shader profiler, occupancy analysis |

## Common Anti-Patterns

### 32-Bit Everything
| What it looks like | Why it's wrong |
|--------------------|----------------|
| `float4 color`, `float3 normal` everywhere | Wastes registers, reduces occupancy, doubles bandwidth |
| **Instead**: Default to `half`, upgrade to `float` only for positions/depth |

### Ignoring TBDR Architecture
| What it looks like | Why it's wrong |
|--------------------|----------------|
| Treating Apple GPU like immediate-mode renderer | Tile memory reads are free; bandwidth is not |
| **Instead**: Use `[[color(n)]]` freely, prefer memoryless targets, avoid unnecessary store |

### Runtime Branching for Constants
| What it looks like | Why it's wrong |
|--------------------|----------------|
| `if (material.useNormalMap)` checked every fragment | Creates divergent warps, wastes ALU |
| **Instead**: Function constants + pipeline specialization |

### Intersection Queries for Ray Tracing
| What it looks like | Why it's wrong |
|--------------------|----------------|
| Using query-based API | Doesn't align with hardware; less efficient grouping |
| **Instead**: Use intersector API with explicit result handling |

## Evolution Timeline

| Era | Key Development |
|-----|-----------------|
| Pre-2020 | Metal 2.x, OpenGL migration, basic compute |
| 2020-2022 | Apple Silicon, unified memory, tile shaders critical |
| 2023-2024 | Metal 3, mesh shaders, ray tracing HW acceleration |
| 2025+ | Neural Engine + GPU cooperation, Vision Pro foveated rendering |

**Apple Family 9 Note**: Threadgroup memory less advantageous vs direct device access.

## Philosophy: Play, Exposition, Tools

**Play**: The best shaders come from experimentation and happy accidents. Try weird ideas, build beautiful effects.

**Exposition**: If you can't explain it clearly, you don't understand it yet. Comment generously, show the math visually.

**Tools**: A good debug tool saves 100 hours of guessing. Build visualization for every complex shader.

## Core Competencies

| Area | Skills |
|------|--------|
| **MSL** | Kernel functions, vertex/fragment, tile shaders, ray tracing |
| **Production** | Asset pipelines, artist-friendly parameters, fast iteration |
| **Rendering** | PBR, IBL, volumetrics, post-processing, mesh shaders |
| **Debug** | Heat maps, shader inspection, GPU profiling, custom overlays |

## MCP Integrations

| MCP | Purpose |
|-----|---------|
| **Firecrawl** | Research SIGGRAPH papers, Apple GPU architecture |
| **WebFetch** | Fetch Apple Metal documentation |

## Reference Files

| File | Contents |
|------|----------|
| `references/pbr-shaders.md` | Cook-Torrance BRDF, material structs, lighting calculations |
| `references/noise-effects.md` | Hash functions, FBM, Voronoi, domain warping, animated effects |
| `references/debug-tools.md` | Heat maps, debug modes, overdraw viz, NaN detection, wireframe |

## Integration with Other Skills

- **physics-rendering-expert** - Jacobi solver GPU compute shaders
- **native-app-designer** - Visualization and debugging UI

---

*Craft beautiful, performant Metal shaders with the artistry of film production and the pragmatism of real-time constraints.*

© curiositech · MIT · curiositech/some_claude_skills

Similar skills

Everything for Game dev and 3D: Unity, Unreal, Godot, Blender →

From the same set20

cv-creator Builds ATS-optimized resumes in PDF, DOCX, LaTeX, Markdown, and JSON formats. Useful for job applications that need strict formatting over visual flair. CX Codex +1 774installs personal-finance-coach Calculates FIRE retirement numbers, asset allocation models, and safe withdrawal rates based on financial research. Useful for structuring long-term investments. CX Codex +1 769installs photo-composition-critic A skill that critiques photographs: composition, colour harmony and aesthetic scoring, with concrete fixes. Useful when you need a read on an image, not a retouch. CX Codex +1 643installs pwa-expert Turns a web app into an installable, offline-capable PWA: manifest, Service Worker, caching strategies and a custom install prompt. CX Codex +1 544installs mobile-ux-optimizer Optimizes web interfaces for touchscreens, fixes dynamic viewport issues with dvh, and aligns touch targets with mobile platform guidelines. CX Codex +1 498installs web-design-expert Builds web layouts, visual brand identity, and OKLCH color palettes. Works when structuring page hierarchy and responsive designs before coding. CX Codex +1 439installs color-theory-palette-harmony-expert A skill for building color palettes and photo sequences: perceptual LAB and OKLCH spaces, earth-mover distance, warm and cool alternation. CX Codex +1 430installs ai-video-production-master A skill that runs the whole script-to-video pipeline on Apple Silicon Macs: stock footage, T2V and I2V generation, cloud GPU batching. Useful when you need a finished clip, not a single frame. CX Codex +1 398installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor