godot-scene-surgery
Installation
SKILL.md
Scene Surgery
Godot's .tscn and .tres files are human-readable text, which makes them tempting to edit directly. They are also full of cross-references that must stay consistent, and a file that is one id off will fail to load with an error that points at the wrong place. Editing them blind is the single most common way an agent breaks a Godot project.
The default answer is: don't hand-edit
Prefer, in this order:
- Change it in the editor — tell the user what to click. Slower for you, zero risk.
- Change it from GDScript at runtime or in a
@toolscript —add_child,set_script,ResourceSaver.save(). The engine writes valid files by construction. - Hand-edit the text — only for small, well-understood changes, and only after reading this file.
If the user asked for something a script can do, write the script. "Add a Timer child to every enemy scene" is a @tool script or an EditorScript, not fifteen text patches.
Anatomy of a .tscn (format 3 = Godot 4)
[gd_scene load_steps=3 format=3 uid="uid://bx8n2k4mqvr1t"]