godot-resources
gamedev-skills/awesome-gamedev-agent-skills
Design data-driven Godot 4.7 games with custom Resource classes and .tres/.res files.
What is godot-resources?
Model game data as reusable, Inspector-editable Resource objects instead of hard-coded values. Use this skill when representing items, stats, enemy configs, dialogue, or level metadata as data; authoring .tres files in the Inspector; or loading/saving custom resources at runtime.
- Define typed data with class_name and @export fields, editable in the Inspector without code
- Create and manage .tres (text, diff-friendly) or .res (binary, compact) resource files
- Reference resources from nodes via @export variables or arrays of custom Resource types
- Load resources at runtime with preload (constant paths) or ResourceLoader.load (variable paths), including threaded loading for large assets
- Duplicate resources before mutating to avoid changing shared instances across all nodes
- Save generated or edited resources at runtime with ResourceSaver.save to user:// directories
How to install godot-resources
npx skills add https://github.com/gamedev-skills/awesome-gamedev-agent-skills --skill godot-resources- Godot 4.7 or compatible 4.x version installed
- Basic understanding of GDScript @export annotations and class_name declarations
How to use godot-resources
- 1.Create a new GDScript file extending Resource with class_name and @export fields (e.g., ItemResource)
- 2.Right-click in the FileSystem dock, select 'New Resource', choose your custom Resource class, and save as .tres or .res
- 3.Edit the resource's fields in the Inspector and save
- 4.In a node script, declare @export var data: ItemResource or @export var items: Array[ItemResource] and drag .tres files into the Inspector
- 5.At runtime, access resource data directly (e.g., item.display_name) or use ResourceLoader.load() for variable paths
- 6.Call duplicate(true) on a resource before mutating it if multiple nodes share the same instance
- 7.Use ResourceSaver.save(resource, 'user://path.tres') to persist modified resources to the writable user:// directory
Use cases
- Define an ItemResource with id, display_name, icon, and max_stack, then create sword.tres and shield.tres in the FileSystem dock and edit them in the Inspector
- Assign an array of ItemResource .tres files to a node's @export var starting_items and iterate through them at runtime
- Duplicate a template ItemResource before modifying its value so changes don't affect the original .tres file or other nodes using it
- Load a config Resource from user://config.tres at startup and save player-modified settings back to disk
- Create enemy stat Resources (health, damage, loot table) as .tres files and reference them from enemy scene instances
- Godot 4.x game developers building data-driven games with reusable assets
- Game designers who want to author item, enemy, or level data in the Inspector without touching code
- Programmers modeling game configs, dialogue, or loot tables as structured data objects
godot-resources FAQ
The Resource class must have class_name declared at the top of the script. Without it, the editor cannot instantiate it from the dialog.
.tres is text-based (human-readable, diff-friendly, slower to load) and .res is binary (compact, faster to load). Use .tres for data you want to version-control and .res for large assets.
Call duplicate(true) on the resource before assigning it to a node or storing it in a variable. This creates a deep copy so mutations don't affect the original .tres file or other instances.
No. res:// is read-only in exported games. Always save runtime data to user:// instead. ResourceSaver.save to res:// only works in the editor.
No. Resources hold data, not live scene nodes. If you need to reference a scene, use @export var scene: PackedScene instead and instantiate it at runtime.
Full instructions (SKILL.md)
Source of truth, from gamedev-skills/awesome-gamedev-agent-skills.
name: godot-resources description: > Design data-driven Godot 4.7 games with custom Resource classes: define typed data with class_name + @export, save/load .tres/.res files, instance and duplicate resources, and load on demand with ResourceLoader (incl. threaded loading). Use when modeling items/stats/configs as data in a Godot project, creating .tres resources, or working with custom Resource subclasses and ResourceLoader/ResourceSaver.
Godot Resources (4.x)
Model game data as reusable, Inspector-editable Resource objects instead of hard-coded
values, and load/save them as .tres/.res. Targets Godot 4.7.
When to use
- Use when representing items, stats, enemy configs, dialogue lines, or level metadata as
data; authoring
.tresfiles in the Inspector; or loading/saving custom resources.
When not to use: nodes/scene structure → godot-nodes-scenes; saving the player's
runtime progress (engine-agnostic save format/slots) → save-systems; the C# variant of
this pattern → godot-csharp.
Core workflow
- Subclass
Resourcewithclass_nameand@exportfields. It now appears in the "New Resource" dialog and as an@exporttype, editable in the Inspector. - Create instances as
.tresfiles in the FileSystem dock (text, diff-friendly) or.res(binary, smaller/faster). Edit their fields in the Inspector — no code needed. - Reference resources from nodes via
@export var data: ItemResource, or arrays@export var loot: Array[ItemResource]. - Load at runtime with
preload(constant path) orload/ResourceLoader.load(variable path). Use threaded loading for large assets. - Duplicate before mutating a shared resource at runtime, or every node using it changes too (resources are shared references).
- Save generated/edited resources with
ResourceSaver.save.
Patterns
1. A custom data resource
# item.gd
extends Resource
class_name ItemResource
@export var id: StringName = &""
@export var display_name: String = "Item"
@export_multiline var description: String = ""
@export var icon: Texture2D
@export var max_stack: int = 99
@export var value: int = 0
Create sword.tres from this class in the FileSystem dock and fill it in the Inspector.
2. Consume resources from a node
extends Node
@export var starting_items: Array[ItemResource] = [] # drag .tres files in the Inspector
func _ready() -> void:
for item in starting_items:
print("Have: %s (x%d max)" % [item.display_name, item.max_stack])
3. Duplicate before mutating shared data
func give_unique_copy(template: ItemResource) -> ItemResource:
# true = deep copy sub-resources too; false = shallow (shares sub-resources).
var copy: ItemResource = template.duplicate(true)
copy.value += 5 # mutating the copy won't touch the template .tres
return copy
4. Save and load a resource at runtime
func save_config(cfg: Resource) -> void:
ResourceSaver.save(cfg, "user://config.tres") # user:// = writable app data dir
func load_config() -> Resource:
if ResourceLoader.exists("user://config.tres"):
return ResourceLoader.load("user://config.tres")
return null
Pitfalls
- Resources are shared by reference. A single
.tresassigned to many nodes is the same object — mutating it changes all of them (and re-saving the file). Callduplicate(true)for per-instance state. class_namerequired to instance from the editor. Without it the class won't appear in the "New Resource" dialog or as an@exporttype.res://is read-only in exported games. Write runtime data touser://, neverres://.ResourceSaver.savetores://only works in the editor.- Storing nodes in a Resource doesn't serialize them. Resources hold data, not live
scene nodes. Reference scenes via
PackedScene, not node instances. - Cyclic resource references (A holds B holds A) can fail to save/load cleanly — keep data graphs acyclic or use IDs/lookups.
preloadvsload.preloadneeds a constant path and loads with the script;loadaccepts a variable path at runtime. UseResourceLoader.exists()beforeloadto avoid errors on missing files.- Don't put secrets in
.tres— they ship in plain text inside the export.
References
- For threaded/background loading (
load_threaded_request),@toolresources with custom setup, customResourceFormatLoader/Saver, resource-local-to-scene, and resource UIDs, readreferences/resource-patterns.md.
Related skills
godot-gdscript—@exportannotations used to define resource fields.godot-nodes-scenes— instancing scenes vs. sharing resource data.save-systems— persisting runtime progress (separate from static data).unity-scriptableobjects— the equivalent data-asset pattern in Unity.
Related skills
More from gamedev-skills/awesome-gamedev-agent-skills and the wider catalog.

godot-shaders
Write Godot 4.7 shaders (2D canvas_item and 3D spatial) with uniforms, TIME animation, and screen-reading.

godot-signals-groups
Decouple Godot 4.x gameplay with signals and node groups instead of hard-coded references.

godot-tilemap
Build and edit tile-based 2D levels in Godot 4.7 with TileMapLayer, collision, terrains, and runtime cell manipulation.

godot-ui-control
Build responsive Godot 4.7 UIs with Control nodes, Containers, Themes, and keyboard/gamepad focus.

input-systems
Design game input as named actions with rebinding, multi-device support, deadzones, and feel features like buffering and coyote time.

itch-publish
Publish and update game builds on itch.io using butler CLI with efficient delta uploads.