Agent SkillsBesty0728/Unity-Skills › unity-shader

unity-shader

GitHub

管理Unity HLSL/ShaderLab着色器文件,支持创建、读取、列出、查找、删除及检查属性关键字。专用于手写着色器操作,与ShaderGraph模块区分。

SkillsForUnity/unity-skills~/skills/shader/SKILL.md Besty0728/Unity-Skills

Trigger Scenarios

用户请求创建或编辑手写shader 需要列出或查找.unity shader文件 检查shader文件的属性定义、关键字或编译错误

Install

npx skills add Besty0728/Unity-Skills --skill unity-shader -g -y
More Options

Non-standard path

npx skills add https://github.com/Besty0728/Unity-Skills/tree/main/SkillsForUnity/unity-skills~/skills/shader -g -y

Use without installing

npx skills use Besty0728/Unity-Skills@unity-shader

指定 Agent (Claude Code)

npx skills add Besty0728/Unity-Skills --skill unity-shader -a claude-code -g -y

安装 repo 全部 skill

npx skills add Besty0728/Unity-Skills --all -g -y

预览 repo 内 skill

npx skills add Besty0728/Unity-Skills --list

SKILL.md

Frontmatter
{
    "name": "unity-shader",
    "description": "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 文件、或检查其属性与关键字时使用。"
}

Unity Shader Skills

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.

Operating Mode

  • Query skills (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.
  • Mutating skills (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.

Guardrails

DO NOT (common hallucinations):

  • shader_set_property does not exist → use material_set_float/material_set_color/etc. on the material, not the shader
  • shader_apply / shader_assign do not exist → use material_set_shader to change a material's shader
  • shader_get_properties returns shader property definitions (name/type/range), not current values → for material instance values use material_get_properties
  • Shader names are case-sensitive and path-like: "Standard", "Universal Render Pipeline/Lit", not "standard" or "URP Lit"

Routing:

  • For material property changes → use material module
  • For shader keyword control → material_set_keyword (material module)
  • For global shader keywords → shader_set_global_keyword (this module)

Skills Overview

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

Skills

shader_create

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.

shader_read

Read shader source code.

Parameter Type Required Description
shaderPath string Yes Shader asset path

Returns: {path, lines, content}

shader_list

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}]}

shader_find

Find a shader by name.

Parameter Type Required Description
searchName string Yes Shader name to find

Returns: {found, name, path}

shader_delete

Delete a shader file.

Parameter Type Required Description
shaderPath string Yes Shader asset path

shader_get_properties

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_errors

Check 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_keywords

Get 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_count

Get 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_urp

Create 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_keyword

Enable 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 }


Example Usage

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']}")

Best Practices

  1. Use consistent shader naming (Category/Name)
  2. Organize shaders in dedicated folder
  3. Start with templates, modify as needed
  4. Test shaders in different lighting conditions
  5. Consider mobile compatibility for builds

Exact Signatures

Exact names, parameters, defaults, and returns are defined by GET /skills/schema or unity_skills.get_skill_schema(), not by this file.

Version History

  • ec9f870 Current 2026-07-05 14:41

Same Skill Collection

