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★ 1 019 звёзд на GitHubОб этом скилле
NEVER Do in Resource Design
- NEVER modify resource instances directly — Without
.duplicate(), changing a value (like HP) modifies the shared.tresfor everyone. - NEVER use untyped arrays in Resources —
@export var items: Arrayallows logic errors. Always useArray[ResourceClass]for type safety. - NEVER store Node references in Resources — Objects that only exist in a specific SceneTree cannot be serialized. Store
NodePathorUID. - 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
_initdefaults — Resources created vianew()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 = trueorduplicate()for components. - NEVER use
.tresfor 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
.treswithoutduplicate(true)orresource_local_to_scenemutates the asset on disk — the "damaging one damages all" bug.
.resvs.tres: binary.resin production;.tresfor design diffs; nested trees save with parent viaResourceSaver.- Cache:
ResourceLoader.CACHE_MODE_REPLACEafter external edits bypass stale cache. - Local-to-scene / duplicate: mandatory for per-instance components — resource_local_to_scene.gd.
- 10k+ rows: individualized
.tresfiles 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 vsduplicate(), andresource_local_to_scenefor per-instance state. - [Data preferences](https://doc
Установить godot-resource-data-patterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
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 запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic