godot-autoload-architecture
Installation
SKILL.md
AutoLoad Architecture
AutoLoads are Godot's singleton pattern, allowing scripts to be globally accessible throughout the project lifecycle. This skill guides implementing robust, maintainable singleton architectures.
NEVER Do
- NEVER access AutoLoads in
_init()— AutoLoads aren't guaranteed to exist yet during _init(). Use_ready()or_enter_tree()instead. - NEVER create circular dependencies — If GameManager depends on SaveManager and SaveManager depends on GameManager, initialization deadlocks. Use signals or dependency injection.
- NEVER store scene-specific state in AutoLoads — AutoLoads persist across scene changes. Storing temporary state (current enemy count, UI state) causes leaks. Reset in
_ready(). - NEVER use AutoLoads for everything — Over-reliance creates "God objects" and tight coupling. Limit to 5-10 AutoLoads max. Use scene trees for local logic.
- NEVER assume AutoLoad initialization order — AutoLoads initialize top-to-bottom in Project Settings. If order matters, add explicit
initialize()calls or use@onreadycarefully.
Available Scripts
MANDATORY: Read the appropriate script before implementing the corresponding pattern.
service_locator.gd
Service locator pattern for decoupled system access. Allows swapping implementations (e.g., MockAudioManager) without changing game code.