metal-shader-expert — скилл для Claude Code: MSL, PBR и отладка GPU
Помогает писать и оптимизировать шейдеры Metal под Apple GPU: MSL, PBR, tile-based deferred rendering, трассировка лучей. Пригодится, когда проект упирается в производительность графики на Apple Silicon.
npx skills add curiositech/some_claude_skills --skill metal-shader-expert -a claude-codeЧто делает metal-shader-expert
Скилл добавляет агенту экспертизу по Metal Shading Language и архитектуре TBDR. Внутри — разбор типичных ошибок: float вместо half там, где хватает 16 бит, ветвления по константам материала в каждом фрагменте, обращение с Apple GPU как с обычным десктопным рендерером. По каждому пункту даётся замена: функциональные константы и специализация пайплайна вместо рантайм-ветвлений, memoryless-таргеты вместо лишних записей, intersector API вместо intersection queries.
Есть справочные файлы: references/pbr-shaders.md с Cook-Torrance BRDF и структурами материалов, references/noise-effects.md с хеш-функциями, FBM и доменным искажением, references/debug-tools.md с тепловыми картами, режимами отладки и поиском NaN. Из инструментов скилл берёт Read, Write, Edit, Bash с ограничением на xcrun, metal и metallib, плюс Firecrawl для поиска статей SIGGRAPH и WebFetch для документации Apple.
Скилл не для WebGL и GLSL, не для CUDA и не для оптимизации на стороне CPU. Общее OpenGL на Apple не рассматривается. Если вы пишете шейдеры под NVIDIA или браузер, эта штука вам не поможет — архитектуры разные, советы будут мимо.
Какие задачи решает
- переписать фрагментный шейдер с
floatнаhalfи вернуть регистры - убрать рантайм-ветвления по материалу через функциональные константы
- разобраться, почему на TBDR-архитектуре проседает пропускная способность памяти
- настроить GPU-захват и найти узкое место в пайплайне
- собрать PBR-освещение с Cook-Torrance BRDF
Примеры запросов агенту
- Проверь мой фрагментный шейдер на Metal: где тут лишний
floatи дивергентные ветвления? - Помоги переписать этот пайплайн под TBDR, чтобы не тратить bandwidth впустую
- Разбери мой compute-шейдер и подскажи, как снять GPU-профиль через
xcrun
Как установить metal-shader-expert
1Через Skills CLI (Vercel)
npx skills add curiositech/some_claude_skills --skill metal-shader-expert -a claude-code2Вручную: положить файлы
~/.claude/skills/metal-shader-expert/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/metal-shader-expert/
1Через Skills CLI (Vercel)
npx skills add curiositech/some_claude_skills --skill metal-shader-expert -a codex2Вручную: положить файлы
.agents/skills/metal-shader-expert/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add curiositech/some_claude_skills --skill metal-shader-expert -a cursor2Вручную: положить файлы
.cursor/skills/metal-shader-expert/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install curiositech/some_claude_skills metal-shader-expert2Вручную: положить файлы
.github/skills/metal-shader-expert/SKILL.md1Через Skills CLI (Vercel)
npx skills add curiositech/some_claude_skills --skill metal-shader-expert -a gemini-cli2Командой платформы
gemini skills install https://github.com/curiositech/some_claude_skills --path .claude/skills/metal-shader-expertВручную: положить файлы
.devin/skills/metal-shader-expert/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add curiositech/some_claude_skills --skill metal-shader-expert -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о metal-shader-expert
Как установить metal-shader-expert в Claude?
Выполните npx skills add curiositech/some_claude_skills --skill metal-shader-expert -a claude-code. После этого скилл окажется в ~/.claude/skills/metal-shader-expert/SKILL.md.
Что делает metal-shader-expert?
Даёт агенту экспертизу по MSL, PBR-рендерингу, tile-based deferred rendering и отладке GPU на Apple Silicon. Подсказывает, как убрать типичные ошибки производительности в шейдерах.
Подойдёт ли скилл для WebGL или CUDA?
Нет. WebGL и GLSL устроены иначе, CUDA работает только на NVIDIA. Скилл рассчитан на Metal и Apple GPU.
Исходный текст
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