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`.

Related rules

REST API design AGENTS.md

AGENTS.md for designing consistent HTTP/JSON APIs: resource naming, status codes, errors, pagination, and versioning.

AGENTS.mdAPI design

Git commits & PRs AGENTS.md

AGENTS.md rules for how agents commit: Conventional Commits, atomic changes, safe git commands, and PR descriptions.

AGENTS.mdAgent workflows

CrewAI multi-agent AGENTS.md

AGENTS.md for CrewAI 1.x projects: YAML agents and tasks, crews and flows, tools, and cost-aware runs.

AGENTS.mdLLM apps & agents

Cypress end-to-end testing AGENTS.md

AGENTS.md for Cypress 15 E2E and component tests: selectors, cy.intercept, sessions, and flake-free waits.

AGENTS.mdTesting

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.