This skill helps an agent build data-driven Godot 4.7 games with custom Resource classes for items, stats and enemy configs. It covers typed @export fields, hand-written .tres files, loading with preload and load, and copying shared data before changing it.
It includes a headless test that checks a .tres loads as its class and that a duplicate does not share state with the template. A gotcha list explains why editing one enemy changes every enemy and why class_name errors appear only in CI.
What You Get
- A core workflow from a Resource subclass to .tres instances, node references, loading and duplication
- A custom item resource, the same item as a hand-written .tres file, and a safe duplicate function
- A headless test that checks a .tres loads as its class and that a copy is independent of its template
- A gotcha list for shared references, shallow versus deep copies, res:// being read-only in exports and class_name cache problems on fresh checkouts
Common Use Cases
- Defining items, stats or enemy configs as data files
- Fixing a bug where editing one enemy changes every enemy
- Repairing a .tres file that stops loading after a move
- Loading large scenes in the background with threaded loading
What Makes It Unique
Most Godot data guides stop at creating a Resource in the editor. This skill writes .tres files as text so an agent needs no Inspector clicks, explains the shared-by-reference trap with the exact deep-copy call for nested resources, and ends with a runnable headless check. Save slots and C# are left to separate skills.
Under The Hood
The agent loads the SKILL.md and, when needed, a reference on threaded loading, local-to-scene resources and custom loaders. It writes GDScript and .tres text files into your project and runs the Godot binary headless, first to import the project and then to run a test script, and reads the exit code. After moving files it also runs the Python project checker from a sibling skill. It fetches no web pages and calls no APIs; without a Godot binary it asks you to run the commands and paste the output.