/script
Create, read and analyze C# scripts. 创建、读取与分析 C# 脚本。
$ npx -y skills add Besty0728/Unity-Skills --skill script --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/script
Context preview
The summary Claude sees to decide when to auto-load this skill.
Create, read and analyze C# scripts. 创建、读取与分析 C# 脚本。
SKILL.md
script.SKILL.mdname: unity-script
description: Create, read and analyze C# scripts. 创建、读取与分析 C# 脚本。
Triggers
- Authoring or editing C# code
- Searching across scripts
- Refactoring file layout
- Checking compile errors
- 编写或编辑 C# 代码、跨脚本搜索、重构文件布局、检查编译错误
Unity Script Skills
> **BATCH-FIRST**: Use `script_create_batch` when creating 2+ scripts. > **DESIGN-FIRST**: Before creating gameplay scripts, actively consider coupling, performance, and maintainability. In an existing project, load `../project-scout/SKILL.md` first. If the user is asking for architecture or refactoring advice, load `../architecture/SKILL.md` and then `../patterns/SKILL.md`, `../async/SKILL.md`, `../inspector/SKILL.md`, `../performance/SKILL.md`, `../script-roles/SKILL.md`, `../scene-contracts/SKILL.md`, `../testability/SKILL.md`, or `../scriptdesign/SKILL.md` as needed.
Operating Mode
- **Approval**: 只读类 skill(`script_read` / `script_list` / `script_find_in_file` / `script_get_info` / `script_get_compile_feedback`,标 `SkillMode.SemiAuto`)直接执行;写型 skill(`script_create` / `script_create_batch` / `script_replace` / `script_append` / `script_rename` / `script_move` / `script_delete`,默认 `SkillMode.FullAuto`)需用户 grant,grant 后服务端一步执行返结果。
- **Auto / Bypass**: 直接执行。
- **本模块含 Delete / Reload 类高危 skill**:`script_create` / `script_create_batch` / `script_replace` / `script_append` / `script_delete` 会触发 Domain Reload(且多标 `RiskLevel=high`),`script_delete` 同时是 Delete 操作 —— 这些 skill 在 Approval / Auto 下被 `IsForbiddenInSemi` 自动拦截,**仅 Bypass 或 Allowlist 命中可执行**。
**DO NOT** (common hallucinations):
- `script_edit` / `script_update` do not exist → use `script_replace` for find-and-replace
- `script_write` does not exist → use `script_create` (new file) or `script_replace` (modify existing)
- `scriptName` parameter must NOT include `.cs` extension
- Templates only accept: MonoBehaviour, ScriptableObject, Editor, EditorWindow
**Routing**:
- To modify existing script content → `script_replace` (find/replace) or `script_append` (add lines)
- To read script → `script_read`
- To check compile errors → `script_get_compile_feedback`
- To analyze script API → use `perception` module's `script_analyze`
Skills Overview
| Single Object | Batch Version | Use Batch When | |---------------|---------------|----------------| | `script_create` | `script_create_batch` | Creating 2+ scripts |
**No batch needed**:
- `script_read` - Read script content
- `script_delete` - Delete script
- `script_find_in_file` - Search in scripts
- `script_append` - Append content to script
- `script_get_compile_feedback` - Check compile errors for one script after Unity finishes compiling
- `create_script()` in `scripts/unity_skills.py` now waits for Unity to come back once and refreshes compile feedback automatically after script creation.
---
Skills
script_create
Create a C# script from template.
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `scriptName` | string | Yes | - | Script class name | | `folder` | string | No | "Assets/Scripts" | Save folder | | `template` | string | No | "MonoBehaviour" | Template type | | `namespaceName` | string | No | null | Optional namespace | | `checkCompile` | bool | No | true | Check compilation after create | | `diagnosticLimit` | int | No | 20 | Max compile diagnostics |
**Templates**: MonoBehaviour, ScriptableObject, Editor, EditorWindow
**Returns**: `{success, status, path, jobId, className, namespaceName, designReminder, serverAvailability?}`
Poll the returned `jobId` (or call `script_get_compile_feedback`) to obtain compile diagnostics — they are not embedded in the synchronous response. `serverAvailability` carries the transient-unavailable hint when Unity is about to reload the script domain.
script_create_batch
Create multiple scripts in one call.
**Returns**: `{success, totalItems, successCount, failCount, results: [{success, path, className}], compilation?}`
Before batch creation, decide whether each script should be:
- a thin `MonoBehaviour` bridge
- a `ScriptableObject` configuration asset
- or a plain C# domain/service class generated from a custom template
unity_skills.call_skill("script_create_batch", items=[
{"scriptName": "PlayerController", "folder": "Assets/Scripts/Player", "template": "MonoBehaviour"},
{"scriptName": "EnemyAI", "folder": "Assets/Scripts/Enemy", "template": "MonoBehaviour"},
{"scriptName": "GameSettings", "folder": "Assets/Scripts/Data", "template": "ScriptableObject"}
])script_read
Read script content.
| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `scriptPath` | string | Yes | Script asset path |
**Returns**: `{path, lines, content}`
script_delete
Delete a script.
| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `scriptPath` | string | Yes | Script to delete |
**Returns**: `{success, status, deleted, jobId, serverAvailability?}`
script_find_in_file
Search for patterns in scripts.
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `pattern` | string | Yes | - | Search pattern | | `folder` | string | No | "Assets" | Search folder | | `isRegex` | bool | No | false | Use regex | | `limit` | int | No | 50 | Max results |
**Returns**: `{pattern, matchCount, matches: [{file, line, content}]}`
script_append
Append content to a script.
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `scriptPath` | string | Yes | - | Script path | | `content` | string | Yes | - | Content to append | | `atLine` | int | No | end | Line number to insert at | | `checkCompile` | bool | No | true | Check compilation after append | | `diagnosticLimit` | int | No | 20 | Max compile diagnostics |
script_get_compile_feedback
Get compile diagnostics related to one
Read more
name: unity-script description: Create, read and analyze C# scripts. 创建、读取与分析 C# 脚本。
Triggers
- Authoring or editing C# code
- Searching across scripts
- Refactoring file layout
- Checking compile errors
- 编写或编辑 C# 代码、跨脚本搜索、重构文件布局、检查编译错误
Unity Script Skills
> **BATCH-FIRST**: Use `script_create_batch` when creating 2+ scripts. > **DESIGN-FIRST**: Before creating gameplay scripts, actively consider coupling, performance, and maintainability. In an existing project, load `../project-scout/SKILL.md` first. If the user is asking for architecture or refactoring advice, load `../architecture/SKILL.md` and then `../patterns/SKILL.md`, `../async/SKILL.md`, `../inspector/SKILL.md`, `../performance/SKILL.md`, `../script-roles/SKILL.md`, `../scene-contracts/SKILL.md`, `../testability/SKILL.md`, or `../scriptdesign/SKILL.md` as needed.
Operating Mode
- **Approval**: 只读类 skill(`script_read` / `script_list` / `script_find_in_file` / `script_get_info` / `script_get_compile_feedback`,标 `SkillMode.SemiAuto`)直接执行;写型 skill(`script_create` / `script_create_batch` / `script_replace` / `script_append` / `script_rename` / `script_move` / `script_delete`,默认 `SkillMode.FullAuto`)需用户 grant,grant 后服务端一步执行返结果。
- **Auto / Bypass**: 直接执行。
- **本模块含 Delete / Reload 类高危 skill**:`script_create` / `script_create_batch` / `script_replace` / `script_append` / `script_delete` 会触发 Domain Reload(且多标 `RiskLevel=high`),`script_delete` 同时是 Delete 操作 —— 这些 skill 在 Approval / Auto 下被 `IsForbiddenInSemi` 自动拦截,**仅 Bypass 或 Allowlist 命中可执行**。
**DO NOT** (common hallucinations):
- `script_edit` / `script_update` do not exist → use `script_replace` for find-and-replace
- `script_write` does not exist → use `script_create` (new file) or `script_replace` (modify existing)
- `scriptName` parameter must NOT include `.cs` extension
- Templates only accept: MonoBehaviour, ScriptableObject, Editor, EditorWindow
**Routing**:
- To modify existing script content → `script_replace` (find/replace) or `script_append` (add lines)
- To read script → `script_read`
- To check compile errors → `script_get_compile_feedback`
- To analyze script API → use `perception` module's `script_analyze`
Skills Overview
| Single Object | Batch Version | Use Batch When | |---------------|---------------|----------------| | `script_create` | `script_create_batch` | Creating 2+ scripts |
**No batch needed**:
- `script_read` - Read script content
- `script_delete` - Delete script
- `script_find_in_file` - Search in scripts
- `script_append` - Append content to script
- `script_get_compile_feedback` - Check compile errors for one script after Unity finishes compiling
- `create_script()` in `scripts/unity_skills.py` now waits for Unity to come back once and refreshes compile feedback automatically after script creation.
---
Skills
script_create
Create a C# script from template.
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `scriptName` | string | Yes | - | Script class name | | `folder` | string | No | "Assets/Scripts" | Save folder | | `template` | string | No | "MonoBehaviour" | Template type | | `namespaceName` | string | No | null | Optional namespace | | `checkCompile` | bool | No | true | Check compilation after create | | `diagnosticLimit` | int | No | 20 | Max compile diagnostics |
**Templates**: MonoBehaviour, ScriptableObject, Editor, EditorWindow
**Returns**: `{success, status, path, jobId, className, namespaceName, designReminder, serverAvailability?}`
Poll the returned `jobId` (or call `script_get_compile_feedback`) to obtain compile diagnostics — they are not embedded in the synchronous response. `serverAvailability` carries the transient-unavailable hint when Unity is about to reload the script domain.
script_create_batch
Create multiple scripts in one call.
**Returns**: `{success, totalItems, successCount, failCount, results: [{success, path, className}], compilation?}`
Before batch creation, decide whether each script should be:
- a thin `MonoBehaviour` bridge
- a `ScriptableObject` configuration asset
- or a plain C# domain/service class generated from a custom template
unity_skills.call_skill("script_create_batch", items=[
{"scriptName": "PlayerController", "folder": "Assets/Scripts/Player", "template": "MonoBehaviour"},
{"scriptName": "EnemyAI", "folder": "Assets/Scripts/Enemy", "template": "MonoBehaviour"},
{"scriptName": "GameSettings", "folder": "Assets/Scripts/Data", "template": "ScriptableObject"}
])script_read
Read script content.
| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `scriptPath` | string | Yes | Script asset path |
**Returns**: `{path, lines, content}`
script_delete
Delete a script.
| Parameter | Type | Required | Description | |-----------|------|----------|-------------| | `scriptPath` | string | Yes | Script to delete |
**Returns**: `{success, status, deleted, jobId, serverAvailability?}`
script_find_in_file
Search for patterns in scripts.
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `pattern` | string | Yes | - | Search pattern | | `folder` | string | No | "Assets" | Search folder | | `isRegex` | bool | No | false | Use regex | | `limit` | int | No | 50 | Max results |
**Returns**: `{pattern, matchCount, matches: [{file, line, content}]}`
script_append
Append content to a script.
| Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `scriptPath` | string | Yes | - | Script path | | `content` | string | Yes | - | Content to append | | `atLine` | int | No | end | Line number to insert at | | `checkCompile` | bool | No | true | Check compilation after append | | `diagnosticLimit` | int | No | 20 | Max compile diagnostics |
script_get_compile_feedback
Get compile diagnostics related to one
REST API-based AI-driven Unity Editor Automation Engine Let AI control Unity scenes directly through Skills 🎉 We are now indexed by DeepWiki! Got questions? Check out the AI-generated docs → The current official maintenance baseline is Unity 2022.3+.
Other skills on unity-skills.
- /addressables-design
Source-anchored design rules for Unity Addressables 1.22.3/2.9.1. 为 Unity Addressables 1.22.3/2.9.1 提供源码锚定的设计规则。
Open skill - /adr
Record Unity architecture decisions (ADR) with rationale. 记录 Unity 架构决策(ADR)与理由。
Open skill - /animator
Edit Unity Animator Controllers and drive runtime parameters. 编辑 Unity Animator Controller 并驱动运行时参数。
Open skill - /architecture
Advise on Unity gameplay and system architecture. 为 Unity 游戏与系统架构提供建议。
Open skill - /asmdef
Advise on Unity assembly definitions (asmdef). 为 Unity 程序集定义(asmdef)提供建议。
Open skill - /asset
Manage Unity AssetDatabase operations. 管理 Unity AssetDatabase 操作。
Open skill

