К основному содержанию
скилл CX Codex

godot-resources — скилл для Claude Code: данные Godot

Скилл учит агента описывать игровые данные кастомными классами Resource с class_name и @export, сохранять их в .tres и грузить через ResourceLoader.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill godot-resources -a claude-code
Открыть на GitHub

Что делает godot-resources

Скилл про то, как держать предметы, статы, конфиги врагов и строки диалогов не в коде, а в объектах Resource. Агент получает порядок работы: подкласс Resource с class_name и полями @export, экземпляры в .tres или .res, ссылки из узлов через @export var data: ItemResource и массивы вроде Array[ItemResource]. Дальше preload для постоянного пути, load и ResourceLoader.load для переменного, потоковая загрузка для крупных ассетов.

Главная ловушка, о которой скилл предупреждает отдельно: ресурсы разделяются по ссылке. Один .tres, назначенный десятку узлов, остаётся одним объектом, и правка меняет их все вместе с файлом. Для состояния на экземпляр нужен duplicate(true), а если внутри лежит под-ресурс со своим .tres, то duplicate_deep(Resource.DEEP_DUPLICATE_ALL). Без class_name класс не появится в диалоге «New Resource» и не станет типом для @export.

Запись в res:// работает только в редакторе: в собранной игре этот путь только для чтения, поэтому рантайм-данные идут в user://. Секреты в .tres хранить нельзя, они уезжают в экспорт открытым текстом. Циклические ссылки между ресурсами могут не сохраниться, так что граф данных лучше держать ацикличным.

Какие задачи решает

  • описать предметы и статы данными вместо констант в коде
  • создать .tres с полями и править их в инспекторе
  • подгрузить конфиг по переменному пути в рантайме
  • скопировать ресурс перед изменением, чтобы не задеть остальные узлы
  • сохранить сгенерированный ресурс в user://

Примеры запросов агенту

  • Сделай класс ItemResource с полями id, display_name и max_stack и создай на его основе sword.tres
  • Загрузи конфиг из user://config.tres через ResourceLoader с проверкой ResourceLoader.exists
  • Почему изменение одного .tres меняет все узлы и как скопировать ресурс перед правкой?

Как установить godot-resources

1Через Skills CLI (Vercel)

npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill godot-resources -a claude-code

2Вручную: положить файлы

~/.claude/skills/godot-resources/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/godot-resources/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о godot-resources

Как установить godot-resources в Claude Code?

Выполните npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill godot-resources -a claude-code. Скилл встанет в ~/.claude/skills/godot-resources/SKILL.md.

Что делает godot-resources?

Помогает агенту проектировать данные Godot 4.7 как кастомные классы Resource: поля @export, файлы .tres и .res, загрузка через ResourceLoader и сохранение через ResourceSaver.

Чем этот скилл отличается от соседних по Godot?

Он про данные, а не про сцены: структура узлов уходит в godot-nodes-scenes, сохранение прогресса игрока — в save-systems, вариант на C# — в godot-csharp.

Исходный текст

SKILL.md · Apache-2.0
---
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 `.tres` files 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

1. **Subclass `Resource`** with `class_name` and `@export` fields. It now appears in the
   "New Resource" dialog and as an `@export` type, editable in the Inspector.
2. **Create instances as `.tres`** files in the FileSystem dock (text, diff-friendly) or
   `.res` (binary, smaller/faster). Edit their fields in the Inspector — no code needed.
3. **Reference resources from nodes** via `@export var data: ItemResource`, or arrays
   `@export var loot: Array[ItemResource]`.
4. **Load at runtime** with `preload` (constant path) or `load`/`ResourceLoader.load`
   (variable path). Use threaded loading for large assets.
5. **Duplicate before mutating** a shared resource at runtime, or every node using it
   changes too (resources are shared references).
6. **Save generated/edited resources** with `ResourceSaver.save`.

## Patterns

### 1. A custom data resource

```gdscript
# 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

```gdscript
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

```gdscript
func give_unique_copy(template: ItemResource) -> ItemResource:
    # true = deep: copies nested arrays/dictionaries and *embedded* sub-resources, but
    # sub-resources saved in their own .tres stay shared. Use
    # template.duplicate_deep(Resource.DEEP_DUPLICATE_ALL) to copy those as well.
    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

```gdscript
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 `.tres` assigned to many nodes is the
  *same* object — mutating it changes all of them (and re-saving the file). Call
  `duplicate(true)` for per-instance state.
