From tsal
Provides specialized guidance for Godot Engine projects: .gd, .tscn, .tres file formats, component-based patterns, signals, resources, debugging, validation tools, templates, and CLI workflows.
npx claudepluginhub bfollington/terma --plugin tsalThis skill uses the workspace's default tool permissions.
Specialized guidance for developing games and applications with Godot Engine, with emphasis on effective collaboration between LLM coding assistants and Godot's unique file structure.
assets/templates/attribute_template.gdassets/templates/component_template.gdassets/templates/interaction_template.gdassets/templates/item_resource.tresassets/templates/spell_resource.tresreferences/architecture-patterns.mdreferences/common-pitfalls.mdreferences/file-formats.mdreferences/godot4-physics-api.mdscripts/validate_tres.pyscripts/validate_tscn.pyGenerates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
Specialized guidance for developing games and applications with Godot Engine, with emphasis on effective collaboration between LLM coding assistants and Godot's unique file structure.
Godot projects use a mix of GDScript code files (.gd) and text-based resource files (.tscn for scenes, .tres for resources). While GDScript is straightforward, the resource files have strict formatting requirements that differ significantly from GDScript syntax. This skill provides file format expertise, proven architecture patterns, validation tools, code templates, and debugging workflows to enable effective development of Godot projects.
Invoke this skill when:
GDScript (.gd) - Full Programming Language:
extends Node
class_name MyClass
var speed: float = 5.0
const MAX_HEALTH = 100
func _ready():
print("Ready")
Scene Files (.tscn) - Strict Serialization Format:
[ext_resource type="Script" path="res://script.gd" id="1"]
[node name="Player" type="CharacterBody3D"]
script = ExtResource("1") # NOT preload()!
Resource Files (.tres) - NO GDScript Syntax:
[ext_resource type="Script" path="res://item.gd" id="1"]
[resource]
script = ExtResource("1") # NOT preload()!
item_name = "Sword" # NOT var item_name = "Sword"!
NEVER use in .tres/.tscn files:
preload() - Use ExtResource("id") insteadvar, const, func - These are GDScript keywordsArray[Type]([...]) syntaxALWAYS use in .tres/.tscn files:
ExtResource("id") for external resourcesSubResource("id") for inline resourcesArray[Resource]([...])Keep logic in .gd files, data in .tres files:
src/
spells/
spell_resource.gd # Class definition + logic
spell_effect.gd # Effect logic
resources/
spells/
fireball.tres # Data only, references scripts
ice_spike.tres # Data only
This makes LLM editing much safer and clearer.
Break functionality into small, focused components:
Player (CharacterBody3D)
├─ HealthAttribute (Node) # Component
├─ ManaAttribute (Node) # Component
├─ Inventory (Node) # Component
└─ StateMachine (Node) # Component
├─ IdleState (Node)
├─ MoveState (Node)
└─ AttackState (Node)
Benefits:
Use signals for loose coupling:
# Component emits signals
signal health_changed(current, max)
signal death()
# Parent connects to signals
func _ready():
$HealthAttribute.health_changed.connect(_on_health_changed)
$HealthAttribute.death.connect(_on_death)
Benefits:
Validate .tres and .tscn files before testing in Godot to catch syntax errors early.
Validate .tres file:
python3 scripts/validate_tres.py resources/spells/fireball.tres
Validate .tscn file:
python3 scripts/validate_tscn.py scenes/player/player.tscn
Use these scripts when:
Load reference files when needed for detailed information:
references/file-formats.md - Deep dive into .gd, .tscn, .tres syntax:
references/architecture-patterns.md - Proven architectural patterns:
Read these references when:
Use templates as starting points for common patterns. Templates are in assets/templates/:
component_template.gd - Base component with signals, exports, activation:
# Copy and customize for new components
cp assets/templates/component_template.gd src/components/my_component.gd
attribute_template.gd - Numeric attribute (health, mana, stamina):
# Use for any numeric attribute with min/max
cp assets/templates/attribute_template.gd src/attributes/stamina_attribute.gd
interaction_template.gd - Interaction component base class:
# Extend for custom interactions (pickup, door, switch, etc.)
cp assets/templates/interaction_template.gd src/interactions/lever_interaction.gd
spell_resource.tres - Example spell with effects:
# Use as reference for creating new spell data
cat assets/templates/spell_resource.tres
item_resource.tres - Example item resource:
# Use as reference for creating new item data
cat assets/templates/item_resource.tres
Example: Adding a health system to enemies.
Steps:
Read architecture patterns reference:
# Check for similar patterns
Read references/architecture-patterns.md
# Look for "Attribute System" section
Create base class using template:
cp assets/templates/attribute_template.gd src/attributes/attribute.gd
# Customize the base class
Create specialized subclass:
# Create health_attribute.gd extending attribute.gd
# Add health-specific signals (damage_taken, death)
Add to scene via .tscn edit:
[ext_resource type="Script" path="res://src/attributes/health_attribute.gd" id="4_health"]
[node name="HealthAttribute" type="Node" parent="Enemy"]
script = ExtResource("4_health")
value_max = 50.0
value_start = 50.0
Test immediately in Godot editor
If issues, validate the scene file:
python3 scripts/validate_tscn.py scenes/enemies/base_enemy.tscn
Example: Creating a new spell.
Steps:
Reference the template:
cat assets/templates/spell_resource.tres
Create new .tres file with proper structure:
[gd_resource type="Resource" script_class="SpellResource" load_steps=3 format=3]
[ext_resource type="Script" path="res://src/spells/spell_resource.gd" id="1"]
[ext_resource type="Script" path="res://src/spells/spell_effect.gd" id="2"]
[sub_resource type="Resource" id="Effect_1"]
script = ExtResource("2")
effect_type = 0
magnitude_min = 15.0
magnitude_max = 25.0
[resource]
script = ExtResource("1")
spell_name = "Fireball"
spell_id = "fireball"
mana_cost = 25.0
effects = Array[ExtResource("2")]([SubResource("Effect_1")])
Validate before testing:
python3 scripts/validate_tres.py resources/spells/fireball.tres
Fix any errors reported by validator
Test in Godot editor
When user reports "resource failed to load" or similar errors.
Steps:
Read the file reported in error:
# Check file syntax
Read resources/spells/problem_spell.tres
Run validation script:
python3 scripts/validate_tres.py resources/spells/problem_spell.tres
Check for common mistakes:
preload() instead of ExtResource()var, const, func keywordsRead file format reference if needed:
Read references/file-formats.md
# Focus on "Resource Files (.tres)" section
# Check "Common Mistakes Reference"
Fix errors and re-validate
When implementing a known pattern (interaction system, state machine, etc.).
Steps:
Read the relevant pattern:
Read references/architecture-patterns.md
# Find the specific pattern (e.g., "Component-Based Interaction System")
Copy relevant template:
cp assets/templates/interaction_template.gd src/interactions/door_interaction.gd
Customize the template:
_perform_interaction()Create scene structure following pattern:
[node name="Door" type="StaticBody3D"]
script = ExtResource("base_interactable.gd")
[node name="DoorInteraction" type="Node" parent="."]
script = ExtResource("door_interaction.gd")
interaction_text = "Open Door"
Test incrementally
Use GUT (Godot Unit Testing) for testing pure logic — any RefCounted or Resource class that doesn't depend on the scene tree is a good candidate. Card systems, scoring, state machines, map generators, challenge logic, etc.
addons/gut/ in your project.gutconfig.json at project root:{
"dirs": ["res://test/unit"],
"prefix": "test_",
"suffix": ".gd",
"log_level": 1
}
Tests live in test/unit/, files prefixed test_, extending GutTest:
extends GutTest
func test_score_calculation() -> void:
var scoring := Scoring.new()
assert_eq(scoring.calculate(3, 0), 100, "Base score for 3 moves")
assert_gt(scoring.calculate(2, 0), scoring.calculate(3, 0), "Fewer moves = higher score")
func test_deck_shuffle() -> void:
var rng := RandomNumberGenerator.new()
rng.seed = 42
var deck := CardSystem.create_shuffled_deck(rng)
assert_eq(deck.size(), 52, "Full deck")
Key conventions:
test__ prefix (not discovered as tests)before_each() / after_each() for setup/teardownassert_eq, assert_ne, assert_true, assert_false, assert_gt, assert_lt, assert_null, assert_not_null# Run all tests (returns exit code 0 on pass, 1 on fail)
godot -d -s --path "$PWD" addons/gut/gut_cmdln.gd -gexit
# Run a specific test file
godot -d -s --path "$PWD" addons/gut/gut_cmdln.gd -gtest=res://test/unit/test_scoring.gd -gexit
# Run tests matching a pattern
godot -d -s --path "$PWD" addons/gut/gut_cmdln.gd -gdir=res://test/unit -gselect=weekly -gexit
Prefer testing pure logic classes that extend RefCounted or Resource:
Avoid testing scene-tree-dependent code in unit tests (rendering, UI, input handling).
Problem:
# ❌ WRONG
script = preload("res://script.gd")
var items = [1, 2, 3]
Solution:
# ✅ CORRECT
[ext_resource type="Script" path="res://script.gd" id="1"]
script = ExtResource("1")
items = Array[int]([1, 2, 3])
Prevention: Run validation script before testing.
Problem:
[resource]
script = ExtResource("1_script") # Not declared!
Solution:
[ext_resource type="Script" path="res://script.gd" id="1_script"]
[resource]
script = ExtResource("1_script")
Detection: Validation script will catch this.
Problem: Modifying instanced scene children can break when editor re-saves.
Solution:
Problem:
effects = [SubResource("Effect_1")] # Missing type
Solution:
effects = Array[Resource]([SubResource("Effect_1")])
Prevention: Validation script warns about this.
Problem: When instancing a scene, forgetting to override child node properties. The instance uses default values (often null), causing silent bugs.
# level.tscn
[node name="KeyPickup" parent="." instance=ExtResource("6_pickup")]
# Oops! PickupInteraction.item_resource is null - pickup won't work!
Solution: Always configure instanced scene properties using the index syntax:
[node name="KeyPickup" parent="." instance=ExtResource("6_pickup")]
[node name="PickupInteraction" parent="KeyPickup" index="0"]
item_resource = ExtResource("7_key")
Detection:
references/file-formats.md "Instance Property Overrides" section for detailsPrevention: After instancing any scene with configurable children (PickupInteraction, DoorInteraction, etc.), always verify critical properties are overridden.
Problem: Setting color_ramp on CPUParticles3D, but particles still appear white or don't show the gradient colors.
[node name="CPUParticles3D" type="CPUParticles3D" parent="."]
mesh = SubResource("SphereMesh_1")
color_ramp = SubResource("Gradient_1") # Gradient is set but doesn't work!
Root Cause: The mesh needs a material with vertex_color_use_as_albedo = true to apply particle colors to the mesh surface.
Solution: Add a StandardMaterial3D to the mesh with vertex color enabled:
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_1"]
vertex_color_use_as_albedo = true
[sub_resource type="SphereMesh" id="SphereMesh_1"]
material = SubResource("StandardMaterial3D_1")
radius = 0.12
height = 0.24
[node name="CPUParticles3D" type="CPUParticles3D" parent="."]
mesh = SubResource("SphereMesh_1")
color_ramp = SubResource("Gradient_1") # Now works!
Prevention: When creating CPUParticles3D with color or color_ramp, always add a material with vertex_color_use_as_albedo = true to the mesh.
When encountering issues, consult the reference documentation:
references/common-pitfalls.md - Common Godot gotchas and solutions:
references/godot4-physics-api.md - Physics API quick reference:
PhysicsRayQueryParameters3D)Load these when:
python3 scripts/validate_tres.py path/to/file.tres
python3 scripts/validate_tscn.py path/to/file.tscn
Don't write components from scratch - adapt templates:
cp assets/templates/component_template.gd src/my_component.gd
When unsure about syntax, load the reference:
Read references/file-formats.md
Prefer signals over direct method calls:
# ✅ Good - Loose coupling
signal item_picked_up(item)
item_picked_up.emit(item)
# ❌ Avoid - Tight coupling
get_parent().get_parent().add_to_inventory(item)
After each change:
Make configuration visible and editable:
@export_group("Movement")
@export var speed: float = 5.0
@export var jump_force: float = 10.0
@export_group("Combat")
@export var damage: int = 10
The godot command-line tool is available for running the game and performing various operations without opening the editor.
Run the current project:
godot --path . --headless
Run a specific scene:
godot --path . --scene scenes/main_menu.tscn
Run with debug flags:
# Show collision shapes
godot --path . --debug-collisions
# Show navigation debug visuals
godot --path . --debug-navigation
# Show path lines
godot --path . --debug-paths
Check GDScript syntax without running:
godot --path . --check-only --script path/to/script.gd
Run headless tests (for automated testing):
godot --path . --headless --quit --script path/to/test_script.gd
Import resources without opening editor:
godot --path . --import --headless --quit
Export project:
# Export release build
godot --path . --export-release "Preset Name" builds/game.exe
# Export debug build
godot --path . --export-debug "Preset Name" builds/game_debug.exe
Workflow: Quick Test Run
# Run the project and quit after testing
godot --path . --quit-after 300 # Runs for 300 frames then quits
Workflow: Automated Resource Import
# Import all resources and exit (useful in CI/CD)
godot --path . --import --headless --quit
Workflow: Script Validation
# Validate a GDScript file before committing
godot --path . --check-only --script src/player/player.gd
Workflow: Headless Server
# Run as dedicated server (no rendering)
godot --path . --headless --scene scenes/multiplayer_server.tscn
--path . when running from project directory to ensure Godot finds project.godot--headless for CI/CD and automated testing (no window, no rendering)--quit or --quit-after N to exit automatically after task completion--check-only with --script to validate GDScript syntax quickly--debug-collisions, --debug-navigation) to visualize systems during development#!/bin/bash
# Validate all changed .gd files before committing
for file in $(git diff --cached --name-only --diff-filter=ACM | grep '\.gd$'); do
if ! godot --path . --check-only --script "$file" --headless --quit; then
echo "GDScript validation failed for $file"
exit 1
fi
done
Writing game logic? → Use .gd file
Storing data (item stats, spell configs)? → Use .tres file
Creating scene structure? → Use .tscn file (prefer Godot editor for complex structures)
In .gd files: Full GDScript - var, func, preload(), etc. ✅
In .tres/.tscn files:
preload() ❌ → Use ExtResource("id") ✅var, const, func ❌ → Just property values ✅[1, 2, 3] ❌ → Array[int]([1, 2, 3]) ✅validate_tres.py - For resource files:
validate_tscn.py - For scene files:
file-formats.md - When:
architecture-patterns.md - When:
Work with Godot projects effectively by:
The key insight: Godot's text-based files are LLM-friendly when you respect the syntax differences between GDScript and resource serialization formats.