使用方法
- 复制安装命令,在自己的智能体环境安装前先检查源码包。
- 从原始文档核对所需工具、凭据和支持的宿主。
- 说明输入材料与期望交付物,并对照来源检查输出。
npx skills add https://github.com/ziva-sh/godot-skills --skill godot-verify开始前需了解
- 安装不包含模型订阅、API 额度或访问文件的权限。
- 仓库星数和安装量反映活跃情况,不等于独立质量或安全测试。
按源仓库内容呈现,保留标题、案例、代码、表格、链接以及原文引用的演示图片。
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
godot --headless --path . --check-only --script res://player/player.gdParse 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):
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
doneKnown 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_nameoutside the editor, rungodot --headless --path . --importonce (it also writes.uidfiles and imports assets), or every use reportsCould not find type "MyClass" in the current scope.(in a type annotation) orIdentifier "MyClass" not declared in the current scope.(in an expression). - Autoload names are never resolved. A script that uses an autoload such as
EventsreportsCompile Error: Identifier not found: Eventseven 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 aPackedScene, or$Panel.rect_size) pass with default settings. To make them fail, setdebug/gdscript/warnings/unsafe_method_accessandunsafe_property_accessto Error (2) in a temporaryoverride.cfgin the project root and delete it afterwards. Do not leave them inproject.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
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:
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)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.