Create New Godot Scene
Create a new scene and accompanying GDScript for: $ARGUMENTS
Step 1 — Determine Scene Type
Parse the arguments to determine the scene type. Common types:
| Type | Root Node | Typical Children | Directory |
|---|---|---|---|
character / player | CharacterBody2D | AnimatedSprite2D, CollisionShape2D | game/scenes/characters/ |
enemy | CharacterBody2D | AnimatedSprite2D, CollisionShape2D, NavigationAgent2D | game/scenes/enemies/ |
npc | CharacterBody2D or Area2D | AnimatedSprite2D, CollisionShape2D, Area2D (interaction zone) | game/scenes/npcs/ |
item / pickup | Area2D | Sprite2D, CollisionShape2D | game/scenes/items/ |
projectile | Area2D | Sprite2D, CollisionShape2D | game/scenes/projectiles/ |
level / map | Node2D | TileMapLayer, Camera2D, spawn markers | game/scenes/levels/ |
effect | Node2D | AnimatedSprite2D or GPUParticles2D | game/scenes/effects/ |
If the type is ambiguous, ask the user.
Step 2 — Look Up Documentation (MANDATORY — do not skip)
You MUST complete ALL of these before writing any code:
- •Call the
godot-docssubagent for the root node type and key child types:codeTask(subagent_type="godot-docs", prompt="Look up [ROOT_NODE_TYPE] and [CHILD_TYPES]. I need properties, methods, signals, and code examples for creating a [SCENE_TYPE] scene.")
- •Read the scene architecture best practices:
code
Read("docs/best-practices/01-scene-architecture.md") - •If this scene has signals, also read
docs/best-practices/02-signals-and-communication.md
Step 3 — Create Directory Structure
Ensure the target directory exists under game/scenes/.
Step 4 — Create the Scene (.tscn)
Create a .tscn file with the proper Godot scene format. Use [gd_scene] header, [ext_resource] for external assets, [sub_resource] for inline resources, and [node] entries.
Scene File Template
code
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://scenes/<category>/<name>.gd" id="1"]
[node name="<RootName>" type="<RootType>"]
script = ExtResource("1")
[node name="<ChildName>" type="<ChildType>" parent="."]
Step 5 — Create the Script (.gd)
Generate a GDScript file following these conventions from CLAUDE.md:
Script Template
gdscript
class_name <PascalCaseName>
extends <RootNodeType>
## <Brief description of what this scene/entity does.>
signal <relevant_signal>
enum <RelevantEnum> {
VALUE_ONE,
VALUE_TWO,
}
const <RELEVANT_CONSTANT>: <type> = <value>
@export var <exported_property>: <type> = <default>
var <internal_property>: <type> = <default>
@onready var <child_ref>: <Type> = $<ChildNodeName>
func _ready() -> void:
pass
func _physics_process(delta: float) -> void:
pass
Code Style Rules (from CLAUDE.md)
- •Use tabs for indentation
- •Use static typing everywhere
- •Use double quotes for strings
- •Use
@exportfor inspector-exposed variables - •Use
@onreadyfor child node references - •Use
and/or/notover&&/||/! - •Trailing commas in multiline arrays, dicts, enums
- •Two blank lines between functions
- •Lines under 100 characters (prefer 80)
- •Signals in past tense (e.g.,
health_changed,died) - •Private members prefixed with
_
Step 6 — Report
After creating files, report:
- •Files created (with full paths)
- •Node hierarchy of the scene
- •Signals and exports defined
- •Suggested next steps (e.g., "Add sprite frames", "Set collision shape", "Connect signals")