rust-bevy-standards
Skill2 starsChanged 7 months agoMITView on GitHub
Write idiomatic Rust code for applications that use Bevy Engine. Augments rust-standards skill, does not replace it. Use when writing Rust code for a Bevy application.
In this repository23 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- .copilot/copilot-instructions.mdCopilot instructions
- ahaSkill
- explain-prSkill
- fetch-planSkill
- generate-pr-descriptionSkill
- grill-meSkill
- improve-a-planSkill
- improve-codebaseSkill
- persistSkill
- planning-modeSkill
- planningSkill
- research-modeSkill
- review-prSkill
- rust-bevy-test-conventionsSkill
- rust-standardsSkill
- tddSkill
- unslopSkill
- update-agentsSkill
- update-planSkill
- update-skillsSkill
- write-a-skillSkill
- wtfSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 52
Never delete target binaries — Bevy rebuilds take minutes
- Very specific: line 58
Use Changed<T> and Added<T> query filters to skip unchanged components — omitting these is the most common Bevy performance mistake
- Very specific: line 59
Use observers (OnAdd, OnRemove) for component lifecycle reactions.
- Very specific: line 63
No unnecessary abbreviations: position not pos
- Distinctive: line 74
Keep components small and focused.
- Very specific: line 81
All plugin structs must have a /// doc comment explaining their purpose and scope
- Very specific: line 98
Use run conditions (run_if(in_state(...))) to skip whole systems
- Very specific: line 99
Use OnEnter/OnExit schedules for state transitions, not flags checked in Update
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
⚠️ Bevy 0.17+ Breaking Changes
- Material handles wrapped in
MeshMaterial3d<T>, notHandle<T> - Observer pattern replaces event system (
commands.trigger(),add_observer()) Eventsplit intoMessage(buffered) andEvent(observers)EventWriter/EventReaderreplaced byMessageWriter/MessageReader(message.write()/messages.read())Observer trigger API changed:
// Old commands.add_observer(|trigger: Trigger<OnAdd, Player>| { info!("Spawned player {}", trigger.target()); }); // New commands.add_observer(|add: On<Add, Player>| { info!("Spawned player {}", add.entity); });- Color arithmetic removed; use component extraction instead
⚠️ Bevy 0.18+ Breaking Changes
RenderTargetis now a required component onCamera, not aCamerafield:// Old Camera { target: RenderTarget::Image(handle.into()), ..default() } // New commands.spawn((Camera3d::default(), RenderTarget::Image(handle.into())));BorderRadiusis now a field onNode, not a componentLineHeightis now a required component onText/Text2d/TextSpan; removed fromTextFontAmbientLightresource renamed toGlobalAmbientLight;AmbientLightis now a component onCameraclear_children→detach_all_children,remove_children→detach_children,remove_child→detach_child(same onEntityCommandsandEntityWorldMut)AnimationTarget { id, player }replaced by separateAnimationTargetId(id)andAnimatedBy(player_entity)componentsnext_state.set(...)now always firesOnEnter/OnExit; useset_if_neqfor the old behaviourMaterialPluginfieldsprepass_enabled/shadows_enabledreplaced byMaterialtrait methodsenable_prepass()/enable_shadows()SimpleExecutorremoved; useSingleThreadedExecutorinstead#[reflect(...)]now only supports parentheses, not braces or bracketsAssetLoader,AssetSaver,AssetTransformer,Processnow require#[derive(TypePath)]ronno longer re-exported frombevy_sceneorbevy_asset; add it as a direct dependency- Feature renames:
animation→gltf_animation,bevy_sprite_picking_backend→sprite_picking,bevy_ui_picking_backend→ui_picking,bevy_mesh_picking_backend→mesh_picking
General
- Never delete target binaries — Bevy rebuilds take minutes
Footguns
despawn()orphans children, considerdespawn_recursive()instead- Commands are deferred — world mutations apply at end of schedule; don't read back in the same system what you wrote via commands
- Use
Changed<T>andAdded<T>query filters to skip unchanged components — omitting these is the most common Bevy performance mistake - Use observers (
OnAdd,OnRemove) for component lifecycle reactions; don't poll for these inUpdate
Naming
- No unnecessary abbreviations:
positionnotpos - ECS systems: name ends in
_system - Message handlers: name starts with
handle_, ends in_message
ECS
- Think in data (components) and transformations (systems), not objects and methods
- Components = pure data, no logic
- Systems = pure logic, operate on components
- Events/Messages = communication between systems
- Resources = global state; use sparingly
- Keep components small and focused; one large component defeats ECS cache locality
System Design
Plugin structure
- Break the app into discrete modules using plugins
- All plugin structs must have a
///doc comment explaining their purpose and scope
/// Handles damage processing and death detection.
pub struct CombatPlugin;
impl Plugin for CombatPlugin {
fn build(&self, app: &mut App) {
app
.add_event::<DamageEvent>()
.add_systems(Update, (process_damage, check_death));
}
}System sets
- Use run conditions (
run_if(in_state(...))) to skip whole systems - Use
OnEnter/OnExitschedules for state transitions, not flags checked inUpdate
System ordering
.add_systems(
Update,
(
// 1. Input
handle_input,
// 2. State changes
process_events,
update_state,
// 3. Derived values
calculate_derived_values,
// 4. Visuals
update_materials,
update_animations,
// 5. UI (last)
update_ui_displays,
),
)Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

