Home / Guides / AGENTS.md for Godot 4
AGENTS.md for Godot 4
Short answer: Put an AGENTS.md file next to project.godot and Codex, Cursor, Windsurf and Claude Code (via @AGENTS.md in CLAUDE.md) read it before editing your game. For Godot 4 it should pin typed GDScript and Godot 4 class names, keep the agent to the current task, and ban scene-tree restructuring, raw keycodes and get_parent() chains. The minimal version is below; the full template is further down.
# AGENTS.md (Godot 4) Engine: Godot 4.x, typed GDScript. Use Godot 4 class names only (CharacterBody2D, not KinematicBody2D). - Implement only the current task. Suggest cuts, never additions. - List the scenes/scripts you'll touch first. Never restructure the scene tree without asking. - Every change leaves the game runnable (F5). - Signals up, calls down. No get_parent().get_parent(). - Input via InputMap actions only, never raw keycodes. - Tunables are @export vars; list old -> new values when you change them. - Never edit or commit .godot/.
Point an AI agent at a Godot project and it will happily restructure your scene tree, chain get_parent() calls, hardcode keycodes and quietly "improve" your jump feel. In a 48-hour jam, that's how the build is broken at hour 40.
What AGENTS.md is
AGENTS.md is a plain Markdown file at the repo root that coding agents (Codex, Cursor, Windsurf, Aider, Zed, and Claude Code via an import in CLAUDE.md) read before working. For Godot, put it next to project.godot.
The rules that matter most for games
- Scope is king. The agent implements only the current task and suggests cuts, never additions.
- Always runnable. Every change must leave F5 working.
- Signals up, calls down. This keeps scenes decoupled so the agent can't tangle them.
- Feel numbers are
@export, and every change lists old → new values, so you stay in control of game feel. - InputMap actions only, so gamepad works for free.
Free snippet: copy it
# AGENTS.md (Godot 4)
Game: <<FILL title>>. Genre: <<FILL>>. Jam: <<FILL name, theme, deadline>>. Engine: Godot 4.x, GDScript (typed). Target: <<FILL web/desktop>>.
## Working rules
1. Scope is king. Implement only what's in the current task from TASKS.md. Suggest cuts, never additions.
2. Before coding, list the scenes/scripts you'll touch. Never restructure the scene tree without asking.
3. Every change must leave the game runnable (F5). If a change takes more than 30 minutes, split it.
4. Explain how to test in-editor in 1-3 steps after every change.
## Conventions
- Folders: `scenes/`, `scripts/`, `assets/{sprites,audio,fonts}/`, `autoload/`, `ui/`.
- Files are snake_case; class_name is PascalCase. One script per scene root.
- Static typing everywhere: `var speed: float = 200.0`, typed func signatures, `@export` for tunables.
- Signals up, calls down: children emit signals, parents call methods on children. No `get_parent().get_parent()`.
- Global state only in autoloads: `Game` (state machine, score), `Audio` (SFX/music bus), `Events` (signal bus).
- Input via InputMap actions (`move_left`, `jump`, `action`), never raw keycodes. Support keyboard and gamepad.
- Physics in `_physics_process`, visuals in `_process`. Use `delta`.
- State machines: an enum + match for small actors; node-based states only for the player when there are more than 4 states.
- Tunables (speed, jump, timers) are `@export` vars or live in a `Tuning` resource so they can be tweaked in the inspector.
## Don't
- Don't use `await get_tree().create_timer()` chains for gameplay logic; use a Timer node or state.
- Don't load in `_process`. Preload scenes with `preload()`.
- Don't add plugins/addons without asking.
## Web export
Use the Compatibility renderer for web. Keep total size under 40 MB. Test the exported build in the browser before the deadline, not after.
Godot AGENTS.md FAQ
Where do I put AGENTS.md in a Godot project?
In the folder that holds project.godot (your res:// root), which is usually the repo root. Agents read it from there before touching scripts or scenes.
Does Claude Code read AGENTS.md?
Claude Code reads CLAUDE.md. Add a one-line CLAUDE.md containing @AGENTS.md; Claude Code's memory docs describe this @path import syntax, so both tools share one rules file.
Why does the agent write Godot 3 code like KinematicBody2D?
Many examples online are Godot 3. In Godot 4, KinematicBody2D became CharacterBody2D (see the upgrading to Godot 4 guide). State "Godot 4.x, typed GDScript" in AGENTS.md and tell the agent to use Godot 4 class names only.
Should the agent edit .tscn files directly?
It can, because .tscn is Godot's text scene format, but hand edits to node paths and resource IDs break easily. The snippet above asks the agent to ask before restructuring scenes; prefer changes in scripts and let the editor rewrite the scene.
Should .godot/ be committed?
No. Godot's version control docs say .godot/ stores project cache data and should be added to your VCS ignore. Tell the agent never to edit or commit it.
Want the whole drawer?
The Game Jam Agent Kit ($24) adds scoped Cursor rules for GDScript, player feel and juice, a Phaser/Three.js rule set, 10 prompts along the jam timeline, and GDD + playtest templates.
Not ready for a full pack? One-File Agent Rules ($9) is one universal AGENTS.md with a Godot 4 module built in (static typing, signals up, @export tunables, InputMap input). Or download the free Starter AGENTS.md (no email needed).
14-day refund, no questions.