unity-script
GitHub提供Unity C#脚本的创建、编辑、搜索、重构及编译检查功能。支持批量操作与模板生成,详细说明了读写模式、编译反馈机制及高危写操作的拦截规则,旨在规范C#代码管理流程。
Trigger Scenarios
Install
npx skills add Besty0728/Unity-Skills --skill unity-script -g -y
SKILL.md
Frontmatter
{
"name": "unity-script",
"description": "Create, read and analyze C# scripts"
}
Triggers
- Authoring or editing C# code
- Searching across scripts
- Refactoring file layout
- Checking compile errors
- 编写或编辑 C# 代码、跨脚本搜索、重构文件布局、检查编译错误
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.
Operating Mode
Read-only SemiAuto skills run directly in every mode: script_read, script_list, script_find_in_file, script_get_info, script_get_compile_feedback. All 7 writers — script_create, script_create_batch, script_replace, script_append, script_rename, script_move, script_delete — are MayTriggerReload + RiskLevel:"high" (a written .cs reloads the domain; script_delete is also Delete), so they are NeverInSemi: Approval and Auto return MODE_FORBIDDEN, and only Bypass or an Allowlist hit runs them. Never request a grant for them → operating mode.
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), e.g.curl -s --retry 20 --retry-connrefused --retry-all-errors --retry-delay 2 "http://localhost:<port>/jobs/<jobId>?wait=90". It answers once compilation settles: jobstatuscompleted, orfailedon compile errors, with diagnostics inresultData.compilation(isCompiling,hasErrors,errorCount,errors: [{type, message, file, line}]). During the reload it may refuse or return503: repeat the same URL;waitTimedOut: truemeans GET it again. script_get_compile_feedback(scriptPath)returns the same diagnostics on demand. Fix errors first:component_addfinds a new MonoBehaviour only after a clean compile.checkCompile: falseskips the diagnostics;diagnosticLimitcaps them (default 20).
Shared rules
scriptNameis the file and class name, without.csor path separators. Paths (folder,scriptPath,newFolder) are project-relative, starting withAssets/orPackages/; a missing folder is created. An existing file is never overwritten (Script already exists).script_createwritescontentverbatim when given (thentemplate/namespaceNameare ignored, with a warning); otherwise it fills a template —MonoBehaviour(default),ScriptableObject,Editor,EditorWindow(the last two default toAssets/Editor) — wrapped innamespaceNameif set. Any other bare name is rejected (validValueslists these four); text containing code stays a literal template with{CLASS}/{NAMESPACE}filled, but usecontentfor 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.
DO NOT (common hallucinations):
script_edit/script_updatedo not exist → usescript_replacefor find-and-replacescript_writedoes not exist → usescript_create(new file) orscript_replace(modify existing)
Elsewhere: API analysis of a compiled script → script_analyze (perception).
Exact Signatures
Names, parameters, defaults and required flags come from GET /skills/schema?category=Script (or ?names=a,b), not this file.
Common 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.
Version History
-
67cd2ca
Current 2026-10-18 21:41
新增Operating Mode章节,明确只读技能SemiAuto直接执行,7个写型技能因涉及Reload/Delete被标记为高风险并禁止自动执行;补充了编译等待URL调用细节及参数规范说明。
-
8c31c5a
2026-08-27 12:45
修复模块文档审计问题,更新Addressables相关技能说明,修正模板及幽灵引用,优化自动拦截流程描述。
-
5ee8388
2026-08-17 04:12
精简根SKILL.md体积,新增协议文档与手动模式指南,补充模块说明与常见错误提示。
-
25d511e
2026-08-13 09:15
压缩75个SKILL.md描述至约5191字符,并将路由说明移至Triggers章节。
-
e49379b
2026-07-31 06:55
版本升级至2.4.0
- ec9f870 2026-07-05 14:41


