Skip to content
Development
Skill

/script

Create, read and analyze C# scripts

From plugin
unity-skills
1.9k83 skills4 commands

Claude Code

$ npx -y skills add Besty0728/Unity-Skills --skill script --agent claude-code

SKILL.md

script.SKILL.md
name: unity-script
description: Create, read and analyze C# scripts

When to use

  • Authoring or editing C# code
  • Searching across scripts
  • Refactoring file layout
  • Checking compile errors

Unity Script Skills

Create, edit, move and inspect C# scripts and get their compile result. Parameters come from the schema (recommend `includeSchema=true` or `/skills/schema?names=`), which notes the non-obvious ones — never from a skill's name. Execution and dryRun rules: root [SKILL.md](../../SKILL.md).

Rules

  • All seven writers (`script_create`, `script_create_batch`, `script_replace`, `script_append`, `script_rename`, `script_move`, `script_delete`) trigger a domain reload and are high-risk, so Approval and Auto refuse them with `MODE_FORBIDDEN`. Do not request a grant for them.

Compile and reload

  • Every write returns at once: `{success, status: "accepted", path, jobId, waitUrl, serverAvailability}`; compilation follows, and the server is briefly unreachable during the domain reload.
  • One call gets the compile result: GET the returned `waitUrl` (`/jobs/<jobId>?wait=90&expectInstance=<instanceId>`, already pinned to this Editor), adding `expectProject`, e.g. `curl -s --retry 20 --retry-connrefused --retry-all-errors --retry-delay 2 "http://localhost:<port><waitUrl>&expectProject=<project>"`. It answers once compilation settles: job `status` `completed`, or `failed` on compile errors, with diagnostics in `resultData.compilation` (`isCompiling`, `hasErrors`, `errorCount`, `errors: [{type, message, file, line}]`). During the reload it may refuse or return `503`: repeat the same URL; `waitTimedOut: true` means GET it again.
  • `script_get_compile_feedback(scriptPath)` returns the same diagnostics on demand. Fix errors first: `component_add` finds a new MonoBehaviour only after a clean compile.
  • `checkCompile: false` skips the diagnostics; `diagnosticLimit` caps them (default 20).

Shared rules

  • `scriptName` is the file and class name, without `.cs` or path separators. Paths (`folder`, `scriptPath`, `newFolder`) are project-relative, starting with `Assets/` or `Packages/`; a missing folder is created. An existing file is never overwritten (`Script already exists`).
  • `script_create` writes `content` verbatim when given (then `template` / `namespaceName` are ignored, with a warning); otherwise it fills a template — `MonoBehaviour` (default), `ScriptableObject`, `Editor`, `EditorWindow` (the last two default to `Assets/Editor`) — wrapped in `namespaceName` if set. Any other bare name is rejected (`validValues` lists these four); text containing code stays a literal template with `{CLASS}`/`{NAMESPACE}` filled, but use `content` for custom classes. A MonoBehaviour or ScriptableObject binds to its file only when the class name equals the file name; content declaring no such type gets a warning.
  • 2+ new scripts → `script_create_batch`: one domain reload instead of N.

Skills Overview

  • Write: `script_create`, `script_create_batch`, `script_replace` (find/replace, plain or regex), `script_append` (insert lines), `script_rename` (file only; the class inside is not renamed), `script_move` (creates the destination folder), `script_delete`.
  • Read: `script_read`, `script_list`, `script_find_in_file` (plain or regex, per line), `script_get_info` (class, base class, public members), `script_get_compile_feedback`.

Per-skill tables and return shapes: `reference/<skill_name>.md` — rarely needed, the schema notes the parameters.

Pitfalls

  • `script_edit` and `script_update` do not exist. Use `script_replace` for find and replace.
  • `script_write` does not exist. Use `script_create` for a new file, or `script_replace` to modify one.
  • API analysis of a compiled script is `script_analyze` in the perception module.

Errors

| Error | Trigger → fix | |---|---| | `MISSING_PARAM` | e.g. `scriptName`, `pattern`, `find`, `newName` → supply it; the error (or a dryRun) lists all parameters. | | `SEMANTIC_INVALID` | Path separators in `scriptName` / `newName`, a path outside `Assets/` / `Packages/`, or the script already exists → fix the name or path, or rename/move the existing file. | | `TARGET_NOT_FOUND` | Script, MonoScript or folder missing → find the right `scriptPath` with `script_list` / `asset_find`. | | `SKILL_ERROR` | A filesystem or AssetDatabase move/rename/delete failed → read the message, resolve it, retry. |

Transport codes (`COMPILING`, `RATE_LIMIT`, ...) → [error codes](../../references/protocol-error-codes.md).

Read more
@besty0728
Ships withunity-skills

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+.

Stars on GitHub

Momentum

stars in total
1.9k
Star history of Besty0728/Unity-Skills on GitHub, a chart by star-history.com

Other skills on unity-skills.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills10d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react1d252k
@facebook@facebookInstall Skill

Questions about script.

Which coding agents can use script?
script installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.