Although there is not one hard, fast rule for how to format or organize your code it is a good idea to follow the standard conventions. Not only does this make it easier to understand your own scripts but also assists others who may need to read through to provide aid. There is a more comprehensive guide available that aims to provide consistency across all developers that can be found in the Godot Docs.
I’ll provide some of the more common formatting mistakes I see beginners (and even myself sometimes) make when writing their scripts. To reiterate, these are merely suggestions to gain uniformity but it is ultimately up to you to decide if you want to follow them.
Naming Conventions
Classes and Nodes
Classes and Nodes should be named using PascalCase. This is also the case if we are setting a variable to a loaded class.

Functions and Variables
Functions and Variables should be named using snake_case. The underscore denotes a normal space between words and single word variables are just lowercase.

File Names
File names should be named using snake_case. This means that if we have a script for a weapon resource, it should be saved as “weapon.gd”.

For other naming conventions, refer to the table below:
Type | Convention | Example |
---|---|---|
File Names | snake_case | weapon.gd |
Class Names | PascalCase | class_name Weapon |
Node Names | PascalCase | PlayerCharacter |
Functions | snake_case | func load_item(): |
Variables | snake_case | var shot_cooldown |
Signals | snake_case | signal is_finished |
Constants | CONSTANT_CASE | const MAX_SPEED = 150 |
Boolean Operations
In GDScript it is preferable to use plain English instead of typical Boolean operators:
- Use “and” instead of “&&”
- Use “or” instead of “| |”
- Use “not” instead of “!”
Code Order
GDScript Code order should follow this general outline:
- Properties and Signals
- Methods
- Public Variables
- Private Variables
- @onready Variables
- Public Methods
- Private Methods
With all this in mind you’re ready to start writing clean, readable code. Feel free to reference this post and the official GDScript Style Guide in the Godot Docs as you travel on your development journey.