Skip to content
godot-organize-scripts logo

Organize Script Files

godot-organize-scripts

Use when Godot project has scripts scattered without clear organization. Detects scripts and organizes them by category (characters, enemies, components, managers, utilities). Creates clear structure showing architectural layers and relationships. Preserves all references and class_name declarati...

SKILL.md

Full skill instructions

Organize Script Files

Core Principle

Scripts organized by architectural layer and responsibility. Code structure reveals design.

What This Skill Does

Finds script directories like:

scripts/
├── player.gd
├── enemy.gd
├── health_component.gd
├── game_manager.gd
├── utility.gd
├── inventory.gd
├── ui_manager.gd
└── ... (50 more scripts)

Transforms to:

scripts/
├── characters/
│   ├── player.gd
│   └── character_base.gd
├── enemies/
│   ├── enemy.gd
│   ├── goblin.gd
│   └── enemy_ai.gd
├── components/
│   ├── health_component.gd
│   ├── movement_component.gd
│   └── combat_component.gd
├── managers/
│   ├── game_manager.gd
│   ├── ui_manager.gd
│   └── audio_manager.gd
├── systems/
│   └── inventory.gd
└── utility/
    ├── math_helper.gd
    └── constants.gd

Detection Patterns

Identifies:

  • Scripts by architectural role
  • Base classes vs implementations
  • Reusable components vs specific entities
  • System/​manager scripts
  • Utility/​helper scripts

When to Use

Growing Codebase

Scripts have multiplied and organization is lost.

Understanding Architecture

Want folder structure to reflect design.

Team Onboarding

New developers need to navigate code quickly.

Before Major Refactoring

Clean organization makes refactoring safer.

Process

  1. Scan - Inventory all .gd files and analyze content
  2. Classify - Determine category based on role and naming
  3. Group - Find related scripts (inheritance, dependencies)
  4. Plan - Create target directory structure
  5. Move - Relocate scripts preserving references
  6. Update - Fix paths in preload(), extends, scenes
  7. Validate - Ensure all scripts load correctly
  8. Commit - Git commit per category moved

Organization Structure

Characters

Scripts for player and NPCs.

characters/
├── player.gd
├── npc.gd
├── character_base.gd
└── character_state_machine.gd

Enemies

Scripts for enemy entities and AI.

enemies/
├── enemy_base.gd
├── goblin.gd
├── orc.gd
├── ai/
│   ├── enemy_ai.gd
│   ├── patrol_ai.gd
│   └── chase_ai.gd
└── behaviors/
    ├── attack_behavior.gd
    └── flee_behavior.gd

Components

Reusable component scripts.

components/
├── health_component.gd
├── movement_component.gd
├── combat_component.gd
├── inventory_component.gd
└── hitbox_component.gd

Managers

Singleton-style manager scripts.

managers/
├── game_manager.gd
├── audio_manager.gd
├── scene_manager.gd
├── save_manager.gd
└── input_manager.gd

Systems

Game systems (inventory, quests, dialog).

systems/
├── inventory_system.gd
├── quest_system.gd
├── dialog_system.gd
└── crafting_system.gd

UI

UI-specific scripts.

ui/
├── main_menu.gd
├── pause_menu.gd
├── hud.gd
├── inventory_ui.gd
└── widgets/
    ├── health_bar.gd
    └── button_hover.gd

Utility

Helper and utility scripts.

utility/
├── constants.gd
├── math_helper.gd
├── vector_utils.gd
└── debug_draw.gd

Resources (Script Definitions)

Custom Resource class definitions.

resources/
├── item_data.gd
├── enemy_stats.gd
├── ability_definition.gd
└── level_config.gd

Classification Logic

Character Scripts

  • Names contain "player", "npc", "character"
  • Extend CharacterBody2D or custom character base
  • Handle player/​NPC-specific logic

Enemy Scripts

  • Names contain "enemy", "monster", mob types
  • Extend enemy base or have AI logic
  • Handle hostile entity behavior

Component Scripts

  • Names end with "_component"
  • Designed for reuse across entities
  • Single responsibility (health, movement, etc.)

Manager Scripts

  • Names end with "_manager"
  • Often autoloaded singletons
  • Manage global state or services

System Scripts

  • Names end with "_system"
  • Handle game mechanics (inventory, quests)
  • Domain-specific logic

Utility Scripts

  • Names like "helper", "utils", "constants"
  • Stateless helper functions
  • Mathematical or string utilities

What Gets Created

  • Organized script directories by category
  • Subdirectories for specialized groupings
  • Moved scripts with preserved references
  • Updated class_name references
  • Updated autoload paths in project.godot
  • Git commits per category

Smart Analysis

Detects relationships:

  • Inheritance (base classes with implementations)
  • Dependencies (scripts that preload others)
  • Naming patterns (conventions reveal purpose)

Maintains cohesion:

  • Related scripts stay together
  • Base + derived classes in same category
  • Component families grouped

Reference Updates

Script Preloads

# Before
const EnemyScene = preload("res://enemy.gd")

# After
const EnemyScene = preload("res://scripts/​enemies/​enemy.gd")

Class Extends

# Before
extends "res://character_base.gd"

# After
extends "res://scripts/​characters/​character_base.gd"

Scene Script Attachments

# Before
[ext_resource path="res://player.gd" type="Script"]

# After
[ext_resource path="res://scripts/​characters/​player.gd" type="Script"]

Integration

Works with:

  • godot-split-scripts - Split first, then organize
  • godot-organize-files - Base file organization
  • godot-organize-project (orchestrator) - Full project organization

Safety

  • All script references preserved
  • class_name declarations work correctly
  • Autoload paths updated automatically
  • Rollback on validation failure
  • Original structure in git history

When NOT to Use

Don't reorganize if:

  • Scripts already well organized
  • Custom structure required by architecture
  • Mid-sprint (bad timing)
  • External tools rely on current paths

Benefits

  • Discoverability - Find scripts by responsibility
  • Architecture Visibility - Structure reflects design
  • Onboarding - New developers navigate easily
  • Refactoring - Clear boundaries for changes
  • Testing - Easier to test by layer

Naming Conventions

Optional: Rename during organization

  • PlayerController.gd → player_controller.gd (snake_case)
  • EnemyAI.gd → enemy_ai.gd

Godot convention prefers snake_case for file names.

Architecture Layers

Typical hierarchy:

  1. Entities - characters/, enemies/
  2. Components - components/
  3. Systems - systems/, managers/
  4. UI - ui/
  5. Utilities - utility/

Organization reflects dependency direction (utilities depend on nothing, entities depend on everything).

Common Transformations

BeforeAfter
player.gd in scripts/scripts/​characters/​player.gd
enemy_ai.gd in scripts/scripts/​enemies/​ai/​enemy_ai.gd
health_component.gd mixedscripts/​components/​health_component.gd
game_manager.gd in rootscripts/​managers/​game_manager.gd
utils.gd scatteredscripts/​utility/​math_helper.gd

Configuration

Can be customized for:

  • Different architectural patterns (MVC, ECS-like, etc.)
  • Team-specific categories
  • Domain-specific groupings
  • Depth of organization (flat vs deep)

Defaults follow Godot component-based architecture patterns.

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
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