Claude Code for Game Dev: CLAUDE.md Templates for Unity and Godot
Published Oct 21, 2026 · 5 min read
Claude Code is good at game code and bad at game projects. It will happily write a C# controller or a GDScript state machine, then move an asset without its .meta file, rewrite a scene file by hand, or wander into a cache folder with thousands of generated files. The fix is a short CLAUDE.md at the project root that tells it where the danger is. Below are two copy-paste templates, one for Unity and one for Godot 4, and the reasoning behind each rule.
Unity CLAUDE.md template
# CLAUDE.md (Unity project)
## Project
- Unity version: see ProjectSettings/ProjectVersion.txt. Don't upgrade it.
- Game code lives in Assets/Scripts/. Tests live in Assets/Tests/.
## Never touch
- Library/, Temp/, Obj/, Logs/, UserSettings/ are generated. Don't read or edit them.
- Every asset has a .meta file with its GUID. When you move, rename or delete an
asset, do the same to its .meta file, and never invent or change a GUID.
- Don't hand-edit .unity, .prefab or .asset YAML. Ask me to make scene and prefab
changes in the Editor, and tell me exactly what to change.
## Code style
- C#: one MonoBehaviour per file, file name = class name.
- Use [SerializeField] private fields, not public fields, for inspector values.
- No allocations or GetComponent/Find calls inside Update(); cache in Awake().
## Tests
- Run EditMode tests from the CLI (close the Editor first):
Unity -batchmode -projectPath . -runTests -testPlatform EditMode -testResults results.xml
- A task is done when tests pass and there are no new compiler warnings.
Why these Unity rules matter
- .meta files and GUIDs. Unity tracks every asset by the GUID in its
.metafile, and scenes and prefabs reference assets by that GUID. Move an asset without its.metaand every reference to it breaks, often silently. - Generated folders.
Library/andTemp/are rebuilt by the Editor and can be huge. Telling Claude to skip them saves context and stops pointless edits. - Scene and prefab YAML. These files are text, but they're full of file IDs that are easy to corrupt. Let Claude write the code and give you Editor steps for the wiring.
- Batch-mode tests. The Unity Test Framework runs from the command line with
-batchmode -runTests, which gives Claude a real definition of done instead of "it compiles".
Godot 4 CLAUDE.md template
# CLAUDE.md (Godot 4 project)
## Project
- Godot 4.x, GDScript. Entry scene is set in project.godot. Don't change engine settings.
- Scripts live next to their scenes. Autoloads are listed in project.godot.
## Never touch
- .godot/ is the editor cache. Don't read or edit it.
- Commit and keep *.import files and *.uid files next to their assets. If you move or
rename a resource, move its .import/.uid file with it.
- Prefer editing .gd scripts. Only edit .tscn/.tres text when the change is small and
you keep every ext_resource id and uid intact.
## Code style
- Use static typing: var speed: float = 200.0, func move(delta: float) -> void.
- Signals over get_node() chains across scenes. Use @onready for node references.
- snake_case for files, functions and variables; PascalCase for class_name.
## Tests
- Tests use GUT in addons/gut/. Run them headless:
godot --headless -s addons/gut/gut_cmdln.gd -gexit
- A task is done when tests pass and the project opens with no script errors.
Why these Godot rules matter
- .godot/ is a cache. Godot 4 rebuilds it, so it belongs in
.gitignoreand out of Claude's way. - .import and .uid files. These sit next to your assets and scripts and are part of the project. Losing them breaks imports and references.
- .tscn files are friendlier than Unity YAML, so small text edits are fine, but resource ids must stay consistent.
- Static typing catches mistakes at parse time, which helps an agent notice its own errors faster.
Tips that work in both engines
- Keep the file short. Every line is loaded into every session, so move long procedures into skills or slash commands.
- Back the "never touch" rules with a PreToolUse hook so they're enforced, not just requested.
- Work one milestone at a time and commit after each, so a bad edit is one
git revertaway. - Using Cursor too? Our Cursor Rules Pack includes Godot and Unity rules.
FAQ
Can Claude Code make a Unity or Godot game?
Yes, for the code. Claude Code reads and writes C# and GDScript and can run tests from the command line. Scene, prefab and asset work is safer done in the editor, so a good CLAUDE.md tells Claude to describe those changes for you instead of editing the files.
Why does Claude Code break Unity .meta files?
Each Unity asset has a .meta file holding its GUID, and other assets reference it by that GUID. If an agent moves or deletes an asset without its .meta file, or writes a new GUID, references break. Put the .meta rule in CLAUDE.md.
Which Godot folders should Claude ignore?
The .godot/ folder is Godot 4's editor cache and should be ignored and kept out of git. Keep *.import and *.uid files, since they belong to your assets.
Should I use AGENTS.md instead of CLAUDE.md for a game project?
If you also use Cursor or Codex, put the rules in AGENTS.md and start CLAUDE.md with @AGENTS.md so Claude Code imports it. Our AGENTS.md guide shows the setup.