Claude-skill-registry godot-extract-resources
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/godot-extract-resources" ~/.claude/skills/majiayu000-claude-skill-registry-godot-extract-resources && rm -rf "$T"
manifest:
skills/data/godot-extract-resources/SKILL.mdsource content
Extract Data to Resources
Core Principle
Data belongs in resources, not code. Hardcoded values make iteration slow and error-prone.
What This Skill Does
Finds patterns like:
# enemy.gd const ENEMY_DATA = { "goblin": {"health": 50, "speed": 100, "damage": 10}, "orc": {"health": 100, "speed": 80, "damage": 20}, "dragon": {"health": 500, "speed": 150, "damage": 50} }
Transforms to:
# enemy_stats.gd class_name EnemyStats extends Resource @export var enemy_name: String @export var health: int @export var speed: float @export var damage: int
Creates resource files:
resources/enemies/goblin.tresresources/enemies/orc.tresresources/enemies/dragon.tres
Updates code:
# enemy.gd @export var stats: EnemyStats func _ready(): health = stats.health speed = stats.speed damage = stats.damage
Detection Patterns
Identifies:
arrays with data structuresconst- Dictionaries with game data
- Embedded configuration values
- Hardcoded stats, properties, settings
- Switch statements on type strings
When to Use
You're Building Data-Heavy Games
Games with many items, enemies, levels, or configurations.
You're Iterating on Balance
Want to tweak values quickly without code changes.
You're Working with Designers
Non-programmers need to edit game data.
You're Adding Moddability
External data files enable modding support.
Process
- Scan - Find const arrays, dictionaries with structured data
- Analyze - Identify data schema and relationships
- Define - Create Resource class definitions
- Extract - Generate .tres files with data
- Update - Modify code to load resources
- Validate - Ensure data loads correctly
- Commit - Git commit per resource type
Example Transformation
Before (Hardcoded Data):
# item_manager.gd const ITEMS = [ { "id": "health_potion", "name": "Health Potion", "description": "Restores 50 HP", "heal_amount": 50, "icon": "res://icons/potion.png" }, { "id": "sword", "name": "Iron Sword", "description": "A basic sword", "damage": 15, "icon": "res://icons/sword.png" } ] func get_item(id: String): for item in ITEMS: if item.id == id: return item return null
After (Resource-Based):
# item_data.gd class_name ItemData extends Resource @export var id: String @export var item_name: String @export_multiline var description: String @export var icon: Texture2D @export_group("Stats") @export var heal_amount: int @export var damage: int
# item_manager.gd @export var items: Array[ItemData] func get_item(id: String) -> ItemData: for item in items: if item.id == id: return item return null
Created Files:
resources/items/health_potion.tresresources/items/iron_sword.tres
Resource Patterns
Simple Resources
Single values (stats, settings, constants).
Composite Resources
Resources referencing other resources (weapon + stats + effects).
Resource Libraries
Arrays of resources for different categories.
Resource Inheritance
Base resource class with specialized variants.
What Gets Created
- Resource class definitions in
orresources/scripts/resources/ - .tres files in organized directory structure
- Updated code using @export var resource: ResourceType
- Documentation of resource schema
- Git commits per resource extraction
Smart Analysis
Identifies data types:
- Configuration - Settings, constants, tuning values
- Content - Items, enemies, levels, abilities
- Behavior - AI patterns, state machines, rules
Organizes by category:
- Item dataresources/items/
- Enemy statsresources/enemies/
- Level configurationsresources/levels/
- Ability definitionsresources/abilities/
Integration
Works with:
- godot-extract-to-scenes - Scenes reference resources
- godot-split-scripts - Resources reduce script size
- godot-refactor (orchestrator) - Runs as part of full refactoring
Safety
- Data preserved exactly during extraction
- Validation ensures resources load correctly
- Rollback on validation failure
- Original data preserved in git history
When NOT to Use
Don't extract if:
- Data is truly constant (math constants, engine limits)
- Data changes at runtime (calculated values)
- Data is temporary state (not configuration)
- Extraction makes code more complex
Examples of valid hardcoded data:
const PI = 3.14159
(engine limitation)const MAX_PLAYERS = 4- Calculated values based on other data
Resource Organization
resources/ ├── items/ │ ├── consumables/ │ │ ├── health_potion.tres │ │ └── mana_potion.tres │ └── weapons/ │ ├── iron_sword.tres │ └── steel_axe.tres ├── enemies/ │ ├── goblin.tres │ ├── orc.tres │ └── dragon.tres └── levels/ ├── level_1.tres └── level_2.tres
Benefits
- Rapid iteration - Change data without recompiling
- Designer-friendly - Edit values in Godot inspector
- Type safety - @export provides validation and autocomplete
- Moddability - External .tres files can be modified
- Version control - Data changes tracked separately from code
- Hot reload - Godot reloads resource changes automatically
Common Transformations
| Before (Hardcoded) | After (Resource) |
|---|---|
| |
| |
| |
| |
Resource Types
Built-in Resources
- Texture2D, Material, AudioStream
- Animation, Curve, Gradient
- Theme, StyleBox, Font
Custom Resources
- EnemyStats, ItemData, LevelConfig
- AbilityDefinition, QuestData
- Any game-specific data structure
Resource Collections
- Array[ItemData] for item databases
- Dictionary for lookup tables
- Resource library scenes