Home › Bevy (Rust) › Bevy game engine AGENTS.md

Bevy game engine AGENTS.md

AGENTS.md for Bevy (0.16+) games in Rust: ECS systems, plugins, required components, and fast dev builds.

AGENTS.mdBevy (Rust)

How to use

Save this as AGENTS.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

AGENTS.mdDownload  
# AGENTS.md: Bevy game (Rust)

## Commands
- `cargo run` (dev uses the `dynamic_linking` feature if configured) · `cargo test` · `cargo clippy -- -D warnings` · `cargo fmt --check`
- Check `Cargo.toml` for the exact Bevy version before writing code; Bevy's APIs change between minor releases. Follow that version's migration guide, not older examples.

## ECS rules
- Group features into plugins (`impl Plugin for CombatPlugin`) registered in `main.rs`.
- Data lives in components (small structs with `#[derive(Component)]`); global data in `Resource`s. No game state in statics.
- Spawn with component bundles via required components (`#[require(Transform, Sprite)]`) instead of the deprecated `*Bundle` structs.
- Systems are small functions taking queries: `fn move_player(time: Res<Time>, mut q: Query<&mut Transform, With<Player>>)`. Use `delta_secs()`.
- Order with `.chain()`, `.before()/.after()`, or system sets; run conditionally with `run_if(in_state(GameState::Playing))`.
- Use `States` for menus/game/pause and `OnEnter`/`OnExit` schedules for setup/cleanup.
- Communicate between systems with events/messages or observers, not shared mutable resources everywhere.
- Use `Query::single()` style results and handle the error instead of panicking.
- Load assets via `AssetServer` handles once; don't reload per frame.

## Don't
Don't fight the borrow checker with `unsafe` or by cloning large data each frame; split the query or use `ParamSet`.

More: all Bevy (Rust) rules · all AGENTS.md rules

Related rules

Defold game engine AGENTS.md

AGENTS.md for Defold games in Lua: game objects and components, message passing, script lifecycle, and native extensions.

AGENTS.mdDefold

GameMaker GML AGENTS.md

AGENTS.md for GameMaker (2024+ runtime) projects in GML: objects and events, structs and methods, and clean state.

AGENTS.mdGameMaker

Godot 4 GDScript AGENTS.md

AGENTS.md for Godot 4 projects using typed GDScript, signals and scene composition.

AGENTS.mdGodot

MonoGame AGENTS.md

AGENTS.md for 2D/3D games in C# with MonoGame 3.8: game loop, content pipeline, scenes, and allocation-free updates.

AGENTS.mdMonoGame

Pygame (pygame-ce) AGENTS.md

AGENTS.md for 2D games in Python with pygame-ce 2.5+: game loop, scenes, sprites, assets, and testable logic.

AGENTS.mdPygame

Phaser 3 browser game rules

Windsurf rules for 2D browser games with Phaser 3, TypeScript and Vite.

WindsurfPhaser (web games)

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.