gamedev-unity/skills/unity-skills/skills/shader/SKILL.md
Manage HLSL/ShaderLab .shader files — create, read, list, find, delete, and inspect shader properties/keywords. Use when creating or editing handwritten shaders, listing or finding .shader files, or inspecting their properties and keywords, even if the user just says "写个shader" or "着色器文件". 管理 HLSL/ShaderLab .shader 文件(创建、读取、列出、查找、删除、检查 shader 属性/关键字);当用户要创建或编辑手写 shader、列出或查找 .shader 文件、或检查其属性与关键字时使用。
npx skillsauth add bernatmv/ai-rules unity-shaderInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Work with .shader HLSL/ShaderLab files (create from templates, read source, list, find, get keywords/properties/variants, check errors, delete, toggle global keywords). For node-based ShaderGraph use the shadergraph module.
shader_read, shader_list, shader_find, shader_get_properties, shader_check_errors, shader_get_keywords, shader_get_variant_count) are SkillMode.SemiAuto — they run in all three modes without grant.shader_create, shader_create_urp, shader_set_global_keyword) are SkillMode.FullAuto — under Approval they need user grant (grant triggers one server-side execute returning the result); under Auto / Bypass they execute directly.shader_delete carries SkillOperation.Delete and is auto-forbidden in Approval / Auto modes (NeverInSemi). Only Bypass or the user-managed Allowlist can run it.DO NOT (common hallucinations):
shader_set_property does not exist → use material_set_float/material_set_color/etc. on the material, not the shadershader_apply / shader_assign do not exist → use material_set_shader to change a material's shadershader_get_properties returns shader property definitions (name/type/range), not current values → for material instance values use material_get_properties"Standard", "Universal Render Pipeline/Lit", not "standard" or "URP Lit"Routing:
material modulematerial_set_keyword (material module)shader_set_global_keyword (this module)| Skill | Description |
|-------|-------------|
| shader_create | Create shader file |
| shader_read | Read shader source |
| shader_list | List all shaders |
| shader_find | Find shader by name |
| shader_delete | Delete shader file |
| shader_get_properties | Get shader properties |
| shader_check_errors | Check shader for compilation errors |
| shader_get_keywords | Get shader keyword list |
| shader_get_variant_count | Get shader variant count for performance analysis |
| shader_create_urp | Create a URP shader from template |
| shader_set_global_keyword | Enable or disable a global shader keyword |
Create a shader file. The template parameter is raw shader source code that gets written verbatim into the .shader file — it is not a preset name. If you pass template="Standard" the literal string Standard will be written to disk and the shader will fail to compile.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| shaderName | string | Yes | - | Shader name written into the Shader "..." declaration (e.g., "Custom/MyShader") |
| savePath | string | Yes | - | Save path (e.g., "Assets/Shaders/My.shader") |
| template | string | No | null | Full ShaderLab/HLSL source string. When omitted, a built-in Unlit template (_MainTex + _Color, single CGPROGRAM pass) is used. There are no other built-in presets. |
For a URP Unlit / Lit preset, use
shader_create_urp(type: "Unlit" | "Lit") instead — it actually selects a template by name.
Read shader source code.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| shaderPath | string | Yes | Shader asset path |
Returns: {path, lines, content}
List all shaders in project.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| filter | string | No | null | Name filter |
| limit | int | No | 100 | Max results |
Returns: {count, shaders: [{path, name, propertyCount}]}
Find a shader by name.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| searchName | string | Yes | Shader name to find |
Returns: {found, name, path}
Delete a shader file.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| shaderPath | string | Yes | Shader asset path |
Get all properties defined in a shader.
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| shaderNameOrPath | string | Yes | Shader name or shader asset path |
Returns: {success, properties: [{name, type, description}]}
shader_check_errorsCheck shader for compilation errors.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| shaderNameOrPath | string | Yes | - | Shader name or asset path (e.g., "Custom/MyShader" or "Assets/Shaders/My.shader") |
Returns: { shaderName, hasErrors, messageCount }
shader_get_keywordsGet shader keyword list.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| shaderNameOrPath | string | Yes | - | Shader name or asset path (e.g., "Custom/MyShader" or "Assets/Shaders/My.shader") |
Returns: { shaderName, keywordCount, keywords: [{ name, type }] }
shader_get_variant_countGet shader variant count for performance analysis.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| shaderNameOrPath | string | Yes | - | Shader name or asset path (e.g., "Custom/MyShader" or "Assets/Shaders/My.shader") |
Returns: { shaderName, subshaderCount, totalPasses }
shader_create_urpCreate a URP shader from template (type: Unlit or Lit).
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| shaderName | string | Yes | - | Shader name (e.g., "Custom/MyURPShader") |
| savePath | string | Yes | - | Save path (e.g., "Assets/Shaders/MyURP.shader") |
| type | string | No | "Unlit" | Template type: "Unlit" or "Lit" |
Returns: { success, shaderName, path, type }
shader_set_global_keywordEnable or disable a global shader keyword.
| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| keyword | string | Yes | - | Global shader keyword name |
| enabled | bool | Yes | - | true to enable, false to disable |
Returns: { success, keyword, enabled }
import unity_skills
# Create an unlit shader
unity_skills.call_skill("shader_create",
shaderName="Custom/MyUnlit",
savePath="Assets/Shaders/MyUnlit.shader",
template="Unlit"
)
# Create a surface shader
unity_skills.call_skill("shader_create",
shaderName="Custom/MyPBR",
savePath="Assets/Shaders/MyPBR.shader",
template="Standard"
)
# Read shader source
source = unity_skills.call_skill("shader_read",
shaderPath="Assets/Shaders/MyUnlit.shader"
)
print(source['content'])
# List all custom shaders
shaders = unity_skills.call_skill("shader_list", filter="Custom")
for shader in shaders['shaders']:
print(f"{shader['name']}: {shader['path']}")
Exact names, parameters, defaults, and returns are defined by GET /skills/schema or unity_skills.get_skill_schema(), not by this file.
development
Keyword research and validation with real search-demand data — never ship keywords from intuition alone. Probes Google Autocomplete per language (free, no account) to prove demand and discover the exact phrasing people type, checks SERPs for winnability, and uses Keyword Planner/Ahrefs/Semrush exports when the user has access. Activates when: choosing or reviewing SEO keywords, meta keywords, page titles, article topics or slugs, landing page copy targeting search, App Store/ASO keyword fields, multilingual keyword sets, 'what should we rank for', 'keyword analysis', or auditing why a page doesn't rank. Also invoke it as a validation pass whenever another skill or task produces a keyword list.
development
Automate YooAsset hot-update and asset bundles — build bundles, run Editor simulate builds, manage Collector groups, analyze BuildReport, and validate runtime. Use when building or simulating YooAsset bundles, configuring collectors, or validating hot-update assets, even if the user just says "热更" or "打AB包". 自动化 YooAsset 热更新与资源包(构建 bundle、编辑器模拟构建、管理 Collector 分组、分析 BuildReport、运行时校验);当用户要构建或模拟 YooAsset 资源包、配置 collector、或校验热更资源时使用。
development
Source-anchored design rules for YooAsset v2.3.18 — initialization, default-package shortcuts, play modes, asset handles, loading, updates, filesystem, build, and pitfalls. Use when writing or reviewing YooAsset code, initializing packages, loading assets via handles, setting up hot-update/download, or choosing a play mode, even if the user just says "热更" or "资源包". 为 YooAsset v2.3.18 提供源码锚定的设计规则(初始化、默认包快捷方式、运行模式、资源句柄、加载、更新、文件系统、构建、陷阱);当用户要编写或审查 YooAsset 代码、初始化 package、用句柄加载资源、配置热更/下载、或选择运行模式时使用。
data-ai
Last-resort guidance for safely hand-editing Unity serialized YAML (.unity/.prefab/.asset/.meta/ProjectSettings) — reference/fileID repair, GUID safety, and merge-conflict fixes. Use when REST cannot reach the change and YAML must be hand-edited — fixing m_Script GUIDs, broken fileID references, .meta files, or merge conflicts, even if the user just says "场景文件打不开" or "引用丢了". 安全手编 Unity 序列化 YAML(.unity/.prefab/.asset/.meta/ProjectSettings)的最后手段(引用/fileID 修复、GUID 安全、合并冲突修复);当 REST 无法触达、必须手编 YAML 时使用——修复 m_Script GUID、断裂 fileID 引用、.meta 文件或合并冲突。