[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CRZZY25VEHHTXP6YM10C2T":3,"skill-same:01M7CRZZY25VEHHTXP6YM10C2T":50},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":32,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M7CRZZY25VEHHTXP6YM10C2T","bevy-ecs-patterns",null,"Use when writing Bevy (Rust ECS) game code - pin and respect the repo's minor version, plugins\u002Fsystems\u002Fqueries\u002Fresources, schedules with FixedUpdate and Time, states and run conditions, messages vs observers across versions, required components, testing systems with App::update and a manual time strategy, compile-time and allocation hygiene.","makifbaysal\u002Ftasktrooper","makifbaysal","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F25031940?v=4","01M7CRG3ZCSYZSSEVDMW3DEYC8","Mehmet Akif Baysal","01M7CRG401FJ8YAXH5ER730XYV",122,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fgame-developer\u002Fskills\u002Fbevy-ecs-patterns\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bevy-ecs-patterns\ncategory: architecture\ndescription: Use when writing Bevy (Rust ECS) game code - pin and respect the repo's minor version, plugins\u002Fsystems\u002Fqueries\u002Fresources, schedules with FixedUpdate and Time, states and run conditions, messages vs observers across versions, required components, testing systems with App::update and a manual time strategy, compile-time and allocation hygiene.\ntech_stack: Bevy\nsource: informed by the Bevy documentation, examples and per-release migration guides; own wording\n---\n# Bevy ECS Patterns\n\n## Overview\n\nBevy is a code-first Rust engine built on an ECS: entities are IDs, components are plain structs, systems are ordinary functions whose parameters declare the data they touch, and the scheduler runs them in parallel where it can. Bevy also ships a breaking release every few months — the API you remember may not be the API the repository pins.\n\n**Core principle:** The repository's pinned Bevy minor is the API. Systems are small functions over queries, simulation runs in `FixedUpdate`, and every system is testable by building an `App` and calling `update()`.\n\n## Version first\n\n```toml\n# Cargo.toml — for 0.x crates \"0.18\" already means >=0.18.0, \u003C0.19.0: the minor is pinned\nbevy = \"0.18\"\n```\n\nRead `Cargo.lock` for the resolved version and that version's migration guide before writing code. Never bump the minor in a feature task. Changes that bite code written from memory:\n\n| Since | Change |\n|---|---|\n| 0.15 | `Time::delta_seconds()` → `delta_secs()`; required components (`#[require(...)]`) replace most bundles; `Single\u003C...>` system parameter |\n| 0.16 | `Query::single()` \u002F `get_single()` return `Result`; systems may return `Result` and use `?` |\n| 0.17 | Buffered events renamed to **messages**: `#[derive(Message)]`, `MessageWriter::write`, `MessageReader::read`, `app.add_message::\u003CT>()`; observers use `On\u003CT>` for entity events |\n\n## Plugins, components, systems\n\n```rust\nuse bevy::prelude::*;\n\n#[derive(Component, Default)]\n#[require(Transform, Velocity)]\npub struct Player;\n\n#[derive(Component, Default, Deref, DerefMut)]\npub struct Velocity(pub Vec2);\n\n#[derive(Resource)]\npub struct MoveTuning { pub speed: f32 }\n\n#[derive(Message)]\npub struct PlayerHit { pub damage: u32 }\n\npub struct MovementPlugin;\n\nimpl Plugin for MovementPlugin {\n    fn build(&self, app: &mut App) {\n        app.insert_resource(MoveTuning { speed: 220.0 })\n            .insert_resource(Time::\u003CFixed>::from_hz(60.0))\n            .add_message::\u003CPlayerHit>()\n            .add_systems(Update, read_input.run_if(in_state(GameState::Playing)))\n            .add_systems(FixedUpdate, (apply_velocity, resolve_hits).chain());\n    }\n}\n\nfn read_input(keys: Res\u003CButtonInput\u003CKeyCode>>, tuning: Res\u003CMoveTuning>, mut player: Single\u003C&mut Velocity, With\u003CPlayer>>) {\n    let x = keys.pressed(KeyCode::KeyD) as i8 as f32 - keys.pressed(KeyCode::KeyA) as i8 as f32;\n    player.0 = Vec2::new(x * tuning.speed, player.0.y);\n}\n\nfn apply_velocity(time: Res\u003CTime>, mut q: Query\u003C(&mut Transform, &Velocity)>) {\n    for (mut t, v) in &mut q {\n        t.translation += (v.0 * time.delta_secs()).extend(0.0);   \u002F\u002F in FixedUpdate, Time is the fixed clock\n    }\n}\n```\n\n- One plugin per feature; `main.rs` only adds plugins.\n- Systems are small and named for what they do; order with `.chain()`, `.before()\u002F.after()` or `SystemSet`s, not by hoping.\n- Read input in `Update`, simulate in `FixedUpdate` (default 64 Hz; set it explicitly), render-side smoothing in `Update`\u002F`PostUpdate` (game-loop-and-time).\n- `Commands` are deferred: an entity spawned in a system is visible to queries only after the command flush (the next sync point), not later in the same system.\n- Use change detection (`Changed\u003CT>`, `Added\u003CT>`, `Ref\u003CT>::is_changed`) instead of recomputing every frame; filter queries (`With`, `Without`) so systems touch only what they need.\n- `Res\u003CT>` reads run in parallel; `ResMut\u003CT>` serialises every system that touches `T` — keep shared mutable resources few.\n- Tuning values in resources or assets loaded from RON\u002FJSON (data-driven-gameplay-design), not literals in systems.\n\n## States and conditions\n\n```rust\n#[derive(States, Default, Debug, Clone, PartialEq, Eq, Hash)]\npub enum GameState { #[default] Loading, Menu, Playing, Paused }\n\napp.init_state::\u003CGameState>()\n   .add_systems(OnEnter(GameState::Playing), spawn_level)\n   .add_systems(OnExit(GameState::Playing), despawn_level);\n```\n\nEntities spawned for a state are cleaned up on exit (a marker component plus a despawn system, or the state-scoped entity helpers of the pinned version).\n\n## Testing systems\n\n```rust\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use bevy::time::TimeUpdateStrategy;\n    use std::time::Duration;\n\n    fn app() -> App {\n        let mut app = App::new();\n        app.add_plugins(MinimalPlugins)\n            .insert_resource(TimeUpdateStrategy::ManualDuration(Duration::from_secs_f64(1.0 \u002F 60.0)))\n            .insert_resource(Time::\u003CFixed>::from_hz(60.0))\n            .add_systems(FixedUpdate, apply_velocity);\n        app.update();                     \u002F\u002F the first update has zero delta; prime the clock\n        app\n    }\n\n    #[test]\n    fn moves_by_speed_times_elapsed_time() {\n        let mut app = app();\n        let e = app.world_mut().spawn((Transform::default(), Velocity(Vec2::new(60.0, 0.0)))).id();\n        for _ in 0..60 { app.update(); }\n        let x = app.world().get::\u003CTransform>(e).unwrap().translation.x;\n        assert!((x - 60.0).abs() \u003C 1.5, \"x = {x}\");\n    }\n}\n```\n\n- `MinimalPlugins` gives time and the schedule runner without a window or GPU — runs anywhere `cargo test` runs.\n- Control time with `TimeUpdateStrategy::ManualDuration`; never sleep.\n- Send messages in a test through the world (`write_message` on the pinned version, `send_event` before 0.17) and read results back with queries or a resource.\n- `world.run_system_once(my_system)` for a one-off system call in a test.\n- Pure math (damage, steering) as plain functions with ordinary unit tests.\n\n## Build hygiene\n\n- `cargo test && cargo clippy -- -D warnings` before hand-off (rule game-build-check); Bevy projects commonly allow `clippy::too_many_arguments` and `clippy::type_complexity` — follow the repository's lint config.\n- Fast iteration: `opt-level = 1` for the crate and `opt-level = 3` for dependencies in `[profile.dev]`\u002F`[profile.dev.package.\"*\"]`; the `dynamic_linking` feature only in dev, never in release builds.\n- First compile takes minutes: give `run_terminal` a long timeout or run it detached to a log.\n- Allocation in hot systems: reuse buffers with `Local\u003CVec\u003CT>>` instead of collecting into a new `Vec` every frame.\n- Headless runs: `MinimalPlugins` + `ScheduleRunnerPlugin`, or `DefaultPlugins` with no primary window; screenshots need a GPU and a window (game-visual-self-review).\n\n## Common Mistakes\n\n- Code from an older or newer Bevy version (`delta_seconds`, `EventWriter`, `get_single`) that does not compile on the pinned one.\n- Movement in `Update` with `Time` and physics in `Update` — frame-rate dependent.\n- Expecting a just-spawned entity in the same system's query.\n- One giant system per feature with `ResMut` on everything, killing parallelism.\n- Bumping Bevy \"while here\".\n\n## Red Flags\n\n- `bevy = \"*\"`, a `>=` range, or a version change in `Cargo.toml` the task did not ask for.\n- `std::thread::sleep` or `Instant::now()` inside systems or tests.\n- A system test that opens a window.\n","# Bevy ECS Patterns\n\n## Overview\n\nBevy is a code-first Rust engine built on an ECS: entities are IDs, components are plain structs, systems are ordinary functions whose parameters declare the data they touch, and the scheduler runs them in parallel where it can. Bevy also ships a breaking release every few months — the API you remember may not be the API the repository pins.\n\n**Core principle:** The repository's pinned Bevy minor is the API. Systems are small functions over queries, simulation runs in `FixedUpdate`, and every system is testable by building an `App` and calling `update()`.\n\n## Version first\n\n```toml\n# Cargo.toml — for 0.x crates \"0.18\" already means >=0.18.0, \u003C0.19.0: the minor is pinned\nbevy = \"0.18\"\n```\n\nRead `Cargo.lock` for the resolved version and that version's migration guide before writing code. Never bump the minor in a feature task. Changes that bite code written from memory:\n\n| Since | Change |\n|---|---|\n| 0.15 | `Time::delta_seconds()` → `delta_secs()`; required components (`#[require(...)]`) replace most bundles; `Single\u003C...>` system parameter |\n| 0.16 | `Query::single()` \u002F `get_single()` return `Result`; systems may return `Result` and use `?` |\n| 0.17 | Buffered events renamed to **messages**: `#[derive(Message)]`, `MessageWriter::write`, `MessageReader::read`, `app.add_message::\u003CT>()`; observers use `On\u003CT>` for entity events |\n\n## Plugins, components, systems\n\n```rust\nuse bevy::prelude::*;\n\n#[derive(Component, Default)]\n#[require(Transform, Velocity)]\npub struct Player;\n\n#[derive(Component, Default, Deref, DerefMut)]\npub struct Velocity(pub Vec2);\n\n#[derive(Resource)]\npub struct MoveTuning { pub speed: f32 }\n\n#[derive(Message)]\npub struct PlayerHit { pub damage: u32 }\n\npub struct MovementPlugin;\n\nimpl Plugin for MovementPlugin {\n    fn build(&self, app: &mut App) {\n        app.insert_resource(MoveTuning { speed: 220.0 })\n            .insert_resource(Time::\u003CFixed>::from_hz(60.0))\n            .add_message::\u003CPlayerHit>()\n            .add_systems(Update, read_input.run_if(in_state(GameState::Playing)))\n            .add_systems(FixedUpdate, (apply_velocity, resolve_hits).chain());\n    }\n}\n\nfn read_input(keys: Res\u003CButtonInput\u003CKeyCode>>, tuning: Res\u003CMoveTuning>, mut player: Single\u003C&mut Velocity, With\u003CPlayer>>) {\n    let x = keys.pressed(KeyCode::KeyD) as i8 as f32 - keys.pressed(KeyCode::KeyA) as i8 as f32;\n    player.0 = Vec2::new(x * tuning.speed, player.0.y);\n}\n\nfn apply_velocity(time: Res\u003CTime>, mut q: Query\u003C(&mut Transform, &Velocity)>) {\n    for (mut t, v) in &mut q {\n        t.translation += (v.0 * time.delta_secs()).extend(0.0);   \u002F\u002F in FixedUpdate, Time is the fixed clock\n    }\n}\n```\n\n- One plugin per feature; `main.rs` only adds plugins.\n- Systems are small and named for what they do; order with `.chain()`, `.before()\u002F.after()` or `SystemSet`s, not by hoping.\n- Read input in `Update`, simulate in `FixedUpdate` (default 64 Hz; set it explicitly), render-side smoothing in `Update`\u002F`PostUpdate` (game-loop-and-time).\n- `Commands` are deferred: an entity spawned in a system is visible to queries only after the command flush (the next sync point), not later in the same system.\n- Use change detection (`Changed\u003CT>`, `Added\u003CT>`, `Ref\u003CT>::is_changed`) instead of recomputing every frame; filter queries (`With`, `Without`) so systems touch only what they need.\n- `Res\u003CT>` reads run in parallel; `ResMut\u003CT>` serialises every system that touches `T` — keep shared mutable resources few.\n- Tuning values in resources or assets loaded from RON\u002FJSON (data-driven-gameplay-design), not literals in systems.\n\n## States and conditions\n\n```rust\n#[derive(States, Default, Debug, Clone, PartialEq, Eq, Hash)]\npub enum GameState { #[default] Loading, Menu, Playing, Paused }\n\napp.init_state::\u003CGameState>()\n   .add_systems(OnEnter(GameState::Playing), spawn_level)\n   .add_systems(OnExit(GameState::Playing), despawn_level);\n```\n\nEntities spawned for a state are cleaned up on exit (a marker component plus a despawn system, or the state-scoped entity helpers of the pinned version).\n\n## Testing systems\n\n```rust\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use bevy::time::TimeUpdateStrategy;\n    use std::time::Duration;\n\n    fn app() -> App {\n        let mut app = App::new();\n        app.add_plugins(MinimalPlugins)\n            .insert_resource(TimeUpdateStrategy::ManualDuration(Duration::from_secs_f64(1.0 \u002F 60.0)))\n            .insert_resource(Time::\u003CFixed>::from_hz(60.0))\n            .add_systems(FixedUpdate, apply_velocity);\n        app.update();                     \u002F\u002F the first update has zero delta; prime the clock\n        app\n    }\n\n    #[test]\n    fn moves_by_speed_times_elapsed_time() {\n        let mut app = app();\n        let e = app.world_mut().spawn((Transform::default(), Velocity(Vec2::new(60.0, 0.0)))).id();\n        for _ in 0..60 { app.update(); }\n        let x = app.world().get::\u003CTransform>(e).unwrap().translation.x;\n        assert!((x - 60.0).abs() \u003C 1.5, \"x = {x}\");\n    }\n}\n```\n\n- `MinimalPlugins` gives time and the schedule runner without a window or GPU — runs anywhere `cargo test` runs.\n- Control time with `TimeUpdateStrategy::ManualDuration`; never sleep.\n- Send messages in a test through the world (`write_message` on the pinned version, `send_event` before 0.17) and read results back with queries or a resource.\n- `world.run_system_once(my_system)` for a one-off system call in a test.\n- Pure math (damage, steering) as plain functions with ordinary unit tests.\n\n## Build hygiene\n\n- `cargo test && cargo clippy -- -D warnings` before hand-off (rule game-build-check); Bevy projects commonly allow `clippy::too_many_arguments` and `clippy::type_complexity` — follow the repository's lint config.\n- Fast iteration: `opt-level = 1` for the crate and `opt-level = 3` for dependencies in `[profile.dev]`\u002F`[profile.dev.package.\"*\"]`; the `dynamic_linking` feature only in dev, never in release builds.\n- First compile takes minutes: give `run_terminal` a long timeout or run it detached to a log.\n- Allocation in hot systems: reuse buffers with `Local\u003CVec\u003CT>>` instead of collecting into a new `Vec` every frame.\n- Headless runs: `MinimalPlugins` + `ScheduleRunnerPlugin`, or `DefaultPlugins` with no primary window; screenshots need a GPU and a window (game-visual-self-review).\n\n## Common Mistakes\n\n- Code from an older or newer Bevy version (`delta_seconds`, `EventWriter`, `get_single`) that does not compile on the pinned one.\n- Movement in `Update` with `Time` and physics in `Update` — frame-rate dependent.\n- Expecting a just-spawned entity in the same system's query.\n- One giant system per feature with `ResMut` on everything, killing parallelism.\n- Bumping Bevy \"while here\".\n\n## Red Flags\n\n- `bevy = \"*\"`, a `>=` range, or a version change in `Cargo.toml` the task did not ask for.\n- `std::thread::sleep` or `Instant::now()` inside systems or tests.\n- A system test that opens a window.\n",{"name":5,"source":24,"category":25,"tech_stack":26,"description":7},"informed by the Bevy documentation, examples and per-release migration guides; own wording","architecture","Bevy","main","910394a0b6db9fc8c9a8f36328ec421d3ebd8b38","catalog\u002Fagents\u002Fgame-developer\u002Fskills\u002Fbevy-ecs-patterns",18,"https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper","https:\u002F\u002Ftasktrooper.ai","https:\u002F\u002Fgithub.com\u002Fmakifbaysal","Senior Software Developer","2026-11-15 04:50:29",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add makifbaysal\u002Ftasktrooper --skill bevy-ecs-patterns",{"tool":42,"command":43},"bunx","bunx skills add makifbaysal\u002Ftasktrooper --skill bevy-ecs-patterns",{"tool":45,"command":46},"pnpm","pnpm dlx skills add makifbaysal\u002Ftasktrooper --skill bevy-ecs-patterns","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fgame-developer\u002Fskills\u002Fbevy-ecs-patterns\u002FSKILL.md",true,[],[51,57,64,71,78,85],{"skillNo":52,"name":53,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":19},"01M7CSVEPQW6J6TD6CS2T5FPNZ","visual-craft","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fvisual-craft\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M7CSVAQG91ETHQ0HBNZDG5FR","ux-copy","Use when you write any words a user reads in a mockup or a hand-off - content language and voice, buttons, labels, errors, empty states, confirmations, numbers and dates, and the longest-string check","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fux-copy\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M7CSV6H0J38659NDXHJQ8396","screen-mockup-html","Use when you draw screens as the design task's HTML mockup - ONE canvas document holding every screen and every variant side by side, the sanitizer-safe recipe, phone and wide frames, the states grid, static control states, and the loopback self-check with screenshots at 375, 768 and 1440 attached to the task","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fscreen-mockup-html\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7CSV3JFRF3BM3XK52M7YEYR","performance-awareness","How the performance score moves for your role. Use when the score context shows a declining trend, or before handing off work you have not self-checked against every criterion.","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fperformance-awareness\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M7CSTZDH00YRF5SCT7BRT9QD","design-variants","Use when a screen design needs variants - how many, variants as side-by-side rows on the one canvas, what makes two variants genuinely different, recommending one, how the human's choice is read, and narrowing to the chosen one in revision","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-variants\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7CSTV6P3SM3PAE28DB0RF77","design-system-authoring","Use when you derive, change or extend a design system - where tokens live per stack, the DTCG token tree, role-based names for both themes, base vs layer vs drift, the DESIGN.md section order, the inventory format, the contrast check and the lint every proposal returns","https:\u002F\u002Fgithub.com\u002Fmakifbaysal\u002Ftasktrooper\u002Fblob\u002Fmain\u002Fcatalog\u002Fagents\u002Fui-designer\u002Fskills\u002Fdesign-system-authoring\u002FSKILL.md",[],[]]