SkillsForUnity/unity-skills~/skills/adr/SKILL.md
SkillsForUnity/unity-skills~/skills/animator/SKILL.md
SkillsForUnity/unity-skills~/skills/architecture/SKILL.md
SkillsForUnity/unity-skills~/skills/asmdef/SKILL.md
SkillsForUnity/unity-skills~/skills/asset/SKILL.md
SkillsForUnity/unity-skills~/skills/async/SKILL.md
SkillsForUnity/unity-skills~/skills/batch/SKILL.md
SkillsForUnity/unity-skills~/skills/blueprints/SKILL.md
SkillsForUnity/unity-skills~/skills/bookmark/SKILL.md
SkillsForUnity/unity-skills~/skills/camera/SKILL.md
SkillsForUnity/unity-skills~/skills/cinemachine/SKILL.md
SkillsForUnity/unity-skills~/skills/cleaner/SKILL.md
SkillsForUnity/unity-skills~/skills/component/SKILL.md
SkillsForUnity/unity-skills~/skills/console/SKILL.md
SkillsForUnity/unity-skills~/skills/debug/SKILL.md
SkillsForUnity/unity-skills~/skills/decal/SKILL.md
SkillsForUnity/unity-skills~/skills/dotween/SKILL.md
SkillsForUnity/unity-skills~/skills/editor/SKILL.md
SkillsForUnity/unity-skills~/skills/event/SKILL.md
SkillsForUnity/unity-skills~/skills/gameobject/SKILL.md
SkillsForUnity/unity-skills~/skills/graphics/SKILL.md
SkillsForUnity/unity-skills~/skills/history/SKILL.md
SkillsForUnity/unity-skills~/skills/importer/SKILL.md
SkillsForUnity/unity-skills~/skills/inspector/SKILL.md
SkillsForUnity/unity-skills~/skills/light/SKILL.md
SkillsForUnity/unity-skills~/skills/material/SKILL.md
SkillsForUnity/unity-skills~/skills/navmesh/SKILL.md
SkillsForUnity/unity-skills~/skills/netcode-design/SKILL.md
SkillsForUnity/unity-skills~/skills/netcode/SKILL.md
SkillsForUnity/unity-skills~/skills/optimization/SKILL.md
SkillsForUnity/unity-skills~/skills/package/SKILL.md
SkillsForUnity/unity-skills~/skills/patterns/SKILL.md
SkillsForUnity/unity-skills~/skills/perception/SKILL.md
SkillsForUnity/unity-skills~/skills/performance/SKILL.md
SkillsForUnity/unity-skills~/skills/physics/SKILL.md
SkillsForUnity/unity-skills~/skills/postprocess/SKILL.md
SkillsForUnity/unity-skills~/skills/prefab/SKILL.md
SkillsForUnity/unity-skills~/skills/probuilder/SKILL.md
SkillsForUnity/unity-skills~/skills/profiler/SKILL.md
SkillsForUnity/unity-skills~/skills/project-scout/SKILL.md
SkillsForUnity/unity-skills~/skills/project/SKILL.md
SkillsForUnity/unity-skills~/skills/sample/SKILL.md
SkillsForUnity/unity-skills~/skills/scene-contracts/SKILL.md
SkillsForUnity/unity-skills~/skills/scene/SKILL.md
SkillsForUnity/unity-skills~/skills/script-roles/SKILL.md
SkillsForUnity/unity-skills~/skills/script/SKILL.md
SkillsForUnity/unity-skills~/skills/scriptableobject/SKILL.md
SkillsForUnity/unity-skills~/skills/scriptdesign/SKILL.md
SkillsForUnity/unity-skills~/skills/shadergraph/SKILL.md
SkillsForUnity/unity-skills~/skills/SKILL.md
SkillsForUnity/unity-skills~/skills/smart/SKILL.md
SkillsForUnity/unity-skills~/skills/terrain/SKILL.md
SkillsForUnity/unity-skills~/skills/test/SKILL.md
SkillsForUnity/unity-skills~/skills/testability/SKILL.md
SkillsForUnity/unity-skills~/skills/timeline/SKILL.md
SkillsForUnity/unity-skills~/skills/ui/SKILL.md
SkillsForUnity/unity-skills~/skills/uitoolkit/SKILL.md
SkillsForUnity/unity-skills~/skills/urp/SKILL.md
SkillsForUnity/unity-skills~/skills/validation/SKILL.md
SkillsForUnity/unity-skills~/skills/volume/SKILL.md
SkillsForUnity/unity-skills~/skills/workflow/SKILL.md
SkillsForUnity/unity-skills~/skills/xr/SKILL.md
SkillsForUnity/unity-skills~/skills/yooasset-design/SKILL.md
SkillsForUnity/unity-skills~/skills/yooasset/SKILL.md
SkillsForUnity/unity-skills~/SKILL.md
SkillsForUnity/unity-skills~/skills/addressables-design/SKILL.md
SkillsForUnity/unity-skills~/skills/dotween-design/SKILL.md
SkillsForUnity/unity-skills~/skills/shadergraph-design/SKILL.md
SkillsForUnity/unity-skills~/skills/unitask-design/SKILL.md
SkillsForUnity/unity-skills~/skills/yaml-editing/SKILL.md

Metadata

Files
0
Version
ec9f870
Hash
b053b4a7
Indexed
2026-07-05 14:41

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-08 23:26
浙ICP备14020137号-1 $bản đồ khách truy cập$