Godot 4 Guard (no Godot 3 code, no silent script errors)
/godot4-guard
A GameSkill original gate for Godot 4 projects: lints every .gd, .tscn and project.godot for Godot 3 API with the Godot 4 form, auto-fixes the mechanical renames, then has Godot 4 headless load every script and play a scene for N frames, failing on parse errors, SCRIPT ERRORs or a missing expected line even when Godot exits 0.
- 许可证
- MIT
- 出品
- GameSkill 出品
我们测过
在 Godot 4.7.2 (headless import, script load, scene run, Movie Maker) 上通过 25/25 项检查(2026-11-09):能触发、有可运行示例、有截图和自检清单、单一职责、中英文文档齐全。触发检查是把提示词和 skill 描述做匹配,不是真实 agent 运行。
测试报告GameSkill 测过的版本
GameSkill 为 gameskill.dev 原创编写并测过。ZIP 里是完整的 skill:SKILL.md 及中文版、脚本、可运行示例、测试、自检清单和我们的测试报告。
GameSkill 原创,协议 MIT。ZIP 保留 LICENSE 和 CREDITS.md,里面列出了流程灵感来源、CC0 测试素材和第三方库及其协议。

自检清单
- 带 --godot 和 --run 跑,输出 GUARD CLEAN / Run with --godot and --run; it prints GUARD CLEAN
- --expect 是游戏真正正常时才打印的一行 / --expect is a line the game prints only when it really works
- 再跑一次 --fix 不改任何东西 / A second --fix changes nothing
推荐搭配
中文指南
这个 skill 做什么
GameSkill 原创(MIT)。给 Godot 4 项目加一道关卡:逐个检查 .gd、.tscn 和 project.godot 里的 Godot 3 API,并给出 Godot 4 写法;机械性的改名可以自动修;然后让 Godot 4 无界面加载每个脚本、运行场景 N 帧。即使 Godot 以 0 退出,只要出现解析错误、SCRIPT ERROR 或者没打印期望的那一行,就判失败。
什么时候用
- agent 写完或改完 GDScript 之后
- 把 Godot 3 的脚本和场景移植到 Godot 4
- 提交前或 CI 里,抓出"脚本没加载但 Godot 照样退出 0"的问题
怎么装
下载本页的 ZIP,把 godot4-guard/ 文件夹放进 .claude/skills/(Claude Code)或 .agents/skills/(Codex、Cursor),重启 agent。需要 Python 3;解析和运行检查需要 Godot 4.2 以上(只做 lint 不需要)。
最小示例
python3 tools/guard.py example/beacon-keeper --godot "$GODOT" --run res://main.tscn --frames 600 --expect "all 3 beacons lit",输出GUARD CLEAN。- 对
example/godot3-habits再跑一次:15 处 lint 问题,每处带 Godot 4 写法;Godot 4.7 拒绝加载全部 3 个脚本。 - 在副本上跑
--fix:自动改好 10 处,剩下 5 处需要手工改。
我们怎么测的
示例是我们自己做的小项目「灯塔看守」(Beacon Keeper):看守沿路线走,依次点亮三座灯塔。test/run_tests.py 共 12 项检查,用 Godot 4.7.2 跑:干净的项目 lint、解析、600 帧运行和 expect 全部通过;Godot 3 习惯的副本正好 15 处问题、3 个脚本全部解析失败、到不了期望输出;--fix 改写 10 处并且重复运行不再改动;运行时出错的副本 lint 和解析都通过,但 600 帧运行抓到了空节点(Godot 本身退出码是 0);注释和字符串里的旧写法不误报;没有 project.godot 时退出码 2。截图是 Godot Movie Maker 渲染的三座灯塔全亮的画面。结果在 gameskill/test-report.json。
致谢
"给 agent 写的 Godot 4 代码加无界面检查和 3 到 4 迁移"的思路来自 laaielichter 的 Godotwright(MIT,只放链接,没有使用其代码、规则或文字)。规则表、工具、示例和文字都是我们自己的;示例的三个 Godot 4 脚本初稿由 DeepSeek 起草,经我们审查和测试。
搭配
godot-mcp:让 agent 直接操作 Godot 编辑器godot-one-mechanic:一次做好一个玩法glb-godot-acceptance:3D 资产的 Godot 验收
安装
告诉你的 AI
Install the skill from https://gameskill.dev/skills/godot4-guard/install.md
GameSkill 测过的版本
mkdir -p .claude/skills
curl -fsSL https://gameskill.dev/dl/skills/godot4-guard.zip -o /tmp/gameskill-godot4-guard.zip
unzip -oq /tmp/gameskill-godot4-guard.zip -d .claude/skills
rm /tmp/gameskill-godot4-guard.zip包含内容
- tools/guard.py: 22 Godot 3 -> 4 lint rules with the Godot 4 form, --fix for the 13 mechanical ones, headless script load and scene run, --expect, --json
- Beacon Keeper, our own tiny Godot 4 project, a Godot 3 habits copy (15 findings) and a runtime-error copy
- 12 checks in test/run_tests.py, run against Godot 4.7.2
适合
- A gate after an agent writes or edits GDScript
- Porting Godot 3 scripts and scenes to Godot 4
- Pre-commit or CI checks that catch scripts that fail to load while Godot still exits 0
不适合
- Code style or performance review
- C# projects (the lint reads GDScript)
- Unity or Unreal
试试这条提示词
An agent wrote these GDScript files for my Godot 4.4 game. Make sure there is no Godot 3 code left and that the main scene runs 600 frames without errors.关于这个 Skill
A GameSkill original. Coding agents learned GDScript from years of Godot 3 tutorials and keep writing export var, yield, KinematicBody2D and move_and_slide(velocity, Vector2.UP), and Godot exits 0 even when a script fails to load. tools/guard.py lints the project for Godot 3 API with the Godot 4 form for each hit, rewrites the mechanical renames with --fix, then copies the project, imports it with Godot 4 headless, loads every script and plays a scene for N frames. Any parse error, SCRIPT ERROR or missing --expect line fails, with exit codes an agent or CI can use.
Agent steps
- Run the guard after every GDScript change, with
--godot,--runon the main scene and an--expectline the game prints. - Port Godot 3 code with
--fix, then fix the remaining findings by hand. - Report
GUARD CLEANwith the frame count and the expected line.
Common problems it catches
export,onready,yield,setget, stringconnectand other syntax Godot 4 refuses to parse.- Godot 3 node and API names: KinematicBody2D, Spatial, Position2D, move_and_slide with arguments, rand_range, File.new().
- Scripts that parse but fail at runtime, which Godot reports and then exits 0 anyway.
Credits
The idea of headless checks and Godot 3 to 4 migration for agent-written Godot code comes from Godotwright by laaielichter (MIT; link only, no code or text used). The rule table, tools, example and text are ours.
环境要求
- Python 3 standard library; no packages
- Godot 4.2+ (tested on 4.7.2) for the headless parse and run checks; set GODOT or pass --godot
相关主题
常见问题
肉鸽四大底层核心套件 Roguelike Core Kit
4 大零依赖商用肉鸽底层模块一次打包:3 槽受控发牌与稀有保底、确定性节点锁防 SL 刷档、商店递增删牌曲线(MIN_DECK=5 防死循环)与三层渐进式局外解锁引擎(零膨胀 + 3.5 倍初遇加权)。
基于 Godotwright (idea only) (作者 laaielichter,MIT; idea only, no code, rules or text used)的思路。代码和文字由 GameSkill 编写,ZIP 里的 CREDITS.md 列出所有来源。
搭配使用
作者标注的相关 Skills,或更适合相邻任务的 Skills。
Godot MCP (bundled server, run and read errors)
A GameSkill skill that ships the godot-mcp server (Coding-Solo, MIT) pre-built as one Node file, so an agent can drive Godot 4 over MCP: run the game and read its printed output and errors, stop it, launch the editor, create scenes, add nodes, put textures on sprites, export a MeshLibrary and read UIDs. Nothing is installed from npm or GitHub; it needs only Node.js 18+ and Godot 4.
Godot, One Mechanic at a Time (reference folder, grey box, tested mechanics)
A GameSkill original for building a Godot 4 game with an agent in an order that holds up: a reference folder with a style-prompt JSON, a grey box, then one mechanic per prompt in its own script with its own headless playtest, re-running every earlier playtest before the next. Ships templates, checkers for the reference folder and project layout, and a tested 2D example (run and jump, then glide across a gap) whose playtests catch a broken mechanic.
GLB to Godot Acceptance (is this model really done?)
A GameSkill original that decides whether a 3D model is ready for a game: Godot 4 imports the GLB like any file in the project, then checks import errors, triangle budget, size in metres with Y up, origin at the base, materials, colliders, the clips the code plays, a drop test on a floor and runtime errors, with a fix for every failure. Works on any GLB from Blender or an image-to-3D model.
相似 skills
Claude Code Game Studios
Turns Claude Code into a full game studio: 49 agents and 72 workflow skills arranged like a real studio hierarchy.
Godogen
Autonomous game development with Claude Code and Codex. Publishes a ready game repo for Godot, Bevy, Babylon.js or three.js.
Awesome Gamedev Agent Skills
77 portable SKILL.md skills across 12 engines (Godot, Unity, Unreal, Phaser, PixiJS, three.js, Bevy, pygame, LÖVE, Roblox, Defold, Ebitengine), with a router.
pixelfx
244 pixel-art effects written as code (fire, explosions, magic, weather, UI, pickups, critters) plus a draft, render, look, refine loop for making new ones; every effect exports a sprite sheet with Aseprite-style JSON for Godot, Unity, Phaser or any engine.