Skip to content
godot-extract-resources logo

Extract Data to Resources

godot-extract-resources

Use when Godot code has hardcoded game data in const arrays, dictionaries, or embedded values. Detects inline data like enemy stats, item definitions, level configurations. Automatically extracts to .tres resource files, making data visible in editor, easily modifiable, and supports data-driven d...

Asreonn/godot-superpowers0installs4stars

SKILL.md

Full skill instructions

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.tres
  • resources/​enemies/​orc.tres
  • resources/​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:

  • const arrays with data structures
  • 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

  1. Scan - Find const arrays, dictionaries with structured data
  2. Analyze - Identify data schema and relationships
  3. Define - Create Resource class definitions
  4. Extract - Generate .tres files with data
  5. Update - Modify code to load resources
  6. Validate - Ensure data loads correctly
  7. 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.tres
  • resources/​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 resources/ or 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:

  • resources/​items/ - Item data
  • resources/​enemies/ - Enemy stats
  • resources/​levels/ - Level configurations
  • resources/​abilities/ - Ability definitions

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
  • const MAX_PLAYERS = 4 (engine limitation)
  • 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)
const STATS = {...}@export var stats: Stats
var data = ITEMS[0]var data = preload("item.tres")
if type == "fire":if ability.element == Element.FIRE:
const CONFIG = {...}@export var config: GameConfig

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

More skills from Asreonn

godot-sync-camera-positions logo
Asreonn/godot-superpowers

godot-sync-camera-positions

Use when Godot background layers or elements follow the camera at runtime but show incorrect position in editor. Detects camera-following patterns and syncs editor position to match typical runtime state. Makes editor preview accurately show what players will see during gameplay.

4 0
View
godot-refactor logo
Asreonn/godot-superpowers

godot-refactor

Use when Godot project has code-created objects, tight coupling via direct references, monolithic scripts over 150 lines, or needs scene-first architecture with signals and composition. Orchestrates all 5 code quality mini-skills: extract-to-scenes, split-scripts, add-signals, extract-resources, ...

4 0
View
godot-split-scripts logo
Asreonn/godot-superpowers

godot-split-scripts

Use when Godot scripts exceed 150 lines or have multiple responsibilities. Detects scripts doing too many things (player movement + combat + inventory + UI). Automatically splits into focused scripts following Single Responsibility Principle, preserves behavior exactly, and creates git commits pe...

4 0
View
godot-convert-shaders logo
Asreonn/godot-superpowers

godot-convert-shaders

Converts Godot 3.x shader code to Godot 4.x shader syntax. Updates SCREEN_TEXTURE to screen_texture uniform, DEPTH_TEXTURE to depth_texture uniform, texture() function changes, built-in varyings updates, and light function signature changes. Essential for rendering and visual effect migrations.

4 0
View
godot-migrate-tilemap logo
Asreonn/godot-superpowers

godot-migrate-tilemap

Migrates legacy TileMap (Godot 4.0-4.2) to new TileMapLayer system (Godot 4.3+). Handles TileMap node conversion, API migration (set_cell to set_cells_terrain_connect), TileSet resource updates, physics layer mapping, navigation layer conversion, and custom data preservation. Essential for upgrad...

4 0
View
godot-setup-animationtree logo
Asreonn/godot-superpowers

godot-setup-animationtree

Use when setting up AnimationTree nodes for state machine-driven animation, creating AnimationNodeStateMachine graphs, configuring BlendSpace2D/3D for locomotion blending, implementing state transition conditions, or creating animation blend trees for complex animation mixing. Supports player cha...

4 0
View
godot-modernize-input logo
Asreonn/godot-superpowers

godot-modernize-input

Use when handling input in Godot 4.x projects and need to modernize patterns. Generates Input Map configurations from hardcoded key checks, sets up joypad rumble (Godot 4.x feature), implements gyroscope/accelerometer input on mobile, creates context-sensitive input handling for different game st...

4 0
View
godot-sync-parallax logo
Asreonn/godot-superpowers

godot-sync-parallax

Use when Godot ParallaxBackground/ParallaxLayer nodes show incorrect positions in editor due to parallax multipliers. Calculates correct editor positions based on camera start position and parallax motion scale. Makes parallax layers preview realistically in editor, matching gameplay appearance.

4 0
View
godot-setup-export logo
Asreonn/godot-superpowers

godot-setup-export

Use when setting up multi-platform exports for Godot projects, configuring export presets, icons, feature tags, build scripts, or CI/CD pipelines

4 0
View
godot-generate-tests logo
Asreonn/godot-superpowers

godot-generate-tests

Use when developing Godot games and need comprehensive test coverage for GDScript classes, signals, scene initialization, and integration flows. Generates GUT framework unit tests, integration tests, mock/stub helpers, and CI/CD test runner configuration.

4 0
View
godot-fix-positions logo
Asreonn/godot-superpowers

godot-fix-positions

Use when Godot project has position conflicts between editor (.tscn) and code (.gd), camera-following backgrounds, or runtime positions don't match editor preview. Orchestrates all 3 position sync mini-skills: sync-static-positions, sync-camera-positions, and sync-parallax. Each operation targets...

4 0
View
godot-organize-assets logo
Asreonn/godot-superpowers

godot-organize-assets

Use when Godot project has disorganized assets (sprites, audio, fonts, materials). Detects scattered asset files and organizes them into clear categories with consistent naming. Creates sprite atlases where beneficial, organizes audio by type, and groups related assets together.

4 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View