/monofsm:prefab-text-exporterfrom MonoFSM Framework
Guides extending and modifying the PrefabToTextExporter tool, which converts Unity Prefabs to Godot-style text format for LLM readability. Use when adding export formats, component type mappings, or filter logic.
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 Prefab 轉換為 Godot .tscn 風格的純文字格式,方便 LLM 閱讀理解場景結構。
MonoFSM/1_MonoFSM_Core/Editor/PrefabExporter/
├── UnityTypeFormatter.cs # 類型格式化(Vector, Color, Object Reference 等)
├── PrefabExportSettings.cs # 設定資料結構 + EditorPrefs 持久化
├── PrefabToTextExporter.cs # 核心轉換邏輯(遍歷 GameObject、比較預設值)
├── PrefabToTextContextMenu.cs # 右鍵選單(Assets/MonoFSM/複製 Prefab 為文字)
└── PrefabToTextWindow.cs # OdinEditorWindow 進階視窗
[gd_scene format=3 uid="unity_prefab"]
[node name="Player" type="RigidBody3D"]
position = Vector3(0, 1, 0)
# Component: Rigidbody
mass = 10
[node name="Arm" type="MeshInstance3D" parent="."]
position = Vector3(0.5, 0, 0)
# Component: MeshRenderer
material = ExtResource("Assets/Materials/Mat.mat")
[node name="Hand" type="Node3D" parent="Arm"]
scale = Vector3(0.5, 0.5, 0.5)
| Unity 類型 | 輸出格式 |
|---|---|
| Vector3 | Vector3(x, y, z) |
| Quaternion | Vector3(euler.x, euler.y, euler.z) |
| Color | Color(r, g, b, a) |
| Asset Reference | ExtResource("Assets/path/to/file.ext") |
| Scene Object | NodePath("Parent/Child") |
| Enum | "EnumValueName" |
| Array | [item1, item2, ...] |
在 FormatValue() 的 switch expression 中新增:
return value switch
{
// 新增自訂類型
MyCustomType custom => $"Custom({custom.field1}, {custom.field2})",
// ... existing cases
};
根據 GameObject 上的 Component 決定 Godot 節點類型:
| Unity Component | Godot Type |
|---|---|
| Camera | Camera3D |
| Rigidbody | RigidBody3D |
| CharacterController | CharacterBody3D |
| MeshRenderer | MeshInstance3D |
| Collider | CollisionShape3D |
| Animator | AnimationPlayer |
| Canvas | CanvasLayer |
| (default) | Node3D |
在 PrefabToTextExporter.DetermineNodeType() 中新增:
if (go.GetComponent<MyComponent>()) return "MyGodotType";
使用臨時 GameObject 建立 Component 預設實例,快取預設值後比較:
// 快取結構
Dictionary<Type, Dictionary<string, object>> _defaultCache
// 比較流程
1. GetDefaultValues(componentType) - 取得或建立預設值快取
2. IsDefaultValue(property, defaults) - 比較當前值與預設值
3. 若相同則跳過輸出
Project 視窗選擇 Prefab → 右鍵 → MonoFSM/複製 Prefab 為文字
Tools → MonoFSM → Prefab Text Exporter
在 PrefabExportSettings._excludedFieldNames 中加入欄位名稱。
修改 PrefabToTextExporter.TraverseGameObject() 中的 StringBuilder 輸出。
在 UnityTypeFormatter.FormatPropertyValue() 的 switch 中新增 case。
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
6 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。npx claudepluginhub red-candle-games-co-ltd/monofsm --plugin monofsmOther plugins' skills for the same job