Confirm successful installation by checking the skill directory location:
.cursor/skills/godot-best-practices
Restart Cursor to activate godot-best-practices. Access via /godot-best-practices in your agent's command palette.
โ
Security Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Guide AI agents in writing high-quality GDScript code for Godot 4.x. This skill provides coding standards, architecture patterns, and templates for game development.
When to Use This Skill
Use this skill when:
Generating new GDScript code
Creating or organizing Godot scenes
Designing game architecture and node hierarchies
Implementing state machines, object pools, or save systems
Answering questions about GDScript patterns or Godot conventions
Reviewing GDScript code for quality issues
Do NOT use this skill when:
Working with C# in Godot (use C# patterns)
Working with Godot 3.x (syntax differs significantly)
Using GDExtension/C++ (different paradigm)
Working with Godot's visual scripting
Core Principles
1. Naming Conventions
Follow GDScript naming standards consistently:
# Classes: PascalCaseclass_namePlayerControllerextendsCharacterBody2D# Signals: past_tense_snake_case (describe what happened)signalhealth_changed(new_health:int)signal player_died
signalitem_collected(item:Item)# Constants: SCREAMING_SNAKE_CASEconstMAX_SPEED:float=200.0constJUMP_FORCE:int=-400# Variables and functions: snake_casevar current_health:int=100var _private_variable:float=0.0# Leading underscore for privatefunccalculate_damage(base:int, multiplier:float)->int:returnint(base * multiplier)func_private_helper()->void:# Leading underscore for privatepass
2. Type Hints (Static Typing)
Use explicit type hints everywhere for autocomplete and error detection:
# Variable declarationsvar speed:float=100.0var player:CharacterBody2Dvar items:Array[Item]=[]var stats:Dictionary={}# Function signatures with return typesfuncget_damage()->int:return _base_damage * _multiplier
funcfind_nearest_enemy(position:Vector2)->Enemy:# Implementationreturnnull# Typed signals (Godot 4.x)signalscore_updated(new_score:int, old_score:int)signaltarget_acquired(target:Node2D, distance:float)# Node references with types@onreadyvar sprite:Sprite2D=$Sprite2D@onreadyvar collision:CollisionShape2D=$CollisionShape2D@onreadyvar animation_player:AnimationPlayer=%AnimationPlayer
3. Node References
Use modern patterns for stable, refactor-friendly references:
# PREFER: @onready with type hints@onreadyvar health_bar:ProgressBar=$UI/HealthBar
@onreadyvar weapon:Weapon=$WeaponMount/Weapon
# PREFER: Unique names with % for critical nodes@onreadyvar player:Player=%Player
@onreadyvar game_manager:GameManager=%GameManager
# AVOID: get_node() in _ready()func_ready()->void:# Don't do thisvar sprite =get_node("Sprite2D")# AVOID: Deep fragile paths@onreadyvar thing =$Parent/Child/GrandChild/GreatGrandChild # Fragile
4. Signal-Driven Architecture
Use signals for decoupled communication. Follow "signal up, call down":
# Child node emits signals (doesn't know about parent)class_nameHealthComponentextendsNodesignalhealth_changed(current:int, maximum:int)signal died
var _health:int=100var _max_health:int=100functake_damage(amount:int)->void: _health =max(0, _health - amount) health_changed.emit(_health, _max_health)if _health <=0: died.emit()
# Parent connects to child signals (knows about children)class_namePlayerextendsCharacterBody2D@onreadyvar health:HealthComponent=$HealthComponent@onreadyvar sprite:Sprite2D=$Sprite2Dfunc_ready()->void: health.health_changed.connect(_on_health_changed) health.died.connect(_on_died)func_on_health_changed(current:int, maximum:int)->void:# Update UI, play effects, etc.passfunc_on_died()->void: sprite.modulate = Color.REDqueue_free()
5. Resource Loading
Choose the right loading strategy:
# preload(): Compile-time loading for critical/small assetsconstBULLET_SCENE:PackedScene=preload("res://scenes/bullet.tscn")constPLAYER_SPRITE:Texture2D=preload("res://sprites/player.png")constDAMAGE_SOUND:AudioStream=preload("res://audio/damage.wav")# load(): Runtime loading for optional/large assetsfuncload_level(level_name:String)->void:var path :="res://levels/%s.tscn"% level_name
var level_scene:PackedScene=load(path)var level := level_scene.instantiate()add_child(level)# ResourceLoader for async loading (prevents stuttering)func_load_level_async(path:String)->void: ResourceLoader.load_threaded_request(path)# Check with: ResourceLoader.load_threaded_get_status(path)# Get with: ResourceLoader.load_threaded_get(path)
Quick Reference
Category
Prefer
Avoid
Node references
@onready var x: Type = $Path
get_node() in _ready()
Unique nodes
%UniqueName
Deep paths $A/B/C/D
Resource loading
preload() for small/critical
load() everywhere
Signals
Typed: signal x(val: int)
Implementation Guide
Prerequisites
โบClaude Desktop or compatible AI client with skill support
โบClear understanding of task or problem to solve
โบWillingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Steps
1Install skill using provided installation command
2Test with simple use case relevant to your work
3Evaluate output quality and relevance
4Iterate on prompts to improve results
5Integrate into regular workflow if valuable
Common Pitfalls
โ Expecting perfect results without iteration
โ Not providing enough context in prompts
โ Using skill for tasks outside its intended scope
โ Accepting outputs without review and validation
Best Practices
โ Do
+Start with clear, specific prompts
+Provide relevant context and constraints
+Review and refine all outputs before using
+Iterate to improve output quality
+Document successful prompt patterns
โ Don't
โDon't use without understanding skill limitations
โDon't skip validation of outputs
โDon't share sensitive information in prompts
โDon't expect skill to replace human judgment
๐ก Pro Tips
โ Be specific about desired format and style
โ Ask for multiple options to choose from
โ Request explanations to understand reasoning
โ Combine AI efficiency with human expertise
When to Use This
โ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
โ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path
1Familiarize yourself with skill capabilities and limitations
2Start with low-risk, non-critical tasks
3Progress to more complex and valuable use cases
4Build expertise through regular use and experimentation