home / skills / besty0728 / unity-skills / shader

shader skill

/unity-skills/skills/shader

This skill helps you create, read, and list Unity shaders within the editor, simplifying shader management and integration into your projects.

npx playbooks add skill besty0728/unity-skills --skill shader

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.4 KB
---
name: unity-shader
description: "Create and manage shaders in Unity Editor."
---

# Unity Shader Skills

Work with shaders - create shader files, read source code, and list available shaders.

## Skills Overview

| Skill | Description |
|-------|-------------|
| `shader_create` | Create shader file |
| `shader_read` | Read shader source |
| `shader_list` | List all shaders |

---

## Skills

### shader_create
Create a shader file from template.

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `shaderName` | string | Yes | - | Shader name (e.g., "Custom/MyShader") |
| `savePath` | string | Yes | - | Save path |
| `template` | string | No | "Unlit" | Template type |

**Templates**:
| Template | Description |
|----------|-------------|
| `Unlit` | Basic unlit shader |
| `Standard` | PBR surface shader |
| `Transparent` | Alpha blended |

### shader_read
Read shader source code.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `shaderPath` | string | Yes | Shader asset path |

**Returns**: `{success, path, 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**: `{success, count, shaders: [{name, path}]}`

---

## Example Usage

```python
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

Overview

This skill helps you create, read, and list shader files inside the Unity Editor from automated workflows. It provides quick template-based shader creation, reliable source reading, and project-wide shader discovery. Use it to standardize shader assets and speed up iterative shader development.

How this skill works

The skill exposes three operations: create a shader file from a chosen template, read the raw shader source from a given asset path, and list shader assets across the project with optional name filtering and result limits. Creation writes a new .shader file at the specified save path using Unlit, Standard (PBR), or Transparent templates. Listing scans project assets and returns names and paths; reading returns the file content for inspection or automated edits.

When to use it

  • When you need to quickly scaffold a new shader using a common template.
  • When automating asset pipelines that must inspect or modify shader source files.
  • When auditing or documenting existing shaders in a project.
  • When building tools that collect shader usage or prepare assets for build targets.
  • When you want to enforce naming and folder organization across shader assets.

Best practices

  • Use Category/Name naming (for example, Custom/MyShader) to keep shaders discoverable.
  • Place shaders in a dedicated Assets/Shaders folder to simplify listing and maintenance.
  • Start from provided templates (Unlit, Standard, Transparent) and iterate rather than writing from scratch.
  • Test created or modified shaders under multiple lighting conditions and platforms.
  • Keep mobile compatibility in mind: favor simpler lighting models and smaller shader variants for builds.

Example use cases

  • Create an Unlit shader template at Assets/Shaders/MyUnlit.shader during automated project setup.
  • Generate a PBR surface shader (Standard) for a new material pipeline and commit it to source control.
  • Read shader source to perform automated refactors, insert custom includes, or validate keywords.
  • List all project shaders matching a prefix (e.g., Custom) to produce an asset inventory or report.
  • Build tools that replace or patch shader code before runtime packaging for different platforms.

FAQ

What templates are available and when should I use each?

Available templates are Unlit (simple non-lit shaders), Standard (PBR surface shaders suitable for realistic materials), and Transparent (alpha blended materials). Use Unlit for UI or flat shading, Standard for physically based materials, and Transparent for alpha-blended effects.

What does the shader_list filter and limit do?

The filter performs a name-based match to narrow results (for example a category prefix). The limit caps the number of returned results to avoid large scans; increase it only when you expect many matches.