/monofsm:uprefabfrom MonoFSM Framework
Reads and modifies Unity serialized data (prefabs, scenes, ScriptableObjects). Supports finding components across assets, inspecting hierarchy/FSM, auditing overrides, editing structure, creating variants, managing ScriptableObject assets, resolving GUIDs, and tracing references.
Ships in MonoFSM Framework. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
讀 / 改 Unity serialized data 的工具組。先看決策表決定用哪一條路 —— 選錯會白跑一趟 或讀到不完整的資料。
範例裡的 up 是 PATH 上的真指令(~/.local/bin/up symlink 到
.claude/scripts/up,該 launcher 從 cwd 往上找 MonoFSM/Tools~/uprefab/uprefab.py),
直接打 up <subcommand> 就好。
不要退回 shell function 或 UP="python3 …" 變數:Claude Code 每個 Bash tool call
都是新 shell,function 定義不會留存到下一個 call;$VAR 形式在 zsh 不斷詞會被當成單一檔名。
真的噴 command not found: up 就是 symlink 掉了,重建:
ln -sf "$PWD/.claude/scripts/up" ~/.local/bin/up
| 你要做什麼 | 用什麼 | Unity | 細節 |
|---|---|---|---|
| 這個 component / 名稱在哪些檔案裡 | find | ❌ | offline-index.md |
找到之後要能直接下鑽(拿可餵給 --node 的完整路徑) | find --resolve | ✅ | offline-index.md |
貼了 asset guid / webhook 連結(?asset_guid=)要換成路徑 | guid | ❌ | offline-index.md |
| prefab override 稽核、索引範圍調整 | overrides / scope stats | ❌ | offline-index.md |
| prefab 階層、子樹 component 欄位細節、FSM 架構 | prefab read(hard --budget / --fsm-only / --structure-only) | ✅ | read.md |
| scene 上的階層 | scene ls(hard --budget,0 才不限) | ✅ | read.md |
貼了 物件連結(globalId=GlobalObjectId_V1-…;scene 或 prefab 裡的節點都算) | obj | prefab 裡的不用開 Stage,一次就出內容;Unity 沒開只回資產路徑 + fileID,不給節點路徑 | read.md |
| 改 prefab / scene 結構、開/複製/存 scene、建 variant | prefab do / scene do / scene copy / prefab variant | ✅ | edit.md |
C# 重構後把舊型別的序列化資料搬到新型別(peek 看不到的孤兒欄位) | prefab swap-script | ❌ | edit.md |
路徑失效、名字跟上次讀到的不一樣、節點名含 / 或換行 | —— | naming.md | |
| 建 / 改 ScriptableObject asset(registry / config 類) | asset create / set / set-ref / add-element | ✅ | asset.md |
| 讀 ScriptableObject 的欄位值(config 裡填了什麼、引用指到哪個 asset) | asset peek <x.asset> [--members] [--deep];不要 Read / grep .asset | ✅ | asset.md |
| 一個 asset 要改多個欄位(要原子性) | asset do <asset> -f ops.txt(任一行失敗就整批不套用) | ✅ | asset.md |
| 加 / 改互動文字提示(localized、按狀態切換) | prompt | ✅ | prompt.md |
| 只要 localization 條目(文案持有者是 SO 不是節點) | loc | ✅ | prompt.md |
| 某個節點被誰指到 / 它指向誰 | refs | ✅ | probe.md |
| 這支 prefab 被誰 nest / 當 variant base(不用 grep guid) | refs <prefab>(不帶 --node;開頭先印離線段:variant base / nested / scene 各列檔案) | ❌ 離線段 | probe.md |
| asset 層級被誰引用(fbx / otf / .asset / material,不是節點),要列到「哪個節點的 Component.欄位」 | asset-refs(全庫掃一次十幾秒;多顆一起傳 up asset-refs a b c 只掃一次) | ✅ | up asset-refs --help |
| build 太肥、某顆 asset 為什麼會進 build、怎麼斷開 | why-in-build(從 build scene / Resources / Preloaded / Addressables 找最短鏈,最後一跳列到欄位,並列出 build 內其他直接 referrer) | ✅ | up why-in-build --help |
| 組 FSM 時要挑 Action / Condition(有哪些可用、各自幹嘛、欄位填什麼) | catalog | ❌ | catalog.md |
| 某個型別叫什麼、有哪些欄位 | types / fields(Component)、asset fields(SO) | ✅ | probe.md |
| 場上有幾個某某物件、某個 component 現在的值 | scene count / peek | ✅ | probe.md |
| prefab 上某顆 component 的某幾個欄位(「這條 ref 接上了沒」) | prefab peek(不要用 read,貴 50 倍) | ✅ | probe.md |
| 模型多大、擺在哪、哪一頭朝哪(換 placeholder 要對齊舊的大小、判斷燈頭 / 槍口方向) | prefab bounds(renderer AABB + 沿長軸粗細分佈);不要自己解析 FBX,importer 軸向轉換離線證明不了 | ✅ | up prefab --help |
| AnimationClip 動到哪些節點 / 屬性 / 設成什麼值(有沒有動 root / Collider / Rigidbody / enabled / active;m_IsActive 設 0 還是 1;換皮 variant 之後曲線是不是整批落空) | anim <clip.anim> [--values] [--path KW] [--prefab <prefab>](離線;--values 加印 keyframe 時間→值,常數曲線印「全程 = v」;帶 --prefab 會對 Animator 底下合併後的節點,✗ 對不到 / ~ 落在 inactive / ? 節點上沒那顆 component);不要 grep .anim | ❌(--prefab ✅) | up anim --help |
材質的值(shader、開著的 keyword、_EmissionColor 這類 property 值、貼圖路徑;Material Variant 合併 parent 鏈,* 標本檔 override) | mat <path.mat> [--prop KW] [--local];up asset fields 對 .mat 會自動轉過來;不要 grep .mat。改成 Material Variant 走 mat set-parent <child.mat...> --parent <p.mat|none> [--create-from src.mat](Unity,合併後值不變、自動比對) | ❌(set-parent ✅) | up mat --help |
| AnimatorController 結構(parameters / layer / state 的 motion·speed·WriteDefaults / transition 條件·exitTime)或 overrideController 換了哪些 clip(base + 原 clip → override clip + 用在哪個 layer/state) | controller <path.controller | .overrideController> [--layer KW];不要 grep .controller | ❌ | up controller --help |
| 已知 prefab 內找合併後的 component / 節點路徑 | prefab locate --comp/--name | ✅ | probe.md |
| 同一 prefab 一次查多顆 component 欄位 | prefab peek-batch -f probes.txt | ✅ | probe.md |
| 命中/override 有幾千筆,想先知道集中在哪 | find --by-asset / overrides --by-target | ❌ | offline-index.md |
| Play Mode 下每 tick 有多少 MonoObj 在 simulate、哪種 entity 沒被 culling 擋(按 root entity 分組:註冊 / 在跑 / 被 cull / 距離) | sim-stats [-n N] [--sort run|upd|reg|cull|off] [--filter KW] | ✅ | up sim-stats --help |
| Play Mode 下改一個 Var 的值(自動測試撥旗標 / 給錢) | poke | ✅ | probe.md |
| Play Mode 下對 receiver 打一發 effect(不用玩家走過去互動) | hit | ✅ | probe.md |
| 「測 X 的互動」自動測試(物件端 FSM,不經過玩家) | play → hit → fsm-trace → peek → play stop | ✅ | probe.md「互動自動測試」 |
| EffectReceiver 沒觸發,要一次看完整條鏈卡在哪 | debug-effect-trace | ✅ | probe.md |
按 asset 上的 Odin [Button](無參數方法) | asset invoke | ✅ | asset.md |
按 prefab 裡某顆 component 上的 Odin [Button](edit-time 排版 / 重建工具) | prefab do 的 invoke|<node>|<comp>|<method> | ✅ | edit.md |
執行 Editor 選單項目(Tools/… 之類的 MenuItem;不要為了按選單臨時寫 execute-dynamic-code) | menu "<menu path>"(找不到會列出最接近的 path,exit 1) | ✅ | up menu --help |
| 想知道「調查為什麼慢」的實際數據 | usage | ❌ | offline-index.md |
| 翻舊 Claude Code session(上次那輪查到什麼、改了哪些檔) | session(列表)→ session <前綴>(只留對話)→ --files / --agent / --grep;不要 --resume、不要派 agent 讀全份 | ❌ | up session --help |
一句話版本:使用者貼連結走 guid(asset)/ obj(scene 物件),定位走 find(預設 full;
要 shallow 才 --scope all,要接著下鑽就加 --resolve),讀 prefab 結構走 prefab read
(hard budget,再用 --node 下鑽),讀 scene 結構走 scene ls,查引用走 refs,要改走 prefab do / scene do,建/改 ScriptableObject 走 asset,
加 localized 文字提示走 prompt,挑 Action / Condition 走 catalog。
開檔案之前就要做的判斷,只有五條(DSL 語法、失敗語意、Auto 綁定那些細節在對應的 reference 裡,真的要改的時候一定會讀到):
uloop execute-dynamic-code,
它每次回傳 15 行 JSON envelope(Logs / SecurityLevel / Diagnostics…),CLI 只回結果那一行。refs 只掃單一
prefab / scene,types 只查型別名;asset-refs 是 asset 對 asset 的依賴,不看 component 型別),所以「這個 component 在哪些檔案裡」只有 find
答得出來,而且快兩個數量級(find 0.1s vs Unity 一次來回含 domain reload 十幾秒)。
離線的就只有 index / scope / find / guid / overrides / catalog 這幾條(另外 anim / mat /
controller 離線直接讀單一 asset 的值 —— 這三種檔沒有 prefab 那種 stripped 繼承,Material Variant 由 mat 自己沿 parent 鏈合併)。find 印的節點
路徑都是局部的、不能直接餵給 --node(要完整路徑就 --resolve)。原因與實測數據見
internals.md。find 也不會自己更新索引 —— 改過 prefab
先 up index,(no match) 的第一個嫌疑就是索引過期。find 預設只查 full tier。 shallow 是 override target 解析層,第三方 Example 命中常比
gameplay 多兩個數量級;表尾若提示有 shallow 命中,真的需要時才加 --scope all。--budget 是 hierarchy + FSM hard cap,--depth 不能繞過。 --budget 0 才是
明確允許無上限(但仍受全域 --max-chars 攔截,要真的無上限得同時 --max-chars 0);
只看狀態機用 --fsm-only,只導航用 --structure-only。read 沒有磁碟快取(2026-09-11
拆掉:同參數幾乎不重複、且不省 token);read 結尾若印 # [hot] …,代表這支 prefab 近一週
被多段調查反覆讀但 skill 沒有入口 —— 讀完要把入口路徑與用到的子樹補進 alishan-code-map,
全表看 up usage hot。up catalog,不要 grep 或 Read .cs —— 近 400 個 Action /
Condition / Getter 的用途與欄位一次列完(離線、0.1s)。讀到 ⚠無說明 而你為了工作
實際去讀了那份原始碼,順手補一段 /// <summary> 再走,見 catalog.md。mark + $label,
跨批次 / 寫進計畫 md 時描述結構位置而不是抄名字。見 naming.md。| 檔案 | 內容 |
|---|---|
| offline-index.md | index / find(含 --resolve)/ guid / overrides / scope、.uprefab.json 設定、中文名稱 escape |
| read.md | prefab read / scene ls 參數與 --budget 分層下鑽、obj(GlobalObjectId 連結) |
| edit.md | 批次 DSL 全部操作、$ 代換、FSM 複合操作、[n] 後綴、失敗語意、auto 與 AutoChildren 陷阱、存檔 callback、variant / 模板、離線改 YAML 為何會丟值、variant 的 parent 只能重建 |
| naming.md | 自動命名:為什麼路徑會過期、三道防線、\/ 與 \n 逃逸 |
| asset.md | ScriptableObject asset 的 create / set / set-ref / add-element / fields |
| prompt.md | localized 文字提示:case 格式、優先序、自帶驗證輸出 |
| catalog.md | catalog:Action / Condition 目錄、--type 細查、--missing 待補清單、/// summary 撰寫規範 |
| probe.md | types / fields / peek / refs / scene count 與 Play Mode 驗證流程、互動自動測試流程與 trace 判讀表 |
| example-fsm.md | 完整實例:從零組「定時生資源」FSM 並在 Play Mode 驗證速率 |
| internals.md | 設計取捨(為何不用離線讀內容 / 為何拆掉 cache)、已知限制、反射與 SerializedProperty 地雷(getter native crash、string.isArray)、模組結構 —— 改 uprefab 本身前先讀 |
格式規則(node 行、component 區塊、值格式化、摺疊摘要)的真相來源是
monofsm:hierarchy-text-exporter skill,這裡不重複。
SKILL.md.meta (opens in a new tab)references.meta (opens in a new tab)references/asset.md (opens in a new tab)references/asset.md.meta (opens in a new tab)references/catalog.md (opens in a new tab)references/catalog.md.meta (opens in a new tab)references/edit.md (opens in a new tab)references/edit.md.meta (opens in a new tab)references/example-fsm.md (opens in a new tab)references/example-fsm.md.meta (opens in a new tab)references/internals.md (opens in a new tab)references/internals.md.meta (opens in a new tab)references/naming.md (opens in a new tab)references/naming.md.meta (opens in a new tab)references/offline-index.md (opens in a new tab)references/offline-index.md.meta (opens in a new tab)references/probe.md (opens in a new tab)references/probe.md.meta (opens in a new tab)references/prompt.md (opens in a new tab)references/prompt.md.meta (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
unity, prefab, scene, scriptable-object, serialized-data, game-development
npx claudepluginhub red-candle-games-co-ltd/monofsm --plugin monofsm6 skills in this plugin
/GizmosMonoGizmoUtility 除錯繪製工具的使用指南。當需要在 Scene/Game View 繪製除錯用的線、球、方塊、文字等 Gizmo 時使用此 skill。/hierarchy-text-exporterHierarchy → 精簡結構化文字匯出工具(HierarchyTextExporter)。當需要:(1) 讓 LLM 用最少 token 讀懂 Unity GameObject 階層與 Component serialized 欄位 (2) 匯出 prefab 或 scene 子樹成精簡文字(uloop execute-dynamic-code 呼叫或右鍵複製)(3) 理解/修改 HierarchyTextExporter 相關程式碼、摺疊摘要規則、值格式化規則時使用此 skill。/MonoFSMMonoFSM 有限狀態機框架的使用指南。當需要:(1) 了解 MonoFSM 架構與設計理念 (2) 在 Unity Scene 中新增/修改 State、Transition、Condition、Action (3) 撰寫新的 Action、Condition C# 腳本 (4) 使用 Auto 系列 Attribute 自動引用組件 (5) 理解狀態優先級系統 (6) 設定 VarFloat 計時器 (7) 使用 EffectDealer/EffectReceiver 互動系統 (8) 解析、匯出、或讀懂既有 FSM prefab/scene 物件的結構(用 FsmTextExporter 匯出 markdown 文字)時使用此 skill。/MonoObjLifecycleMonoObj 更新生命週期系統的使用指南。當需要:(1) 了解 WorldUpdateSimulator 的更新迴圈架構 (2) 實作 Simulate、Render 等每幀更新邏輯 (3) 新增 IUpdateSimulate、IBeforeSimulate、IAfterSimulate、IRenderUpdate 實作 (4) 理解 MonoObj 註冊/反註冊流程 (5) 理解 local FixedUpdate/LateUpdate 與 Fusion FixedUpdateNetwork/Render 時機 (6) 拆分 simulation/render culling (7) 一次性初始化該用 ISceneAwake / ISceneStart、或初始化沒被呼叫 / GetVar 拿到 null 的時序問題時使用此 skill。/prefab-text-exporterUnity Prefab 文字匯出工具的設計指南。當需要:(1) 理解或修改 PrefabToTextExporter 相關程式碼 (2) 擴充匯出格式或新增支援的類型 (3) 新增 Component 類型對應 (4) 調整篩選邏輯或輸出格式時使用此 skill。Other plugins' skills for the same job