unity-script
Skill7 starsChanged 7 months agoMITView on GitHub
Use when creating, reading, editing, searching, validating, or deleting C# scripts in a Unity project.
In this repository34 other files it gives its agents.
- unity-mcp-skillsSkill
- unity-animatorSkill
- unity-assetSkill
- unity-cameraSkill
- unity-cinemachineSkill
- unity-cleanerSkill
- unity-componentSkill
- unity-consoleSkill
- unity-editorSkill
- unity-eventSkill
- unity-gameobjectSkill
- unity-importerSkill
- unity-lightSkill
- unity-materialSkill
- unity-navmeshSkill
- unity-optimizationSkill
- unity-packageSkill
- unity-perceptionSkill
- unity-physicsSkill
- unity-prefabSkill
- unity-probuilderSkill
- unity-projectSkill
- unity-sceneSkill
- unity-scriptableobjectSkill
- unity-shaderSkill
- unity-smartSkill
- unity-terrainSkill
- unity-testSkill
- unity-timelineSkill
- unity-toolingSkill
- unity-uiSkill
- unity-uitoolkitSkill
- unity-validationSkill
- unity-xrSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 3 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
When creating a script, pass the scriptName without .cs.
- Distinctive: line 29
When renaming a class, rename the file in the same operation.
- Very specific: line 33
After any script create / edit / delete, Unity triggers a Domain Reload (compilation + assembly swap).
- Very specific: line 35
If the response reports isCompiling: true, wait for it to settle before the next script edit.
- Distinctive: line 44
Prefer explicit dependencies + small responsibilities + event-driven notifications over hidden globals.
- Very specific: line 45
Avoid Update-loop polling, repeated GameObject.Find calls, reflection in hot paths, avoidable allocations.
- Distinctive: line 46
Start from the minimum structure that solves the need — don't dump boilerplate.
- Very specific: line 47
After any edit, run Unity_ValidateScript and fix reported errors before marking a task done.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Script Management
Do not use Unity_RunCommand for script operations. The Unity MCP server exposes dedicated tools for every common script operation. Use them directly — they handle Domain Reload coordination and diagnostics natively.
Routing
| Operation | Tool | Typical use |
| Create a new C# script | Unity_CreateScript | Writes a new file under Assets/; sets up the MonoBehaviour/ScriptableObject/Editor template. |
| Delete a C# script | Unity_DeleteScript | By URI (unity://path/...) or by Assets/... path. |
| List script files | Unity_ListResources | Commonly filtered to *.cs under Assets/. |
| Search inside a script | Unity_FindInFile | Regex-level matches with line numbers. |
| Structured edits | Unity_ScriptApplyEdits | Method-level replace / insert / remove. Prefer this over raw text edits. |
| Syntax + diagnostics check | Unity_ValidateScript | Call before and after edits; surfaces compile errors before they trigger a Domain Reload. |
| Hash for concurrency | Unity_GetSha | Compare against your expected hash to detect conflicting edits before writing. |
Install-once Editor scripts (screenshot helpers, custom Editor windows, build steps, exporters): check
../tooling/SKILL.mdfor ready-to-paste templates before writing one from scratch.
Filename must match class name
The .cs filename (without extension) must exactly match the top-level class name. Unity's asset database relies on the 1:1 mapping — mismatches silently break MonoBehaviour attachment and asset references.
- When creating a script, pass the
scriptNamewithout.cs. - When renaming a class, rename the file in the same operation.
Domain Reload coordination
After any script create / edit / delete, Unity triggers a Domain Reload (compilation + assembly swap). Tools return a compilation block where applicable — check it before issuing the next operation.
- If the response reports
isCompiling: true, wait for it to settle before the next script edit. - Once compilation completes, call
Unity_ValidateScripton the affected file to surface any errors. - Group related edits in a single task where possible — fewer edits = fewer Domain Reloads.
Style guardrails
- Meaningful, domain-specific class names.
- Group scripts by feature under
Assets/Scripts/<Feature>/. - Decide the class role first:
MonoBehaviour,ScriptableObject, or plain C# helper. - Prefer explicit dependencies + small responsibilities + event-driven notifications over hidden globals.
- Avoid
Update-loop polling, repeatedGameObject.Findcalls, reflection in hot paths, avoidable allocations. - Start from the minimum structure that solves the need — don't dump boilerplate.
- After any edit, run
Unity_ValidateScriptand fix reported errors before marking a task done.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