- **A deep copy still changes the original's sub-resource** → `duplicate(true)` only copies
  sub-resources embedded in the file; one saved as its own `.tres` (e.g. a shared
  `stats.tres` inside `goblin.tres`) is still the same object. Use
  `duplicate_deep(Resource.DEEP_DUPLICATE_ALL)` when those must be copied too.
- **`class_name` required to instance from the editor.** Without it the class won't appear
  in the "New Resource" dialog or as an `@export` type.
- **`res://` is read-only in exported games.** Write runtime data to `user://`, never
  `res://`. `ResourceSaver.save` to `res://` 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.
- **`preload` vs `load`.** `preload` needs a constant path and loads with the script;
  `load` accepts a variable path at runtime. Use `ResourceLoader.exists()` before `load`
  to 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`), `@tool` resources with custom
  setup, custom `ResourceFormatLoader`/`Saver`, resource-local-to-scene, and resource UIDs,
  read `references/resource-patterns.md`.

## Related skills

- `godot-gdscript` — `@export` annotations 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.

© gamedev-skills · Apache-2.0 · gamedev-skills/awesome-gamedev-agent-skills

Похожие скиллы

Всё по теме «Геймдев и 3D: Unity, Unreal, Godot, Blender» →
orbit-card heygen-com Скилл для встраивания готового 10-секундного 3D-блока HyperFrames: карточка фичи облетает сферу из точек по траектории камеры из Blender. CX Codex +1 10 000установок cad earthtojake Создаёт и правит параметрические CAD-модели, экспортирует STEP, STL, 3MF и GLB, измеряет геометрию и открывает готовые файлы в CAD Viewer. CX Codex +1 14 000установок step-parts earthtojake Скилл ищет готовые покупные детали в каталоге step.parts и скачивает их STEP-файлы, чтобы не рисовать заглушки в сборке. CX Codex +1 11 200установок sdf earthtojake Скилл создаёт и проверяет SDFormat-файлы для моделей и миров, а затем помогает подготовить их к передаче в симулятор. CX Codex +1 10 500установок urdf earthtojake Скилл помогает создавать, проверять и отлаживать описания роботов в формате URDF. Пригодится для работы со звеньями, сочленениями и геометрией. CX Codex +1 10 500установок hatch-pet официальный openai Создаёт и упаковывает анимированных питомцев и спрайт-листы для Codex. Пригодится, когда нужен персонаж по описанию, изображению или фирменным ориентирам. CX Codex +1 3 300установок

Из того же набора77

godot-physics Настраивает физические тела Godot 4.7, слои коллизий, триггеры Area и лучи в 2D и 3D. Помогает избежать ошибок с перекрытием масок и дёрганием RigidBody. CX Codex +1 6 300установок rpg Скилл для создания RPG с прогрессией персонажа, инвентарём, квестами, диалогами и боевой системой. Подходит для разработки механик роста, экипировки, целей и формул урона. CX Codex +1 6 400установок godot-signals-groups Настраивает слабосвязанную архитектуру в Godot 4.7 через типизированные сигналы и группы узлов. Помогает связать события сцен без жёстких ссылок и переписать вызовы со старого API Godot 3.x. CX Codex +1 6 200установок prototype-fast Скилл для геймдева: за жёсткий таймбокс собирает играбельный прототип одной механики и помогает решить, оставить её или выбросить. CX Codex +1 6 300установок godot-2d-movement Настраивает 2D-перемещение персонажей в Godot 4.7 через CharacterBody2D. Пригодится при написании контроллеров платформера или top-down игры и починке метода move_and_slide(). CX Codex +1 6 100установок roguelike Скилл для сборки рогалика: пошаговый движок, процедурные подземелья, поле зрения, permadeath и таблицы лута. Пригодится, если мир пересобирается на каждый забег. CX Codex +1 6 200установок godot-3d-essentials Скилл для быстрой сборки 3D-сцен в Godot 4.7: размещение камер, источников света, окружения и материалов. Пригодится, если вы строите 3D-уровни или настраиваете освещение и постобработку. CX Codex +1 6 200установок godot-export Скилл настраивает экспорт проектов Godot 4.7 под десктоп и Web. Помогает подготовить сборку для CI в headless-режиме и избежать ошибок с путями. CX Codex +1 6 200установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой