Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Structure a Bevy app around its Entity Component System: build the App with plugins, define Component/Resource types, write systems with Query/Res/Commands, filter and order systems, and use the Time resource for frame-rate-independent motion. Use when building or debugging a Bevy game in Rust — when the user mentions Bevy, ECS, App::new, add_systems, Query, Commands, components/systems, or a Cargo.toml depending on bevy.
.claude/skills/gamedev-skills-bevy-ecs/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 67% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 96% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 69% | 0% |
| case-06 | ✓→✓ | = Same ✓ | 50% | 0% |
| case-11 | ✓→✓ | = Same ✓ | 58% | 0% |
Structure a Bevy game in Rust around the Entity Component System: the App and plugins, components and resources, systems with queries, scheduling, and frame-rate-independent updates. New examples target Bevy 0.19. If the project already pins another release, keep that release and use its matching migration guide.
App, defining Component/Resource types, writingsystems that query entities, ordering/filtering systems, or fixing borrow-conflict panics and frame-dependent movement.
Cargo.toml depends on bevy and code calls App::new(),add_systems, Query, or Commands.
When not to use: this is the ECS core. Deep rendering, custom shaders/ pipelines, UI layout, and audio are separate concerns. For engine-agnostic AI or procedural algorithms, pair with game-ai / procedural-gen.
Cargo.toml and Cargo.lock first. For anew project use bevy = "0.19"; never silently migrate an existing project across a Bevy minor release. Treat the matching docs and migration guides as truth.
App. App::new().add_plugins(DefaultPlugins) gives windowing,input, rendering, time, etc. Register systems into schedules: Startup (once) and Update (every frame).
#[derive(Component)] forper-entity data; #[derive(Resource)] for one-of-a-kind data (score, settings, the Time clock). In 0.19 Resource extends Component, so do not derive both.
Query<...>for entities, Res<T>/ResMut<T> for resources, Commands for deferred spawn/despawn. Systems run in parallel when their accesses don't conflict.
time.delta_secs() so speed is frame-rate independent..chain() or explicit constraints;gate systems with run_if. Group related setup into Plugins. Build with cargo run and read the panics — Bevy reports conflicting queries at startup.
toml# Cargo.toml — pin the version; the API differs across minor releases. [dependencies] bevy = "0.19"
rust// main.rs use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) // window, input, render, time, ... .add_systems(Startup, setup) // runs once at startup .add_systems(Update, move_players) // runs every frame .run(); }
rust#[derive(Component)] struct Player; #[derive(Component)] struct Velocity(Vec2); #[derive(Resource)] struct Score(u32); fn setup(mut commands: Commands) { commands.insert_resource(Score(0)); // Camera2d is a component with required components (bundles removed in 0.16); // spawning it pulls in Transform, Camera, etc. automatically. commands.spawn(Camera2d); // Spawn an entity as a tuple of components. commands.spawn(( Player, Velocity(Vec2::new(150.0, 0.0)), Transform::from_xyz(0.0, 0.0, 0.0), )); }
rust// Iterate every entity that has BOTH Velocity and Transform; mutate Transform. fn move_players(time: Res<Time>, mut query: Query<(&Velocity, &mut Transform)>) { for (velocity, mut transform) in &mut query { // delta_secs() is f32 seconds (renamed from delta_seconds() in 0.16). transform.translation += velocity.0.extend(0.0) * time.delta_secs(); } }
rust// Only entities tagged Player (the Player component itself isn't read). fn aim_player(mut q: Query<&mut Transform, With<Player>>) { /* ... */ } // Disjoint two mutable Transform queries so they don't conflict at runtime. fn separate( mut players: Query<&mut Transform, With<Player>>, mut enemies: Query<&mut Transform, Without<Player>>, ) { /* ... */ } // React only when Health changed since last run (change detection). fn on_health_change(q: Query<&Health, Changed<Health>>) { for health in &q { /* update the HUD, etc. */ } }
rustfn add_points(mut score: ResMut<Score>) { score.0 += 10; // ResMut = write access } fn show_score(score: Res<Score>) { info!("score: {}", score.0); // Res = read access }
rustfn main() { App::new() .add_plugins((DefaultPlugins, GameplayPlugin)) // .chain() forces order: damage resolves before death is checked. .add_systems(Update, (apply_damage, check_deaths).chain()) // run_if gates a system on a condition each frame. .add_systems(Update, spawn_wave.run_if(wave_timer_finished)) .run(); } struct GameplayPlugin; impl Plugin for GameplayPlugin { fn build(&self, app: &mut App) { app.insert_resource(Score(0)) .add_systems(Startup, setup) .add_systems(Update, (move_players, add_points)); } }
delta_seconds() not found → it was renamed to time.delta_secs() (andelapsed_secs()) in 0.16. Using the old name fails to compile.
time.delta_secs(). Never assume a fixed frame time.
Querys in onesystem both write the same component, or one reads while another writes overlapping entities. Make them disjoint with With/Without, or use ParamSet.
Camera2dBundle/SpriteBundle not found → bundles were deprecated in 0.15 andremoved in 0.16. Spawn the components directly (Camera2d, Sprite, Transform); required components fill in the rest.
Component is not implemented" → you forgot #[derive(Component)](or #[derive(Resource)] for a resource).
Commands aredeferred and applied at the next sync point. Read the entity in a subsequent system, not the one that spawned it.
If B must follow A, add (A, B).chain() or an explicit ordering constraint.
Resource and Component in 0.19 → Resource now extendsComponent; derive Resource alone to avoid conflicting implementations.
buffered event system became the message system in recent releases. Verify against the docs and migration guide for your pinned version; don't mix versions.
SystemSet ordering, States/OnEnter/OnExit, changedetection, Commands lifecycle and sync points, ParamSet for conflicting queries, and a version note on the events/observers API, read references/queries-and-scheduling.md.
game-ai — FSMs/behavior trees/steering as portable concepts to implement in ECS.procedural-gen — noise/RNG/generation algorithms to drive from systems.pygame-core / love2d-core — lighter-weight engines for smaller projects.| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-06 | pass→pass | 18,581 | 14,207 | -24% | 1 | 1 | 0% | 3,556 | 5,324 | +50% | 0 | 0 | — |
case-11 | pass→pass | 11,182 | 7,233 | -35% | 1 | 1 | 0% | 2,143 | 3,394 | +58% | 0 | 0 | — |
case-01 | fail→pass | 9,993 | 6,344 | -37% | 1 | 1 | 0% | 2,072 | 3,468 | +67% | 0 | 0 | — |
case-02 | pass→pass | 13,373 | 15,170 | +13% | 1 | 1 | 0% | 2,733 | 5,131 | +88% | 0 | 0 | — |
case-03 | pass→pass | 15,578 | 12,180 | -22% | 1 | 1 | 0% | 2,641 | 4,334 | +64% | 0 | 0 | — |
case-04 | pass→pass | 18,481 | 18,654 | +1% | 1 | 1 | 0% | 3,785 | 5,977 | +58% | 0 | 0 | — |
case-05 | pass→pass | 21,710 | 17,571 | -19% | 1 | 1 | 0% | 4,644 | 5,822 | +25% | 0 | 0 | — |
case-07 | pass→pass | 11,672 | 5,888 | -50% | 1 | 1 | 0% | 2,185 | 3,116 | +43% | 0 | 0 | — |
case-08 | pass→pass | 7,973 | 3,976 | -50% | 1 | 1 | 0% | 1,441 | 2,791 | +94% | 0 | 0 | — |
case-09 | pass→pass | 5,287 | 2,539 | -52% | 1 | 1 | 0% | 1,034 | 2,482 | +140% | 0 | 0 | — |
case-10 | fail→pass | 7,619 | 4,045 | -47% | 1 | 1 | 0% | 1,450 | 2,839 | +96% | 0 | 0 | — |
case-12 | pass→pass | 7,577 | 3,342 | -56% | 1 | 1 | 0% | 1,374 | 2,595 | +89% | 0 | 0 | — |
case-13 | pass→pass | 5,536 | 3,690 | -33% | 1 | 1 | 0% | 1,122 | 2,716 | +142% | 0 | 0 | — |
case-14 | fail→pass | 10,553 | 6,595 | -38% | 1 | 1 | 0% | 1,896 | 3,208 | +69% | 0 | 0 | — |
case-15 | pass→pass | 5,480 | 2,717 | -50% | 1 | 1 | 0% | 1,088 | 2,526 | +132% | 0 | 0 | — |
case-16 | pass→pass | 12,807 | 8,431 | -34% | 1 | 1 | 0% | 2,389 | 3,626 | +52% | 0 | 0 | — |
case-17 | pass→pass | 8,302 | 6,293 | -24% | 1 | 1 | 0% | 1,640 | 3,332 | +103% | 0 | 0 | — |
case-18 | pass→pass | 5,555 | 2,737 | -51% | 1 | 1 | 0% | 936 | 2,498 | +167% | 0 | 0 | — |
case-19 | pass→pass | 9,663 | 5,766 | -40% | 1 | 1 | 0% | 1,913 | 3,145 | +64% | 0 | 0 | — |
case-20 | pass→pass | 12,041 | 7,979 | -34% | 1 | 1 | 0% | 2,307 | 3,619 | +57% | 0 | 0 | — |
case-21 | pass→pass | 9,744 | 7,986 | -18% | 1 | 1 | 0% | 1,668 | 3,433 | +106% | 0 | 0 | — |
case-22 | pass→pass | 4,738 | 2,571 | -46% | 1 | 1 | 0% | 743 | 2,487 | +235% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +14 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
| Model | Method | Date | Lift |
|---|---|---|---|
| gemini-3.6-flash | verified | 8/2/2026 | +9% |
Other measured skills in the registry, with their headline benchmark lift.