ziva-sh/godot-skills

godot-verify

Verifies GDScript and scenes with the Godot 4 command line instead of trusting that code looks right - parse-checking scripts with --check-only, running a scene headless with --quit-after, writing a SceneTree test script with an exit code, and reading the o…

Zobacz źródło

Jak używać

  1. Skopiuj polecenie instalacji i sprawdź źródła przed instalacją we własnym środowisku agenta.
  2. W oryginale sprawdź wymagane narzędzia, dane dostępowe i obsługiwane środowiska.
  3. Opisz dane wejściowe i oczekiwany rezultat; porównaj wynik ze źródłami.
npx skills add https://github.com/ziva-sh/godot-skills --skill godot-verify

Przed rozpoczęciem

  • Instalacja nie obejmuje subskrypcji modelu, limitu API ani uprawnień do plików.
  • Gwiazdki i instalacje pokazują aktywność, a nie niezależny test jakości lub bezpieczeństwa.
Oryginalny dokument Skill

Treść z repozytorium z zachowaniem nagłówków, przykładów, kodu, tabel, linków i obrazów.

Verifying Godot 4 changes from the command line

Reading code is not verification. Run the engine and read what it prints. Use the Godot 4 editor binary the project targets (often godot on PATH); the commands below use godot and run from the project root (the folder with project.godot). --headless needs no display or GPU.

1. Parse-check each changed script

bash
godot --headless --path . --check-only --script res://player/player.gd

Parse errors print as SCRIPT ERROR: Parse Error: <message> followed by at: GDScript::reload (res://player/player.gd:<line>), and the exit code is 1. A clean script prints only the version banner.

Check every new or modified script in a git checkout, staged or not, in one go (from the project root; paths with spaces need a different loop):

bash
for f in $( { git diff --name-only --relative --diff-filter=d HEAD -- '*.gd'; git ls-files --others --exclude-standard -- '*.gd'; } | sort -u); do
  out=$(godot --headless --path . --check-only --script "res://$f" 2>&1)
  if echo "$out" | grep -q 'ERROR'; then echo "== $f"; echo "$out" | grep -A1 'ERROR'; fi
done

Known limits of --check-only:

  • `class_name` types from other files are unknown until the editor has scanned the project. In a fresh clone or after adding a class_name outside the editor, run godot --headless --path . --import once (it also writes .uid files and imports assets), or every use reports Could not find type "MyClass" in the current scope. (in a type annotation) or Identifier "MyClass" not declared in the current scope. (in an expression).
  • Autoload names are never resolved. A script that uses an autoload such as Events reports Compile Error: Identifier not found: Events even though the game runs. Verify those scripts by running a scene (step 2).
  • Members missing on other objects' classes (for example Godot 3's scene.instance() on a PackedScene, or $Panel.rect_size) pass with default settings. To make them fail, set debug/gdscript/warnings/unsafe_method_access and unsafe_property_access to Error (2) in a temporary override.cfg in the project root and delete it afterwards. Do not leave them in project.godot: they turn every untyped call into a parse error. See the godot-4-api-pitfalls skill.

2. Run the scene and read the output

bash
timeout 60 godot --headless --path . --quit-after 300 res://levels/level_1.tscn 2>&1 | tee run.log
grep -nE 'SCRIPT ERROR|ERROR:|WARNING:' run.log

--quit-after N stops after N frames; timeout guards against a scene that blocks. Omit the scene path to run the project's main scene.

The exit code is 0 even when scripts fail. A null access (SCRIPT ERROR: Cannot call method 'queue_free' on a null value.) and even a parse error in an attached script (Failed to load script ... with error "Parse error") both end with exit code 0. Always grep the output. A runtime error aborts the rest of that function, so missing print() output after an error is expected, not a second bug.

3. Test behaviour with a script that sets the exit code

For logic you can check without rendering, write a throwaway test that extends SceneTree and calls quit(1) on failure:

gdscript
extends SceneTree


func _init() -> void:
	# Autoloads are added after _init(), so do the work on the first frame.
	_run.call_deferred()


func _run() -> void:
	var failures := 0
	var scene := load("res://player/player.tscn") as PackedScene
	if scene == null:
		printerr("FAIL: player scene did not load")
		failures += 1
	else:
		var player := scene.instantiate()
		root.add_child(player)
		await process_frame
		if not player.has_method("take_damage"):
			printerr("FAIL: player has no take_damage()")
			failures += 1
		player.queue_free()
	print("failures: ", failures)
	quit(1 if failures else 0)
bash
godot --headless --path . --script res://tests/test_player.gd; echo "exit=$?"

Here the exit code is meaningful because the script sets it, but still read the output for SCRIPT ERROR lines from the code under test.

What headless runs cannot show

Headless runs check logic, signals, physics and errors. They do not show what the screen looks like: UI that is cut off, wrong colours or a camera in the wrong place need a real window or a screenshot from a non-headless run. Say so when reporting, instead of claiming a visual change works.

Report honestly

When you report back, include the commands you ran and the relevant output lines. "No ERROR lines in a 300-frame run of level_1.tscn" is evidence; "the code looks correct" is not.

z tego samego repozytorium

Więcej Skills

Wszystkie Skills
ziva-sh
Społeczność

godot-4-api-pitfalls

Fixes Godot 3 APIs and GDScript syntax that AI assistants write into Godot 4 projects, such as KinematicBody2D, moveandslide(velocity), export, onready, setget, yield, string connect(), instance(), randrange, the Tween node, File, changescene, Spatial, rect properties, PoolArray, OS time functions and the old TileMap API. Use when writing, reviewing or porting GDScript for Godot 4.x, when a script fails with "not declared", "not found in base", "was removed in Godot 4" or "is not present on the

Instalacje / 1h
1
GitHub Stars
0
Aktualizacja
11 lis
ziva-sh
Społeczność

godot-control-layout

Builds Godot 4 Control UIs that resize instead of clipping or overlapping - containers versus anchors, anchor presets from code, size flags, customminimumsize, MarginContainer margins, Label wrapping, mousefilter, CanvasLayer HUDs, Godot 4 theme override names (addthemecoloroverride and friends) and the display/window/stretch settings for multiple resolutions. Use when creating or fixing menus, HUDs, dialogs and inventory screens, when UI elements are cut off, zero-sized, overlapping, ignoring p

Instalacje / 1h
1
GitHub Stars
0
Aktualizacja
11 lis
ziva-sh
Społeczność

godot-scene-organization

Structures Godot 4 projects so scenes stay reusable and references do not break - when to make a scene, a script or a Resource, instancing with @export PackedScene, preload and load, @onready and %UniqueName node access, ready order, groups, autoloads, classname, and resource UIDs with the .uid files added in Godot 4.4, including how to move or rename files safely. Use when creating new scenes or scripts, deciding how nodes find each other, adding global state or an event bus, moving or renaming

Instalacje / 1h
1
GitHub Stars
0
Aktualizacja
11 lis
ziva-sh
Społeczność

godot-signals

Godot 4 signal patterns and their failure modes - declaring typed signals, emit(), connect() and disconnect() with Callables, bind() and unbind(), lambdas, CONNECTONESHOT and CONNECTDEFERRED, await on signals and timers, editor-made connections stored in .tscn files, and the call down, signal up rule. Use when wiring UI buttons, timers, Area2D or body events and custom game events, when replacing Godot 3 connect("signal", self, "method") or yield code, or when debugging "already connected", "Met

Instalacje / 1h
1
GitHub Stars
0
Aktualizacja
11 lis