MR
Mayur Rathi
@mayurrathi
⭐ 40.7k GitHub stars

Bevy Ecs Expert

Bevy Ecs Expert is an code AI skill with a core value of Master Bevy's Entity Component System (ECS) in Rust, covering Systems, Queries, Resources, and parallel scheduling. It helps developers solve real-world problems in the code domain, boosting efficiency, automating repetitive tasks, and optimizing workflows.

Master Bevy's Entity Component System (ECS) in Rust, covering Systems, Queries, Resources, and parallel scheduling.

Last verified on: 2026-07-08

Quick Facts

Category code
Works With Claude
Source sickn33/antigravity-awesome-skills
Stars ⭐ 40.7k
Last Verified 2026-07-08
Risk Level Low
mkdir -p ./skills/bevy-ecs-expert && curl -sfL https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/skills/bevy-ecs-expert/SKILL.md -o ./skills/bevy-ecs-expert/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# Bevy ECS Expert


Overview


A guide to building high-performance game logic using Bevy's data-oriented ECS architecture. Learn how to structure systems, optimize queries, manage resources, and leverage parallel execution.


When to Use This Skill


- Use when developing games with the Bevy engine in Rust.

- Use when designing game systems that need to run in parallel.

- Use when optimizing game performance by minimizing cache misses.

- Use when refactoring object-oriented logic into data-oriented ECS patterns.


Step-by-Step Guide


1. Defining Components


Use simple structs for data. Derive `Component` and `Reflect`.


rust
#[derive(Component, Reflect, Default)]
#[reflect(Component)]
struct Velocity {
    x: f32,
    y: f32,
}

#[derive(Component)]
struct Player;

2. Writing Systems


Systems are regular Rust functions that query components.


rust
fn movement_system(
    time: Res<Time>,
    mut query: Query<(&mut Transform, &Velocity), With<Player>>,
) {
    for (mut transform, velocity) in &mut query {
        transform.translation.x += velocity.x * time.delta_seconds();
        transform.translation.y += velocity.y * time.delta_seconds();
    }
}

3. Managing Resources


Use `Resource` for global data (score, game state).


rust
#[derive(Resource)]
struct GameState {
    score: u32,
}

fn score_system(mut game_state: ResMut<GameState>) {
    game_state.score += 10;
}

4. Scheduling Systems


Add systems to the `App` builder, defining execution order if needed.


rust
fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .init_resource::<GameState>()
        .add_systems(Update, (movement_system, score_system).chain())
        .run();
}

Examples


Example 1: Spawning Entities with Require Component


rust
use bevy::prelude::*;

#[derive(Component, Reflect, Default)]
#[require(Velocity, Sprite)]
struct Player;

#[derive(Component, Default)]
struct Velocity {
    x: f32,
    y: f32,
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    commands.spawn((
        Player,
        Velocity { x: 10.0, y: 0.0 },
        Sprite::from_image(asset_server.load("player.png")), 
    ));
}

Example 2: Query Filters


Use `With` and `Without` to filter entities efficiently.


rust
fn enemy_behavior(
    query: Query<&Transform, (With<Enemy>, Without<Dead>)>,
) {
    for transform in &query {
        // Only active enemies processed here
    }
}

Best Practices


- ✅ **Do:** Use `Query` filters (`With`, `Without`, `Changed`) to reduce iteration count.

- ✅ **Do:** Prefer `Res` over `ResMut` when read-only access is sufficient to allow parallel execution.

- ✅ **Do:** Use `Bundle` to spawn complex entities atomically.

- ❌ **Don't:** Store heavy logic inside Components; keep them as pure data.

- ❌ **Don't:** Use `RefCell` or interior mutability inside components; let the ECS handle borrowing.


Troubleshooting


**Problem:** System panic with "Conflict" error.

**Solution:** You are likely trying to access the same component mutably in two systems running in parallel. Use `.chain()` to order them or split the logic.

🎯 Best For

  • Claude users
  • Software engineers
  • Development teams
  • Tech leads

💡 Use Cases

  • Code quality improvement
  • Best practice enforcement

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Bevy Ecs Expert to Your Work

    Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.

  4. 4

    Review and Refine

    Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.

❓ Frequently Asked Questions

Is Bevy Ecs Expert compatible with Cursor and VS Code?

Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.

Do I need specific dependencies for Bevy Ecs Expert?

Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.

How do I install Bevy Ecs Expert?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/bevy-ecs-expert/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Skipping validation

Always test AI-generated code changes, even for simple refactors.

Missing dependency updates

Check if the skill requires updated dependencies or new packages.

🔗 Related Skills