/bevy-skills:bevy-testingfrom bevy-skills
Provides deterministic testing patterns for Bevy 0.20: clock control, fixed timesteps, async draining, headless worlds, and visual regression capture.
Ships in bevy-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
App harness and direct world assertions.Build the smallest App that owns the behaviour under test, control its clock and
inputs, step it explicitly, then inspect world state or emitted output. Do not call
App::run() in an ordinary unit/integration test.
use bevy::{prelude::*, time::{TimePlugin, TimeUpdateStrategy}};
#[derive(Resource, Default)]
struct TickCount(u32);
fn count_tick(mut count: ResMut<TickCount>) {
count.0 += 1;
}
#[test]
fn fixed_system_runs_exactly_three_times() {
let mut app = App::new();
app.add_plugins(TimePlugin)
.insert_resource(Time::<Fixed>::from_hz(60.0))
.insert_resource(TimeUpdateStrategy::FixedTimesteps(1))
.init_resource::<TickCount>()
.add_systems(FixedUpdate, count_tick);
// The first update initializes Bevy's real-time clock; it has zero delta.
app.update();
for _ in 0..3 {
app.update();
}
assert_eq!(app.world().resource::<TickCount>().0, 3);
}
After the first clock-initialising update, FixedTimesteps(n) makes each
app.update() advance by the fixed timestep times n and run exactly n fixed
loops. Use ManualDuration when the test must exercise zero-tick frames, accumulated
time, or catch-up. Use ManualInstant when exact absolute instants matter and advance
its resource before each update.
app.update() initialises real time with zero delta; warm it up before
counting FixedTimesteps ticks or assert that zero-step frame deliberately.FixedUpdate directly bypasses fixed-main clock/message semantics.Commands are invisible until a synchronization point.DefaultPlugins adds platform/render/audio state most world tests do not need.On<Add, Health>; 0.20 is On<Add<Health>>, and a plain On<Hit> for custom
events. IntoObserverSystem now has three generics, so an "inscrutable" trait error
usually means one generic too many.&mut World is an ordinary SystemParam (0.20). An exclusive test helper no
longer needs a special signature; System::is_exclusive is gone.iter_many yields Result (0.20). Assertions over an entity list need
query.iter_many(ids).matched() for the old skip-missing behaviour.NextState::set_if_neq is set_if_different (0.20). The old name compiles
with a deprecation warning.Name is From<&'static str> only (0.20). Tag test entities with
Name::new(string.to_owned()) when the label is not a literal.Replace became Discard (0.19); Pointer<Click> became
PointerClick (0.20). Observer tests on these names must be renamed.ScheduleBuildSettings::shuffle_seed (0.20, debug feature) randomises
unordered systems per seed. Use it in CI to surface missing .before/.after.app.update() for scheduled behaviour.MessageCursor, or observer effects.Production systems poll Task<T> with block_on(poll_once(&mut task)) (both
re-exported from bevy::tasks) or bevy::tasks::futures::check_ready(&mut task).
Tests should inject a deterministic inline/fake executor when possible. Otherwise step
the app until an observable completion predicate with a strict maximum step/deadline
and fail with queue/task state. Never use "sleep 100 ms and hope the task finished."
Dropping a Bevy Task cancels it unless it was detached. Keep task ownership explicit
and ensure tests cover completion, cancellation, failure, and stale-result paths.
For ECS/gameplay logic, use App::new() plus only required plugins (TimePlugin,
AssetPlugin, TaskPoolPlugin, etc.). Avoid DefaultPlugins when no window,
renderer, audio device, or filesystem is part of the contract. For render acceptance,
launch a real render app, capture a Screenshot, wait for ScreenshotCaptured, and
compare a saved artifact against a versioned baseline with documented tolerance.
| Problem | Read |
|---|---|
| Minimal apps, manual time, fixed loops, schedule stepping | App and time |
| Messages, observers, deferred effects, tasks and no-sleep draining | Messages, observers, and async |
| Screenshot capture, deterministic scenes, diff thresholds and artifacts | Visual regression |
bevy-input-actions — frame-to-fixed input invariants.bevy-physics — Rapier headless and determinism boundaries.bevy-diagnostics-profiling — acceptance replays and performance evidence.bevy-migration-0-19-to-0-20 — observer, iter_many, and state renames.TimeUpdateStrategyTaskWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
bevy, game-testing, deterministic-testing, visual-regression
npx claudepluginhub chrisgliddon/bevy-skills --plugin bevy-skills32 skills in this plugin
/bevyUse when starting any Bevy task, choosing between Update and FixedUpdate, picking Cargo feature flags, or recalling which sibling skill covers ECS, assets, rendering, UI, or migration. Routes to the right Bevy 0.20 skill and pins the engine version for downstream snippets./bevy-a11yUse when designing or auditing high-standard video-game accessibility in Bevy 0.20, integrating screen readers and focus navigation, supporting adaptive controllers and complete remapping, implementing captions or audio description, checking contrast and motion safety, or building disabled-player test evidence./bevy-animationUse when wiring `AnimationPlayer` + `AnimationGraphHandle`, building an `AnimationGraph` from glTF clips, blending state-driven animations with `AnimationTransitions::play`, isolating body parts with `AnimationMask`, firing gameplay sync via `#[derive(AnimationEvent)]` + `On<E>` observers, tweening with `AnimatableCurve` / `EaseFunction` / `CubicSegment::new_bezier_easing` from `bevy::curve`, or applying the 12 Basic Principles of Animation to 3D characters in Bevy 0.20./bevy-assetsUse when loading with `AssetServer::load` or `AssetServer::load_builder().with_settings(..)`, holding a `Handle<T>`, spawning a glTF scene with `WorldAssetRoot` (`Handle<WorldAsset>`), mutating through `Assets::get_mut` / `AssetMut`, polling `LoadState::is_loaded`, resolving an `AssetPath`, or replacing `AssetId::invalid()` with `Option<AssetId<T>>` in Bevy 0.20./bevy-audioUse when implementing audio in Bevy 0.20 with `AudioPlayer`, `PlaybackSettings`, `AudioSink` or `SpatialAudioSink`, spatial listeners, application mix groups, ambience/music transitions, asset lifetime, browser gesture restrictions, or choosing built-in audio versus `bevy_seedling 0.8`./bevy-camerasUse when spawning `Camera3d` or `Camera2d`, choosing a `Projection`, rendering to an image with the `RenderTarget` component, adding `Hdr` / `Tonemapping::Linear` / `ScreenSpaceTransmission` to a camera, wiring `FreeCamera`, `PanCamera` or the new `PanOrbitCamera` from `bevy::camera_controller`, ordering views with `Camera::order`, or setting a per-camera `AmbientLight` in Bevy 0.20.Other plugins' skills for the same job