Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

godot-resource-data-patterns

БесплатноЗапускает вложенные скриптыНе проверен

Expert blueprint for data-oriented design using Resource/RefCounted classes (item databases, character stats, reusable data structures). Covers typed arrays…

thedivergentaiот thedivergentai★ 1 019 звёзд на GitHub

Об этом скилле

NEVER Do in Resource Design

  • NEVER modify resource instances directly — Without .duplicate(), changing a value (like HP) modifies the shared .tres for everyone.
  • NEVER use untyped arrays in Resources — @export var items: Array allows logic errors. Always use Array[ResourceClass] for type safety.
  • NEVER store Node references in Resources — Objects that only exist in a specific SceneTree cannot be serialized. Store NodePath or UID.
  • NEVER perform heavy calculations in Resource getters/setters — Resources should be data containers. Offload logic to Nodes or specialized RefCounted classes.
  • NEVER skip ResourceSaver.save() error checks — Saving can fail due to permissions, disk space, or path issues. Always check the return code.
  • NEVER use Resources for high-frequency runtime data — If a value changes 60 times a second (like velocity), a standard variable is faster than a Resource property.
  • NEVER allow circular Resource references — If A.tres references B.tres and B.tres references A.tres, the engine may crash on load.
  • NEVER forget the _init defaults — Resources created via new() or in the Inspector need default values in their constructor to be editable.
  • NEVER share a Resource between entities if they need unique state — Use resource_local_to_scene = true or duplicate() for components.
  • NEVER use .tres for massive datasets — If you have 10,000 items, a JSON or custom binary format might be more efficient than individualized Resource files.

Decision Tree: Resource vs RefCounted vs Node

Type Use when Disk / Inspector
Resource Shared definitions, saveable data, @export authoring .tres/.res, Inspector ✅
RefCounted Temporary runtime calcs, non-persistent helpers No disk / weak Inspector
Node Scene entities with process/signals in the tree Scene files

Use Resources for: item defs, stats templates, abilities, dialogue tables, enemy configs. Use RefCounted for: damage calc scratchpads, ephemeral state machines, non-saved utilities.

Available Scripts — MANDATORY by Scenario

Scenario MANDATORY read
Per-instance mutable stats (HP) sharing a base .tres resource_local_to_scene.gd
Nested Item → Weapon → StatusEffect trees / save whole graph nested_resource_serialization.gd
Many entities sharing one config (flyweight) resource_flyweight_caching.gd / flyweight_enemy_config.gd
Custom @export data containers custom_data_resource.gd
Reactive stats with signals character_stats_resource.gd
Inventory arrays of Resources resource_based_inventory.gd
Save Resource trees to disk resource_save_system.gd — check Error
Preload / O(1) cache before play resource_preloading_strategy.gd
Runtime Resource.new() loot dynamic_resource_generation.gd
Validate / pool / factory resource_validator.gd / resource_pool.gd / data_factory_resource.gd

Expert WHY (critical)

CAUTION: Runtime HP/mana on a shared .tres without duplicate(true) or resource_local_to_scene mutates the asset on disk — the "damaging one damages all" bug.

  • .res vs .tres: binary .res in production; .tres for design diffs; nested trees save with parent via ResourceSaver.
  • Cache: ResourceLoader.CACHE_MODE_REPLACE after external edits bypass stale cache.
  • Local-to-scene / duplicate: mandatory for per-instance components — resource_local_to_scene.gd.
  • 10k+ rows: individualized .tres files lose to JSON/binary — see Official Docs binary serialization.

Deep dive (load on demand)

Pattern 1–7 walkthroughs (ItemData, databases, RefCounted calcs, directory scan, O(1) cache) — references/resource-patterns-deep.md. Implement nested weapons from nested_resource_serialization.gd, not memory.

Reference

Progressive disclosure: open Official Documentation links only when researching a specific API; load Related Skills when routing to a peer domain — do not preload the whole lattice.

Official Documentation

  • Resources — Custom Resource scripts, .tres/.res, sharing vs duplicate(), and resource_local_to_scene for per-instance state.
  • [Data preferences](https://doc
Полный SKILL.md на GitHub

Установить godot-resource-data-patterns в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/migration-notes.mdreferences/resource-patterns-deep.mdscripts/character_stats_resource.gdscripts/custom_data_resource.gdscripts/data_factory_resource.gdscripts/dynamic_resource_generation.gdscripts/flyweight_enemy_config.gdscripts/nested_resource_serialization.gdscripts/resource_based_inventory.gdscripts/resource_flyweight_caching.gdscripts/resource_local_to_scene.gdscripts/resource_pool.gdscripts/resource_preloading_strategy.gdscripts/resource_save_system.gdscripts/resource_validator.gd

FAQ

Что делает скилл godot-resource-data-patterns?

Expert blueprint for data-oriented design using Resource/RefCounted classes (item databases, character stats, reusable data structures). Covers typed arrays, serialization, nested resources, and resource caching. Use when implementing data systems OR inventory/stats/dialogue databases. Keywords Resource, RefCounted, ItemData, CharacterStats, database, serialization, @export, typed arrays.

Как установить скилл godot-resource-data-patterns?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл godot-resource-data-patterns запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

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

Сравнить godot-resource-data-patterns с